@phuquy2203/n8n-nodes-zl-sumo 2.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/credentials/ZaloApi.credentials.d.ts +7 -0
- package/dist/credentials/ZaloApi.credentials.js +49 -0
- package/dist/nodes/Zalo/Zalo.node.d.ts +5 -0
- package/dist/nodes/Zalo/Zalo.node.js +260 -0
- package/dist/nodes/Zalo/zalo.png +0 -0
- package/dist/nodes/Zalo/zalo.svg +3 -0
- package/dist/src/Errors/ZaloApiError.d.ts +4 -0
- package/dist/src/Errors/ZaloApiError.js +11 -0
- package/dist/src/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
- package/dist/src/Errors/ZaloApiLoginQRAborted.js +11 -0
- package/dist/src/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
- package/dist/src/Errors/ZaloApiLoginQRDeclined.js +11 -0
- package/dist/src/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
- package/dist/src/Errors/ZaloApiMissingImageMetadataGetter.js +11 -0
- package/dist/src/Errors/index.d.ts +4 -0
- package/dist/src/Errors/index.js +20 -0
- package/dist/src/apis/acceptFriendRequest.d.ts +2 -0
- package/dist/src/apis/acceptFriendRequest.js +31 -0
- package/dist/src/apis/addGroupBlockedMember.d.ts +2 -0
- package/dist/src/apis/addGroupBlockedMember.js +31 -0
- package/dist/src/apis/addGroupDeputy.d.ts +2 -0
- package/dist/src/apis/addGroupDeputy.js +33 -0
- package/dist/src/apis/addPollOptions.d.ts +14 -0
- package/dist/src/apis/addPollOptions.js +29 -0
- package/dist/src/apis/addQuickMessage.d.ts +11 -0
- package/dist/src/apis/addQuickMessage.js +63 -0
- package/dist/src/apis/addReaction.d.ts +18 -0
- package/dist/src/apis/addReaction.js +297 -0
- package/dist/src/apis/addUnreadMark.d.ts +8 -0
- package/dist/src/apis/addUnreadMark.js +55 -0
- package/dist/src/apis/addUserToGroup.d.ts +5 -0
- package/dist/src/apis/addUserToGroup.js +37 -0
- package/dist/src/apis/blockUser.d.ts +2 -0
- package/dist/src/apis/blockUser.js +31 -0
- package/dist/src/apis/blockViewFeed.d.ts +2 -0
- package/dist/src/apis/blockViewFeed.js +33 -0
- package/dist/src/apis/changeAccountAvatar.d.ts +3 -0
- package/dist/src/apis/changeAccountAvatar.js +58 -0
- package/dist/src/apis/changeFriendAlias.d.ts +2 -0
- package/dist/src/apis/changeFriendAlias.js +30 -0
- package/dist/src/apis/changeGroupAvatar.d.ts +3 -0
- package/dist/src/apis/changeGroupAvatar.js +50 -0
- package/dist/src/apis/changeGroupName.d.ts +4 -0
- package/dist/src/apis/changeGroupName.js +35 -0
- package/dist/src/apis/changeGroupOwner.d.ts +4 -0
- package/dist/src/apis/changeGroupOwner.js +33 -0
- package/dist/src/apis/createAutoReply.d.ts +14 -0
- package/dist/src/apis/createAutoReply.js +40 -0
- package/dist/src/apis/createCatalog.d.ts +7 -0
- package/dist/src/apis/createCatalog.js +32 -0
- package/dist/src/apis/createGroup.d.ts +28 -0
- package/dist/src/apis/createGroup.js +46 -0
- package/dist/src/apis/createNote.d.ts +7 -0
- package/dist/src/apis/createNote.js +50 -0
- package/dist/src/apis/createPoll.d.ts +36 -0
- package/dist/src/apis/createPoll.js +43 -0
- package/dist/src/apis/createProductCatalog.d.ts +23 -0
- package/dist/src/apis/createProductCatalog.js +53 -0
- package/dist/src/apis/createReminder.d.ts +12 -0
- package/dist/src/apis/createReminder.js +66 -0
- package/dist/src/apis/custom.d.ts +9 -0
- package/dist/src/apis/custom.js +17 -0
- package/dist/src/apis/deleteAutoReply.d.ts +5 -0
- package/dist/src/apis/deleteAutoReply.js +32 -0
- package/dist/src/apis/deleteAvatar.d.ts +9 -0
- package/dist/src/apis/deleteAvatar.js +30 -0
- package/dist/src/apis/deleteCatalog.d.ts +2 -0
- package/dist/src/apis/deleteCatalog.js +31 -0
- package/dist/src/apis/deleteChat.d.ts +19 -0
- package/dist/src/apis/deleteChat.js +53 -0
- package/dist/src/apis/deleteGroupInviteBox.d.ts +9 -0
- package/dist/src/apis/deleteGroupInviteBox.js +30 -0
- package/dist/src/apis/deleteMessage.d.ts +14 -0
- package/dist/src/apis/deleteMessage.js +55 -0
- package/dist/src/apis/deleteProductCatalog.d.ts +10 -0
- package/dist/src/apis/deleteProductCatalog.js +34 -0
- package/dist/src/apis/disableGroupLink.d.ts +2 -0
- package/dist/src/apis/disableGroupLink.js +27 -0
- package/dist/src/apis/disperseGroup.d.ts +2 -0
- package/dist/src/apis/disperseGroup.js +31 -0
- package/dist/src/apis/editNote.d.ts +17 -0
- package/dist/src/apis/editNote.js +49 -0
- package/dist/src/apis/editReminder.d.ts +13 -0
- package/dist/src/apis/editReminder.js +64 -0
- package/dist/src/apis/enableGroupLink.d.ts +6 -0
- package/dist/src/apis/enableGroupLink.js +28 -0
- package/dist/src/apis/fetchAccountInfo.d.ts +3 -0
- package/dist/src/apis/fetchAccountInfo.js +13 -0
- package/dist/src/apis/findUser.d.ts +15 -0
- package/dist/src/apis/findUser.js +43 -0
- package/dist/src/apis/forwardMessage.d.ts +24 -0
- package/dist/src/apis/forwardMessage.js +102 -0
- package/dist/src/apis/getAliasList.d.ts +8 -0
- package/dist/src/apis/getAliasList.js +30 -0
- package/dist/src/apis/getAllFriends.d.ts +3 -0
- package/dist/src/apis/getAllFriends.js +35 -0
- package/dist/src/apis/getAllGroups.d.ts +7 -0
- package/dist/src/apis/getAllGroups.js +13 -0
- package/dist/src/apis/getArchivedChatList.d.ts +5 -0
- package/dist/src/apis/getArchivedChatList.js +26 -0
- package/dist/src/apis/getAutoDeleteChat.d.ts +9 -0
- package/dist/src/apis/getAutoDeleteChat.js +24 -0
- package/dist/src/apis/getAutoReplyList.d.ts +6 -0
- package/dist/src/apis/getAutoReplyList.js +27 -0
- package/dist/src/apis/getAvatarList.d.ts +12 -0
- package/dist/src/apis/getAvatarList.js +31 -0
- package/dist/src/apis/getBizAccount.d.ts +24 -0
- package/dist/src/apis/getBizAccount.js +30 -0
- package/dist/src/apis/getCatalogList.d.ts +18 -0
- package/dist/src/apis/getCatalogList.js +35 -0
- package/dist/src/apis/getContext.d.ts +1 -0
- package/dist/src/apis/getContext.js +7 -0
- package/dist/src/apis/getCookie.d.ts +1 -0
- package/dist/src/apis/getCookie.js +12 -0
- package/dist/src/apis/getFriendBoardList.d.ts +5 -0
- package/dist/src/apis/getFriendBoardList.js +29 -0
- package/dist/src/apis/getFriendOnlines.d.ts +10 -0
- package/dist/src/apis/getFriendOnlines.js +38 -0
- package/dist/src/apis/getFriendRecommendations.d.ts +42 -0
- package/dist/src/apis/getFriendRecommendations.js +30 -0
- package/dist/src/apis/getFriendRequestStatus.d.ts +8 -0
- package/dist/src/apis/getFriendRequestStatus.js +28 -0
- package/dist/src/apis/getGroupBlockedMember.d.ts +23 -0
- package/dist/src/apis/getGroupBlockedMember.js +32 -0
- package/dist/src/apis/getGroupInfo.d.ts +16 -0
- package/dist/src/apis/getGroupInfo.js +35 -0
- package/dist/src/apis/getGroupInviteBoxInfo.d.ts +32 -0
- package/dist/src/apis/getGroupInviteBoxInfo.js +41 -0
- package/dist/src/apis/getGroupInviteBoxList.d.ts +38 -0
- package/dist/src/apis/getGroupInviteBoxList.js +34 -0
- package/dist/src/apis/getGroupLinkDetail.d.ts +9 -0
- package/dist/src/apis/getGroupLinkDetail.js +28 -0
- package/dist/src/apis/getGroupLinkInfo.d.ts +34 -0
- package/dist/src/apis/getGroupLinkInfo.js +31 -0
- package/dist/src/apis/getGroupMembersInfo.d.ts +17 -0
- package/dist/src/apis/getGroupMembersInfo.js +27 -0
- package/dist/src/apis/getHiddenConversations.d.ts +11 -0
- package/dist/src/apis/getHiddenConversations.js +26 -0
- package/dist/src/apis/getLabels.d.ts +7 -0
- package/dist/src/apis/getLabels.js +31 -0
- package/dist/src/apis/getListBoard.d.ts +21 -0
- package/dist/src/apis/getListBoard.js +48 -0
- package/dist/src/apis/getListReminder.d.ts +28 -0
- package/dist/src/apis/getListReminder.js +50 -0
- package/dist/src/apis/getMute.d.ts +13 -0
- package/dist/src/apis/getMute.js +25 -0
- package/dist/src/apis/getOwnId.d.ts +1 -0
- package/dist/src/apis/getOwnId.js +7 -0
- package/dist/src/apis/getPendingGroupMembers.d.ts +11 -0
- package/dist/src/apis/getPendingGroupMembers.js +30 -0
- package/dist/src/apis/getPinConversations.d.ts +5 -0
- package/dist/src/apis/getPinConversations.js +25 -0
- package/dist/src/apis/getPollDetail.d.ts +3 -0
- package/dist/src/apis/getPollDetail.js +33 -0
- package/dist/src/apis/getProductCatalogList.d.ts +20 -0
- package/dist/src/apis/getProductCatalogList.js +36 -0
- package/dist/src/apis/getQR.d.ts +4 -0
- package/dist/src/apis/getQR.js +32 -0
- package/dist/src/apis/getQuickMessageList.d.ts +7 -0
- package/dist/src/apis/getQuickMessageList.js +27 -0
- package/dist/src/apis/getRelatedFriendGroup.d.ts +6 -0
- package/dist/src/apis/getRelatedFriendGroup.js +33 -0
- package/dist/src/apis/getReminder.d.ts +3 -0
- package/dist/src/apis/getReminder.js +28 -0
- package/dist/src/apis/getReminderResponses.d.ts +5 -0
- package/dist/src/apis/getReminderResponses.js +27 -0
- package/dist/src/apis/getSentFriendRequest.d.ts +18 -0
- package/dist/src/apis/getSentFriendRequest.js +27 -0
- package/dist/src/apis/getSettings.d.ts +3 -0
- package/dist/src/apis/getSettings.js +23 -0
- package/dist/src/apis/getStickers.d.ts +1 -0
- package/dist/src/apis/getStickers.js +43 -0
- package/dist/src/apis/getStickersDetail.d.ts +24 -0
- package/dist/src/apis/getStickersDetail.js +43 -0
- package/dist/src/apis/getUnreadMark.d.ts +14 -0
- package/dist/src/apis/getUnreadMark.js +33 -0
- package/dist/src/apis/getUserInfo.d.ts +8 -0
- package/dist/src/apis/getUserInfo.js +45 -0
- package/dist/src/apis/inviteUserToGroups.d.ts +10 -0
- package/dist/src/apis/inviteUserToGroups.js +33 -0
- package/dist/src/apis/joinGroupInviteBox.d.ts +2 -0
- package/dist/src/apis/joinGroupInviteBox.js +28 -0
- package/dist/src/apis/joinGroupLink.d.ts +2 -0
- package/dist/src/apis/joinGroupLink.js +30 -0
- package/dist/src/apis/keepAlive.d.ts +4 -0
- package/dist/src/apis/keepAlive.js +25 -0
- package/dist/src/apis/lastOnline.d.ts +7 -0
- package/dist/src/apis/lastOnline.js +29 -0
- package/dist/src/apis/leaveGroup.d.ts +4 -0
- package/dist/src/apis/leaveGroup.js +36 -0
- package/dist/src/apis/listen.d.ts +103 -0
- package/dist/src/apis/listen.js +432 -0
- package/dist/src/apis/lockPoll.d.ts +2 -0
- package/dist/src/apis/lockPoll.js +31 -0
- package/dist/src/apis/login.d.ts +3 -0
- package/dist/src/apis/login.js +101 -0
- package/dist/src/apis/loginQR.d.ts +70 -0
- package/dist/src/apis/loginQR.js +369 -0
- package/dist/src/apis/parseLink.d.ts +21 -0
- package/dist/src/apis/parseLink.js +30 -0
- package/dist/src/apis/rejectFriendRequest.d.ts +2 -0
- package/dist/src/apis/rejectFriendRequest.js +30 -0
- package/dist/src/apis/removeFriend.d.ts +2 -0
- package/dist/src/apis/removeFriend.js +31 -0
- package/dist/src/apis/removeFriendAlias.d.ts +2 -0
- package/dist/src/apis/removeFriendAlias.js +27 -0
- package/dist/src/apis/removeGroupBlockedMember.d.ts +2 -0
- package/dist/src/apis/removeGroupBlockedMember.js +31 -0
- package/dist/src/apis/removeGroupDeputy.d.ts +2 -0
- package/dist/src/apis/removeGroupDeputy.js +33 -0
- package/dist/src/apis/removeQuickMessage.d.ts +5 -0
- package/dist/src/apis/removeQuickMessage.js +30 -0
- package/dist/src/apis/removeReminder.d.ts +3 -0
- package/dist/src/apis/removeReminder.js +43 -0
- package/dist/src/apis/removeUnreadMark.d.ts +8 -0
- package/dist/src/apis/removeUnreadMark.js +53 -0
- package/dist/src/apis/removeUserFromGroup.d.ts +4 -0
- package/dist/src/apis/removeUserFromGroup.js +37 -0
- package/dist/src/apis/resetHiddenConversPin.d.ts +2 -0
- package/dist/src/apis/resetHiddenConversPin.js +23 -0
- package/dist/src/apis/reuseAvatar.d.ts +2 -0
- package/dist/src/apis/reuseAvatar.js +29 -0
- package/dist/src/apis/reviewPendingMemberRequest.d.ts +14 -0
- package/dist/src/apis/reviewPendingMemberRequest.js +41 -0
- package/dist/src/apis/sendBankCard.d.ts +9 -0
- package/dist/src/apis/sendBankCard.js +40 -0
- package/dist/src/apis/sendCard.d.ts +10 -0
- package/dist/src/apis/sendCard.js +62 -0
- package/dist/src/apis/sendDeliveredEvent.d.ts +16 -0
- package/dist/src/apis/sendDeliveredEvent.js +58 -0
- package/dist/src/apis/sendFriendRequest.d.ts +2 -0
- package/dist/src/apis/sendFriendRequest.js +42 -0
- package/dist/src/apis/sendLink.d.ts +10 -0
- package/dist/src/apis/sendLink.js +64 -0
- package/dist/src/apis/sendMessage.d.ts +99 -0
- package/dist/src/apis/sendMessage.js +455 -0
- package/dist/src/apis/sendReport.d.ts +17 -0
- package/dist/src/apis/sendReport.js +56 -0
- package/dist/src/apis/sendSeenEvent.d.ts +16 -0
- package/dist/src/apis/sendSeenEvent.js +66 -0
- package/dist/src/apis/sendSticker.d.ts +10 -0
- package/dist/src/apis/sendSticker.js +60 -0
- package/dist/src/apis/sendTypingEvent.d.ts +5 -0
- package/dist/src/apis/sendTypingEvent.js +36 -0
- package/dist/src/apis/sendVideo.d.ts +35 -0
- package/dist/src/apis/sendVideo.js +121 -0
- package/dist/src/apis/sendVoice.d.ts +12 -0
- package/dist/src/apis/sendVoice.js +76 -0
- package/dist/src/apis/setArchivedConversations.d.ts +10 -0
- package/dist/src/apis/setArchivedConversations.js +37 -0
- package/dist/src/apis/setHiddenConversations.d.ts +3 -0
- package/dist/src/apis/setHiddenConversations.js +42 -0
- package/dist/src/apis/setMute.d.ts +20 -0
- package/dist/src/apis/setMute.js +70 -0
- package/dist/src/apis/setPinnedConversations.d.ts +3 -0
- package/dist/src/apis/setPinnedConversations.js +37 -0
- package/dist/src/apis/sharePoll.d.ts +2 -0
- package/dist/src/apis/sharePoll.js +31 -0
- package/dist/src/apis/unblockUser.d.ts +2 -0
- package/dist/src/apis/unblockUser.js +31 -0
- package/dist/src/apis/undo.d.ts +9 -0
- package/dist/src/apis/undo.js +45 -0
- package/dist/src/apis/undoFriendRequest.d.ts +2 -0
- package/dist/src/apis/undoFriendRequest.js +30 -0
- package/dist/src/apis/updateActiveStatus.d.ts +4 -0
- package/dist/src/apis/updateActiveStatus.js +30 -0
- package/dist/src/apis/updateAutoDeleteChat.d.ts +9 -0
- package/dist/src/apis/updateAutoDeleteChat.js +43 -0
- package/dist/src/apis/updateAutoReply.d.ts +15 -0
- package/dist/src/apis/updateAutoReply.js +41 -0
- package/dist/src/apis/updateCatalog.d.ts +11 -0
- package/dist/src/apis/updateCatalog.js +33 -0
- package/dist/src/apis/updateGroupSettings.d.ts +40 -0
- package/dist/src/apis/updateGroupSettings.js +46 -0
- package/dist/src/apis/updateHiddenConversPin.d.ts +2 -0
- package/dist/src/apis/updateHiddenConversPin.js +33 -0
- package/dist/src/apis/updateLabels.d.ts +15 -0
- package/dist/src/apis/updateLabels.js +37 -0
- package/dist/src/apis/updateLang.d.ts +6 -0
- package/dist/src/apis/updateLang.js +33 -0
- package/dist/src/apis/updateProductCatalog.d.ts +25 -0
- package/dist/src/apis/updateProductCatalog.js +54 -0
- package/dist/src/apis/updateProfile.d.ts +20 -0
- package/dist/src/apis/updateProfile.js +46 -0
- package/dist/src/apis/updateQuickMessage.d.ts +11 -0
- package/dist/src/apis/updateQuickMessage.js +64 -0
- package/dist/src/apis/updateSettings.d.ts +16 -0
- package/dist/src/apis/updateSettings.js +93 -0
- package/dist/src/apis/uploadAttachment.d.ts +50 -0
- package/dist/src/apis/uploadAttachment.js +202 -0
- package/dist/src/apis/uploadProductPhoto.d.ts +14 -0
- package/dist/src/apis/uploadProductPhoto.js +56 -0
- package/dist/src/apis/votePoll.d.ts +5 -0
- package/dist/src/apis/votePoll.js +32 -0
- package/dist/src/apis.d.ts +279 -0
- package/dist/src/apis.js +283 -0
- package/dist/src/context.d.ts +183 -0
- package/dist/src/context.js +33 -0
- package/dist/src/index.d.ts +146 -0
- package/dist/src/index.js +41 -0
- package/dist/src/models/Attachment.d.ts +11 -0
- package/dist/src/models/Attachment.js +2 -0
- package/dist/src/models/AutoReply.d.ts +20 -0
- package/dist/src/models/AutoReply.js +10 -0
- package/dist/src/models/Board.d.ts +60 -0
- package/dist/src/models/Board.js +9 -0
- package/dist/src/models/Catalog.d.ts +16 -0
- package/dist/src/models/Catalog.js +2 -0
- package/dist/src/models/DeliveredMessage.d.ts +27 -0
- package/dist/src/models/DeliveredMessage.js +22 -0
- package/dist/src/models/Enum.d.ts +247 -0
- package/dist/src/models/Enum.js +254 -0
- package/dist/src/models/FriendEvent.d.ts +107 -0
- package/dist/src/models/FriendEvent.js +87 -0
- package/dist/src/models/Group.d.ts +125 -0
- package/dist/src/models/Group.js +14 -0
- package/dist/src/models/GroupEvent.d.ts +178 -0
- package/dist/src/models/GroupEvent.js +94 -0
- package/dist/src/models/Label.d.ts +10 -0
- package/dist/src/models/Label.js +2 -0
- package/dist/src/models/Message.d.ts +91 -0
- package/dist/src/models/Message.js +34 -0
- package/dist/src/models/ProductCatalog.d.ts +17 -0
- package/dist/src/models/ProductCatalog.js +2 -0
- package/dist/src/models/QuickMessage.d.ts +25 -0
- package/dist/src/models/QuickMessage.js +2 -0
- package/dist/src/models/Reaction.d.ts +85 -0
- package/dist/src/models/Reaction.js +74 -0
- package/dist/src/models/Reminder.d.ts +51 -0
- package/dist/src/models/Reminder.js +10 -0
- package/dist/src/models/SeenMessage.d.ts +26 -0
- package/dist/src/models/SeenMessage.js +22 -0
- package/dist/src/models/Typing.d.ts +24 -0
- package/dist/src/models/Typing.js +22 -0
- package/dist/src/models/Undo.d.ts +34 -0
- package/dist/src/models/Undo.js +16 -0
- package/dist/src/models/User.d.ts +49 -0
- package/dist/src/models/User.js +2 -0
- package/dist/src/models/ZBusiness.d.ts +22 -0
- package/dist/src/models/ZBusiness.js +38 -0
- package/dist/src/models/index.d.ts +20 -0
- package/dist/src/models/index.js +36 -0
- package/dist/src/update.d.ts +2 -0
- package/dist/src/update.js +33 -0
- package/dist/src/utils.d.ts +169 -0
- package/dist/src/utils.js +737 -0
- package/dist/src/zalo.d.ts +41 -0
- package/dist/src/zalo.js +110 -0
- package/package.json +60 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loginQR = exports.LoginQRCallbackEventType = void 0;
|
|
4
|
+
const tough_cookie_1 = require("tough-cookie");
|
|
5
|
+
const promises_1 = require("node:fs/promises");
|
|
6
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
7
|
+
const utils_js_1 = require("../utils.js");
|
|
8
|
+
const ZaloApiLoginQRAborted_js_1 = require("../Errors/ZaloApiLoginQRAborted.js");
|
|
9
|
+
const ZaloApiLoginQRDeclined_js_1 = require("../Errors/ZaloApiLoginQRDeclined.js");
|
|
10
|
+
var LoginQRCallbackEventType;
|
|
11
|
+
(function (LoginQRCallbackEventType) {
|
|
12
|
+
LoginQRCallbackEventType[LoginQRCallbackEventType["QRCodeGenerated"] = 0] = "QRCodeGenerated";
|
|
13
|
+
LoginQRCallbackEventType[LoginQRCallbackEventType["QRCodeExpired"] = 1] = "QRCodeExpired";
|
|
14
|
+
LoginQRCallbackEventType[LoginQRCallbackEventType["QRCodeScanned"] = 2] = "QRCodeScanned";
|
|
15
|
+
LoginQRCallbackEventType[LoginQRCallbackEventType["QRCodeDeclined"] = 3] = "QRCodeDeclined";
|
|
16
|
+
LoginQRCallbackEventType[LoginQRCallbackEventType["GotLoginInfo"] = 4] = "GotLoginInfo";
|
|
17
|
+
})(LoginQRCallbackEventType || (exports.LoginQRCallbackEventType = LoginQRCallbackEventType = {}));
|
|
18
|
+
async function loadLoginPage(ctx) {
|
|
19
|
+
const response = await (0, utils_js_1.request)(ctx, "https://id.zalo.me/account?continue=https%3A%2F%2Fchat.zalo.me%2F", {
|
|
20
|
+
headers: {
|
|
21
|
+
accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
|
22
|
+
"accept-language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
|
|
23
|
+
"cache-control": "max-age=0",
|
|
24
|
+
priority: "u=0, i",
|
|
25
|
+
"sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
|
26
|
+
"sec-ch-ua-mobile": "?0",
|
|
27
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
28
|
+
"sec-fetch-dest": "document",
|
|
29
|
+
"sec-fetch-mode": "navigate",
|
|
30
|
+
"sec-fetch-site": "same-site",
|
|
31
|
+
"sec-fetch-user": "?1",
|
|
32
|
+
"upgrade-insecure-requests": "1",
|
|
33
|
+
Referer: "https://chat.zalo.me/",
|
|
34
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
35
|
+
},
|
|
36
|
+
method: "GET",
|
|
37
|
+
});
|
|
38
|
+
const html = await response.text();
|
|
39
|
+
const regex = /https:\/\/stc-zlogin\.zdn\.vn\/main-([\d.]+)\.js/;
|
|
40
|
+
const match = html.match(regex);
|
|
41
|
+
return match === null || match === void 0 ? void 0 : match[1];
|
|
42
|
+
}
|
|
43
|
+
async function getLoginInfo(ctx, version) {
|
|
44
|
+
const form = new URLSearchParams();
|
|
45
|
+
form.append("continue", "https://zalo.me/pc");
|
|
46
|
+
form.append("v", version);
|
|
47
|
+
return await (0, utils_js_1.request)(ctx, "https://id.zalo.me/account/logininfo", {
|
|
48
|
+
headers: {
|
|
49
|
+
accept: "*/*",
|
|
50
|
+
"accept-language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
|
|
51
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
52
|
+
priority: "u=1, i",
|
|
53
|
+
"sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
|
54
|
+
"sec-ch-ua-mobile": "?0",
|
|
55
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
56
|
+
"sec-fetch-dest": "empty",
|
|
57
|
+
"sec-fetch-mode": "cors",
|
|
58
|
+
"sec-fetch-site": "same-origin",
|
|
59
|
+
Referer: "https://id.zalo.me/account?continue=https%3A%2F%2Fzalo.me%2Fpc",
|
|
60
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
61
|
+
},
|
|
62
|
+
body: form,
|
|
63
|
+
method: "POST",
|
|
64
|
+
})
|
|
65
|
+
.then((res) => res.json())
|
|
66
|
+
.catch((0, utils_js_1.logger)(ctx).error);
|
|
67
|
+
}
|
|
68
|
+
async function verifyClient(ctx, version) {
|
|
69
|
+
const form = new URLSearchParams();
|
|
70
|
+
form.append("type", "device");
|
|
71
|
+
form.append("continue", "https://zalo.me/pc");
|
|
72
|
+
form.append("v", version);
|
|
73
|
+
return await (0, utils_js_1.request)(ctx, "https://id.zalo.me/account/verify-client", {
|
|
74
|
+
headers: {
|
|
75
|
+
accept: "*/*",
|
|
76
|
+
"accept-language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
|
|
77
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
78
|
+
priority: "u=1, i",
|
|
79
|
+
"sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
|
80
|
+
"sec-ch-ua-mobile": "?0",
|
|
81
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
82
|
+
"sec-fetch-dest": "empty",
|
|
83
|
+
"sec-fetch-mode": "cors",
|
|
84
|
+
"sec-fetch-site": "same-origin",
|
|
85
|
+
Referer: "https://id.zalo.me/account?continue=https%3A%2F%2Fzalo.me%2Fpc",
|
|
86
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
87
|
+
},
|
|
88
|
+
body: form,
|
|
89
|
+
method: "POST",
|
|
90
|
+
})
|
|
91
|
+
.then((res) => res.json())
|
|
92
|
+
.catch((0, utils_js_1.logger)(ctx).error);
|
|
93
|
+
}
|
|
94
|
+
async function generate(ctx, version) {
|
|
95
|
+
const form = new URLSearchParams();
|
|
96
|
+
form.append("continue", "https://zalo.me/pc");
|
|
97
|
+
form.append("v", version);
|
|
98
|
+
return (await (0, utils_js_1.request)(ctx, "https://id.zalo.me/account/authen/qr/generate", {
|
|
99
|
+
headers: {
|
|
100
|
+
accept: "*/*",
|
|
101
|
+
"accept-language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
|
|
102
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
103
|
+
priority: "u=1, i",
|
|
104
|
+
"sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
|
105
|
+
"sec-ch-ua-mobile": "?0",
|
|
106
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
107
|
+
"sec-fetch-dest": "empty",
|
|
108
|
+
"sec-fetch-mode": "cors",
|
|
109
|
+
"sec-fetch-site": "same-origin",
|
|
110
|
+
Referer: "https://id.zalo.me/account?continue=https%3A%2F%2Fzalo.me%2Fpc",
|
|
111
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
112
|
+
},
|
|
113
|
+
body: form,
|
|
114
|
+
method: "POST",
|
|
115
|
+
})
|
|
116
|
+
.then((res) => res.json())
|
|
117
|
+
.catch((0, utils_js_1.logger)(ctx).error));
|
|
118
|
+
}
|
|
119
|
+
async function saveQRCodeToFile(filepath, imageData) {
|
|
120
|
+
await (0, promises_1.writeFile)(filepath, imageData, "base64");
|
|
121
|
+
}
|
|
122
|
+
async function waitingScan(ctx, version, code, signal) {
|
|
123
|
+
const form = new URLSearchParams();
|
|
124
|
+
form.append("code", code);
|
|
125
|
+
form.append("continue", "https://chat.zalo.me/");
|
|
126
|
+
form.append("v", version);
|
|
127
|
+
return (await (0, utils_js_1.request)(ctx, "https://id.zalo.me/account/authen/qr/waiting-scan", {
|
|
128
|
+
headers: {
|
|
129
|
+
accept: "*/*",
|
|
130
|
+
"accept-language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
|
|
131
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
132
|
+
priority: "u=1, i",
|
|
133
|
+
"sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
|
134
|
+
"sec-ch-ua-mobile": "?0",
|
|
135
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
136
|
+
"sec-fetch-dest": "empty",
|
|
137
|
+
"sec-fetch-mode": "cors",
|
|
138
|
+
"sec-fetch-site": "same-origin",
|
|
139
|
+
Referer: "https://id.zalo.me/account?continue=https%3A%2F%2Fchat.zalo.me%2F",
|
|
140
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
141
|
+
},
|
|
142
|
+
body: form,
|
|
143
|
+
method: "POST",
|
|
144
|
+
signal,
|
|
145
|
+
})
|
|
146
|
+
.then((res) => res.json())
|
|
147
|
+
.then((data) => {
|
|
148
|
+
if (data.error_code == 8) {
|
|
149
|
+
return waitingScan(ctx, version, code, signal);
|
|
150
|
+
}
|
|
151
|
+
return data;
|
|
152
|
+
})
|
|
153
|
+
.catch((e) => {
|
|
154
|
+
if (!signal.aborted)
|
|
155
|
+
(0, utils_js_1.logger)(ctx).error(e);
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
async function waitingConfirm(ctx, version, code, signal) {
|
|
159
|
+
const form = new URLSearchParams();
|
|
160
|
+
form.append("code", code);
|
|
161
|
+
form.append("gToken", "");
|
|
162
|
+
form.append("gAction", "CONFIRM_QR");
|
|
163
|
+
form.append("continue", "https://chat.zalo.me/");
|
|
164
|
+
form.append("v", version);
|
|
165
|
+
(0, utils_js_1.logger)(ctx).info("Please confirm on your phone");
|
|
166
|
+
return (await (0, utils_js_1.request)(ctx, "https://id.zalo.me/account/authen/qr/waiting-confirm", {
|
|
167
|
+
headers: {
|
|
168
|
+
accept: "*/*",
|
|
169
|
+
"accept-language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
|
|
170
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
171
|
+
priority: "u=1, i",
|
|
172
|
+
"sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
|
173
|
+
"sec-ch-ua-mobile": "?0",
|
|
174
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
175
|
+
"sec-fetch-dest": "empty",
|
|
176
|
+
"sec-fetch-mode": "cors",
|
|
177
|
+
"sec-fetch-site": "same-origin",
|
|
178
|
+
Referer: "https://id.zalo.me/account?continue=https%3A%2F%2Fchat.zalo.me%2F",
|
|
179
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
180
|
+
},
|
|
181
|
+
body: form,
|
|
182
|
+
method: "POST",
|
|
183
|
+
signal,
|
|
184
|
+
})
|
|
185
|
+
.then((res) => res.json())
|
|
186
|
+
.then((data) => {
|
|
187
|
+
if (data.error_code == 8) {
|
|
188
|
+
return waitingConfirm(ctx, version, code, signal);
|
|
189
|
+
}
|
|
190
|
+
return data;
|
|
191
|
+
})
|
|
192
|
+
.catch((e) => {
|
|
193
|
+
if (!signal.aborted)
|
|
194
|
+
(0, utils_js_1.logger)(ctx).error(e);
|
|
195
|
+
}));
|
|
196
|
+
}
|
|
197
|
+
async function checkSession(ctx) {
|
|
198
|
+
return await (0, utils_js_1.request)(ctx, "https://id.zalo.me/account/checksession?continue=https%3A%2F%2Fchat.zalo.me%2Findex.html", {
|
|
199
|
+
headers: {
|
|
200
|
+
accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
|
201
|
+
"accept-language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
|
|
202
|
+
priority: "u=0, i",
|
|
203
|
+
"sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
|
204
|
+
"sec-ch-ua-mobile": "?0",
|
|
205
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
206
|
+
"sec-fetch-dest": "document",
|
|
207
|
+
"sec-fetch-mode": "navigate",
|
|
208
|
+
"sec-fetch-site": "same-origin",
|
|
209
|
+
"upgrade-insecure-requests": "1",
|
|
210
|
+
Referer: "https://id.zalo.me/account?continue=https%3A%2F%2Fchat.zalo.me%2F",
|
|
211
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
212
|
+
},
|
|
213
|
+
redirect: "manual",
|
|
214
|
+
method: "GET",
|
|
215
|
+
}).catch((0, utils_js_1.logger)(ctx).error);
|
|
216
|
+
}
|
|
217
|
+
async function getUserInfo(ctx) {
|
|
218
|
+
return (await (0, utils_js_1.request)(ctx, "https://jr.chat.zalo.me/jr/userinfo", {
|
|
219
|
+
headers: {
|
|
220
|
+
accept: "*/*",
|
|
221
|
+
"accept-language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
|
|
222
|
+
priority: "u=1, i",
|
|
223
|
+
"sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
|
224
|
+
"sec-ch-ua-mobile": "?0",
|
|
225
|
+
"sec-ch-ua-platform": '"Windows"',
|
|
226
|
+
"sec-fetch-dest": "empty",
|
|
227
|
+
"sec-fetch-mode": "cors",
|
|
228
|
+
"sec-fetch-site": "same-site",
|
|
229
|
+
Referer: "https://chat.zalo.me/",
|
|
230
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
231
|
+
},
|
|
232
|
+
method: "GET",
|
|
233
|
+
})
|
|
234
|
+
.then((res) => res.json())
|
|
235
|
+
.catch((0, utils_js_1.logger)(ctx).error));
|
|
236
|
+
}
|
|
237
|
+
async function loginQR(ctx, options, callback) {
|
|
238
|
+
ctx.cookie = new tough_cookie_1.CookieJar();
|
|
239
|
+
ctx.userAgent = options.userAgent;
|
|
240
|
+
return new Promise(async (resolve, reject) => {
|
|
241
|
+
var _a;
|
|
242
|
+
const controller = new AbortController();
|
|
243
|
+
let qrTimeout = null;
|
|
244
|
+
function cleanUp() {
|
|
245
|
+
controller.abort();
|
|
246
|
+
if (qrTimeout) {
|
|
247
|
+
clearTimeout(qrTimeout);
|
|
248
|
+
qrTimeout = null;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
try {
|
|
252
|
+
function retry() {
|
|
253
|
+
cleanUp();
|
|
254
|
+
return resolve(loginQR(ctx, options, callback));
|
|
255
|
+
}
|
|
256
|
+
function abort() {
|
|
257
|
+
cleanUp();
|
|
258
|
+
return reject(new ZaloApiLoginQRAborted_js_1.ZaloApiLoginQRAborted());
|
|
259
|
+
}
|
|
260
|
+
if (ctx.options.logging)
|
|
261
|
+
console.log();
|
|
262
|
+
const loginVersion = await loadLoginPage(ctx);
|
|
263
|
+
if (!loginVersion)
|
|
264
|
+
throw new ZaloApiError_js_1.ZaloApiError("Cannot get API login version");
|
|
265
|
+
(0, utils_js_1.logger)(ctx).info("Got login version:", loginVersion);
|
|
266
|
+
await getLoginInfo(ctx, loginVersion);
|
|
267
|
+
await verifyClient(ctx, loginVersion);
|
|
268
|
+
const qrGenResult = await generate(ctx, loginVersion);
|
|
269
|
+
if (!qrGenResult || !qrGenResult.data)
|
|
270
|
+
throw new ZaloApiError_js_1.ZaloApiError(`Unable to generate QRCode\nResponse: ${JSON.stringify(qrGenResult, null, 2)}`);
|
|
271
|
+
const qrData = qrGenResult.data;
|
|
272
|
+
if (callback) {
|
|
273
|
+
callback({
|
|
274
|
+
type: LoginQRCallbackEventType.QRCodeGenerated,
|
|
275
|
+
data: Object.assign(Object.assign({}, qrGenResult.data), { image: qrGenResult.data.image.replace(/^data:image\/png;base64,/, "") }),
|
|
276
|
+
actions: {
|
|
277
|
+
async saveToFile(qrPath) {
|
|
278
|
+
var _a;
|
|
279
|
+
if (qrPath === void 0) { qrPath = (_a = options.qrPath) !== null && _a !== void 0 ? _a : "qr.png"; }
|
|
280
|
+
await saveQRCodeToFile(qrPath, qrData.image.replace(/^data:image\/png;base64,/, ""));
|
|
281
|
+
(0, utils_js_1.logger)(ctx).info("Scan the QR code at", `'${qrPath}'`, "to proceed with login");
|
|
282
|
+
},
|
|
283
|
+
retry,
|
|
284
|
+
abort,
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
const qrPath = (_a = options.qrPath) !== null && _a !== void 0 ? _a : "qr.png";
|
|
290
|
+
await saveQRCodeToFile(qrPath, qrData.image.replace(/^data:image\/png;base64,/, ""));
|
|
291
|
+
(0, utils_js_1.logger)(ctx).info("Scan the QR code at", `'${qrPath}'`, "to proceed with login");
|
|
292
|
+
}
|
|
293
|
+
qrTimeout = setTimeout(() => {
|
|
294
|
+
cleanUp();
|
|
295
|
+
(0, utils_js_1.logger)(ctx).info("QR expired!");
|
|
296
|
+
if (callback) {
|
|
297
|
+
callback({
|
|
298
|
+
type: LoginQRCallbackEventType.QRCodeExpired,
|
|
299
|
+
data: null,
|
|
300
|
+
actions: {
|
|
301
|
+
retry,
|
|
302
|
+
abort,
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
retry();
|
|
308
|
+
}
|
|
309
|
+
}, 100000);
|
|
310
|
+
const scanResult = await waitingScan(ctx, loginVersion, qrGenResult.data.code, controller.signal);
|
|
311
|
+
if (!scanResult || !scanResult.data)
|
|
312
|
+
throw new ZaloApiError_js_1.ZaloApiError("Cannot get scan result");
|
|
313
|
+
if (callback) {
|
|
314
|
+
callback({
|
|
315
|
+
type: LoginQRCallbackEventType.QRCodeScanned,
|
|
316
|
+
data: scanResult.data,
|
|
317
|
+
actions: {
|
|
318
|
+
retry,
|
|
319
|
+
abort,
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
const confirmResult = await waitingConfirm(ctx, loginVersion, qrGenResult.data.code, controller.signal);
|
|
324
|
+
if (!confirmResult)
|
|
325
|
+
throw new ZaloApiError_js_1.ZaloApiError("Cannot get confirm result");
|
|
326
|
+
clearTimeout(qrTimeout);
|
|
327
|
+
if (confirmResult.error_code == -13) {
|
|
328
|
+
if (callback) {
|
|
329
|
+
callback({
|
|
330
|
+
type: LoginQRCallbackEventType.QRCodeDeclined,
|
|
331
|
+
data: {
|
|
332
|
+
code: qrData.code,
|
|
333
|
+
},
|
|
334
|
+
actions: {
|
|
335
|
+
retry,
|
|
336
|
+
abort,
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
(0, utils_js_1.logger)(ctx).error("QRCode login declined");
|
|
342
|
+
throw new ZaloApiLoginQRDeclined_js_1.ZaloApiLoginQRDeclined();
|
|
343
|
+
}
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
else if (confirmResult.error_code != 0) {
|
|
347
|
+
throw new ZaloApiError_js_1.ZaloApiError(`An error has occurred.\nResponse: ${JSON.stringify(confirmResult, null, 2)}`);
|
|
348
|
+
}
|
|
349
|
+
const checkSessionResult = await checkSession(ctx);
|
|
350
|
+
if (!checkSessionResult)
|
|
351
|
+
throw new ZaloApiError_js_1.ZaloApiError("Cannot get session, login failed");
|
|
352
|
+
(0, utils_js_1.logger)(ctx).info("Successfully logged into the account", scanResult.data.display_name);
|
|
353
|
+
const userInfo = await getUserInfo(ctx);
|
|
354
|
+
if (!userInfo || !userInfo.data)
|
|
355
|
+
throw new ZaloApiError_js_1.ZaloApiError("Can't get account info");
|
|
356
|
+
if (!userInfo.data.logged)
|
|
357
|
+
throw new ZaloApiError_js_1.ZaloApiError("Can't login");
|
|
358
|
+
resolve({
|
|
359
|
+
cookies: ctx.cookie.toJSON().cookies,
|
|
360
|
+
userInfo: userInfo.data.info,
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
catch (error) {
|
|
364
|
+
cleanUp();
|
|
365
|
+
reject(error);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
exports.loginQR = loginQR;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ParseLinkErrorMaps = Record<string, number>;
|
|
2
|
+
export type ParseLinkResponse = {
|
|
3
|
+
data: {
|
|
4
|
+
thumb: string;
|
|
5
|
+
title: string;
|
|
6
|
+
desc: string;
|
|
7
|
+
src: string;
|
|
8
|
+
href: string;
|
|
9
|
+
media: {
|
|
10
|
+
type: number;
|
|
11
|
+
count: number;
|
|
12
|
+
mediaTitle: string;
|
|
13
|
+
artist: string;
|
|
14
|
+
streamUrl: string;
|
|
15
|
+
stream_icon: string;
|
|
16
|
+
};
|
|
17
|
+
stream_icon: string;
|
|
18
|
+
};
|
|
19
|
+
error_maps: ParseLinkErrorMaps;
|
|
20
|
+
};
|
|
21
|
+
export declare const parseLinkFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (link: string) => Promise<ParseLinkResponse>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseLinkFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.parseLinkFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.file[0]}/api/message/parselink`);
|
|
8
|
+
/**
|
|
9
|
+
* Parse link
|
|
10
|
+
*
|
|
11
|
+
* @param link link to parse
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
return async function parseLink(link) {
|
|
17
|
+
const params = {
|
|
18
|
+
link,
|
|
19
|
+
version: 1, // version 0 is not available errorMaps || version 1 is errorMaps (for response)
|
|
20
|
+
imei: ctx.imei,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams)
|
|
24
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
25
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
26
|
+
method: "GET",
|
|
27
|
+
});
|
|
28
|
+
return utils.resolve(response);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rejectFriendRequestFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.rejectFriendRequestFactory = (0, utils_js_1.apiFactory)()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/reject`);
|
|
8
|
+
/**
|
|
9
|
+
* Reject a friend request from a User
|
|
10
|
+
*
|
|
11
|
+
* @param friendId
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function rejectFriendRequest(friendId) {
|
|
16
|
+
const params = {
|
|
17
|
+
fid: friendId,
|
|
18
|
+
};
|
|
19
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
20
|
+
if (!encryptedParams)
|
|
21
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
22
|
+
const response = await utils.request(serviceURL, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
body: new URLSearchParams({
|
|
25
|
+
params: encryptedParams,
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
return utils.resolve(response);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeFriendFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.removeFriendFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/remove`);
|
|
8
|
+
/**
|
|
9
|
+
* Remove friend
|
|
10
|
+
*
|
|
11
|
+
* @param friendId - ID of the friend to remove
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function removeFriend(friendId) {
|
|
16
|
+
const params = {
|
|
17
|
+
fid: friendId,
|
|
18
|
+
imei: ctx.imei,
|
|
19
|
+
};
|
|
20
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
21
|
+
if (!encryptedParams)
|
|
22
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
23
|
+
const response = await utils.request(serviceURL, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
body: new URLSearchParams({
|
|
26
|
+
params: encryptedParams,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
return utils.resolve(response);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeFriendAliasFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.removeFriendAliasFactory = (0, utils_js_1.apiFactory)()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.alias[0]}/api/alias/remove`);
|
|
8
|
+
/**
|
|
9
|
+
* Remove friend's alias
|
|
10
|
+
*
|
|
11
|
+
* @param friendId friend id
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function removeFriendAlias(friendId) {
|
|
16
|
+
const params = {
|
|
17
|
+
friendId: friendId,
|
|
18
|
+
};
|
|
19
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
20
|
+
if (!encryptedParams)
|
|
21
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
22
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
23
|
+
method: "GET",
|
|
24
|
+
});
|
|
25
|
+
return utils.resolve(response);
|
|
26
|
+
};
|
|
27
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeGroupBlockedMemberFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.removeGroupBlockedMemberFactory = (0, utils_js_1.apiFactory)()((api, _, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/blockedmems/remove`);
|
|
8
|
+
/**
|
|
9
|
+
* Remove group blocked member
|
|
10
|
+
*
|
|
11
|
+
* @param memberId member id(s)
|
|
12
|
+
* @param groupId group id
|
|
13
|
+
*
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function removeGroupBlockedMember(memberId, groupId) {
|
|
17
|
+
if (!Array.isArray(memberId))
|
|
18
|
+
memberId = [memberId];
|
|
19
|
+
const params = {
|
|
20
|
+
grid: groupId,
|
|
21
|
+
members: memberId,
|
|
22
|
+
};
|
|
23
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
24
|
+
if (!encryptedParams)
|
|
25
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
26
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
27
|
+
method: "GET",
|
|
28
|
+
});
|
|
29
|
+
return utils.resolve(response);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeGroupDeputyFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.removeGroupDeputyFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/admins/remove`);
|
|
8
|
+
/**
|
|
9
|
+
* Remove group deputy
|
|
10
|
+
*
|
|
11
|
+
* @param memberId user Id or list of user Ids
|
|
12
|
+
* @param groupId group Id
|
|
13
|
+
*
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
return async function removeGroupDeputy(memberId, groupId) {
|
|
18
|
+
if (!Array.isArray(memberId))
|
|
19
|
+
memberId = [memberId];
|
|
20
|
+
const params = {
|
|
21
|
+
grid: groupId,
|
|
22
|
+
members: memberId,
|
|
23
|
+
imei: ctx.imei,
|
|
24
|
+
};
|
|
25
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
26
|
+
if (!encryptedParams)
|
|
27
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
28
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
29
|
+
method: "GET",
|
|
30
|
+
});
|
|
31
|
+
return utils.resolve(response);
|
|
32
|
+
};
|
|
33
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type RemoveQuickMessageResponse = {
|
|
2
|
+
itemIds: number[];
|
|
3
|
+
version: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const removeQuickMessageFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (itemIds: number | number[]) => Promise<RemoveQuickMessageResponse>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeQuickMessageFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.removeQuickMessageFactory = (0, utils_js_1.apiFactory)()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.quick_message[0]}/api/quickmessage/delete`);
|
|
8
|
+
/**
|
|
9
|
+
* Remove quick message
|
|
10
|
+
*
|
|
11
|
+
* @param itemIds - The id(s) of the quick message(s) to remove (number or number[])
|
|
12
|
+
*
|
|
13
|
+
* @note Zalo might throw an error with code 212 if the item does not exist
|
|
14
|
+
*
|
|
15
|
+
* @throws {ZaloApiError}
|
|
16
|
+
*/
|
|
17
|
+
return async function removeQuickMessage(itemIds) {
|
|
18
|
+
const idsArray = Array.isArray(itemIds) ? itemIds : [itemIds];
|
|
19
|
+
const params = {
|
|
20
|
+
itemIds: idsArray,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams)
|
|
24
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
25
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
26
|
+
method: "GET",
|
|
27
|
+
});
|
|
28
|
+
return utils.resolve(response);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type RemoveReminderResponse = "" | number;
|
|
3
|
+
export declare const removeReminderFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (reminderId: string, threadId: string, type?: ThreadType) => Promise<RemoveReminderResponse>;
|