shadowx-fca 8.0.0
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 +1066 -0
- package/build/messagix.dll +0 -0
- package/build/messagix.so +0 -0
- package/checkUpdate.js +393 -0
- package/config.json +17 -0
- package/e2ee.js +563 -0
- package/e2eetest.js +356 -0
- package/index.js +611 -0
- package/lib/index.mjs +1412 -0
- package/logger.js +500 -0
- package/package.json +65 -0
- package/src/GetBotInfo.js +66 -0
- package/src/OldMessage.js +182 -0
- package/src/Screenshot.js +83 -0
- package/src/addExternalModule.js +13 -0
- package/src/addUserToGroup.js +33 -0
- package/src/approveGroupJoinRequests.js +18 -0
- package/src/changeAdminStatus.js +16 -0
- package/src/changeArchivedStatus.js +17 -0
- package/src/changeAvatar.js +136 -0
- package/src/changeAvatarV2.js +86 -0
- package/src/changeAvt.js +85 -0
- package/src/changeBio.js +76 -0
- package/src/changeBlockedStatus.js +20 -0
- package/src/changeBlockedStatusMqtt.js +80 -0
- package/src/changeCover.js +72 -0
- package/src/changeGroupImage.js +16 -0
- package/src/changeName.js +79 -0
- package/src/changeNickname.js +16 -0
- package/src/changeThreadColor.js +15 -0
- package/src/changeThreadEmoji.js +15 -0
- package/src/changeThreadMemberNickname.js +6 -0
- package/src/changeUsername.js +59 -0
- package/src/createCommentPost.js +230 -0
- package/src/createNewGroup.js +38 -0
- package/src/createNote.js +35 -0
- package/src/createPoll.js +27 -0
- package/src/createPost.js +276 -0
- package/src/createThemeAI.js +129 -0
- package/src/data/cache/system/data.json +4 -0
- package/src/data/cache/system/datahandle.js +21 -0
- package/src/data/getThreadInfo.json +1 -0
- package/src/deleteComment.js +23 -0
- package/src/deleteMessage.js +15 -0
- package/src/deleteThread.js +15 -0
- package/src/denyGroupJoinRequests.js +18 -0
- package/src/e2ee/crypto.js +173 -0
- package/src/e2ee/index.js +144 -0
- package/src/e2ee/proto/ArmadilloApplication.proto +281 -0
- package/src/e2ee/proto/ArmadilloICDC.proto +14 -0
- package/src/e2ee/proto/ConsumerApplication.proto +232 -0
- package/src/e2ee/proto/MessageApplication.proto +82 -0
- package/src/e2ee/proto/MessageTransport.proto +77 -0
- package/src/e2ee/proto/WACommon.proto +66 -0
- package/src/e2ee/proto/WAMediaTransport.proto +176 -0
- package/src/e2ee/proto/proto-writer.ts +76 -0
- package/src/e2ee/protocol.js +196 -0
- package/src/e2ee/ratchet.js +219 -0
- package/src/e2ee/store.js +182 -0
- package/src/e2ee.js +8 -0
- package/src/editMessage.js +56 -0
- package/src/editMessageOld.js +67 -0
- package/src/enableReactions.js +24 -0
- package/src/follow.js +74 -0
- package/src/followUser.js +23 -0
- package/src/forwardAttachment.js +16 -0
- package/src/friendList.js +98 -0
- package/src/getAccess.js +112 -0
- package/src/getAppState.js +13 -0
- package/src/getAvatarUser.js +11 -0
- package/src/getBio.js +24 -0
- package/src/getBotInitialData.js +42 -0
- package/src/getCtx.js +5 -0
- package/src/getCurrentUserID.js +6 -0
- package/src/getEmojiUrl.js +29 -0
- package/src/getFriendsList.js +36 -0
- package/src/getMessage.js +37 -0
- package/src/getNotes.js +17 -0
- package/src/getOptions.js +5 -0
- package/src/getPinnedMessages.js +33 -0
- package/src/getPostInfo.js +17 -0
- package/src/getProfileInfo.js +17 -0
- package/src/getPublicData.js +25 -0
- package/src/getRegion.js +7 -0
- package/src/getRepInfo.js +17 -0
- package/src/getStickerPacks.js +25 -0
- package/src/getStickers.js +39 -0
- package/src/getStoryReactions.js +18 -0
- package/src/getThreadHistory.js +45 -0
- package/src/getThreadHistoryDeprecated.js +71 -0
- package/src/getThreadInfo.js +73 -0
- package/src/getThreadInfoDeprecated.js +56 -0
- package/src/getThreadList.js +76 -0
- package/src/getThreadListDeprecated.js +46 -0
- package/src/getThreadPictures.js +59 -0
- package/src/getThreadTheme.js +77 -0
- package/src/getUID.js +17 -0
- package/src/getUserID.js +17 -0
- package/src/getUserInfo.js +28 -0
- package/src/handleFriendRequest.js +21 -0
- package/src/handleMessageRequest.js +15 -0
- package/src/httpGet.js +13 -0
- package/src/httpPost.js +12 -0
- package/src/httpPostFormData.js +12 -0
- package/src/listenE2EE.js +75 -0
- package/src/listenMqtt.js +802 -0
- package/src/listenNotification.js +85 -0
- package/src/logout.js +22 -0
- package/src/markAsDelivered.js +17 -0
- package/src/markAsRead.js +14 -0
- package/src/markAsReadAll.js +15 -0
- package/src/markAsSeen.js +15 -0
- package/src/metaTheme.js +185 -0
- package/src/muteThread.js +52 -0
- package/src/note.js +228 -0
- package/src/pin.js +53 -0
- package/src/pinMessage.js +6 -0
- package/src/postComment.js +29 -0
- package/src/postFormData.js +46 -0
- package/src/reactToComment.js +31 -0
- package/src/reactToPost.js +32 -0
- package/src/refreshFb_dtsg.js +31 -0
- package/src/removeSuspiciousAccount.js +74 -0
- package/src/removeUserFromGroup.js +15 -0
- package/src/reply.js +442 -0
- package/src/resolvePhotoUrl.js +15 -0
- package/src/searchForThread.js +20 -0
- package/src/searchFriends.js +28 -0
- package/src/searchStickers.js +53 -0
- package/src/send.js +46 -0
- package/src/sendAudio.js +8 -0
- package/src/sendBroadcast.js +93 -0
- package/src/sendButtons.js +161 -0
- package/src/sendComment.js +159 -0
- package/src/sendEmoji.js +10 -0
- package/src/sendFile.js +9 -0
- package/src/sendFriendRequest.js +33 -0
- package/src/sendGif.js +24 -0
- package/src/sendImage.js +9 -0
- package/src/sendLocation.js +9 -0
- package/src/sendMessage.js +487 -0
- package/src/sendMessage1.js +309 -0
- package/src/sendMessageMqtt.js +68 -0
- package/src/sendSticker.js +8 -0
- package/src/sendTypingIndicator.js +36 -0
- package/src/sendTypingIndicatorV2.js +28 -0
- package/src/sendVideo.js +9 -0
- package/src/sessionGuard.js +130 -0
- package/src/setActiveStatus.js +16 -0
- package/src/setMessageReaction.js +61 -0
- package/src/setMessageReactionMqtt.js +62 -0
- package/src/setOptions.js +22 -0
- package/src/setPollVote.js +17 -0
- package/src/setPostReaction.js +112 -0
- package/src/setProfileGuard.js +44 -0
- package/src/setProfileLock.js +93 -0
- package/src/setStoryReaction.js +129 -0
- package/src/setStorySeen.js +99 -0
- package/src/setThreadTheme.js +17 -0
- package/src/setTitle.js +15 -0
- package/src/shareContact.js +33 -0
- package/src/shareLink.js +8 -0
- package/src/sharePost.js +31 -0
- package/src/stopListenMqtt.js +23 -0
- package/src/storyManager.js +353 -0
- package/src/suggestFriend.js +128 -0
- package/src/threadColors.js +131 -0
- package/src/unfollowUser.js +23 -0
- package/src/unfriend.js +15 -0
- package/src/unpinMessage.js +6 -0
- package/src/unsendMessage.js +14 -0
- package/src/uploadAttachment.js +58 -0
- package/src/uploadImageToImgbb.js +29 -0
- package/utils.js +2945 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { generateOfflineThreadingID } = require('../utils');
|
|
5
|
+
|
|
6
|
+
function isCallable(func) {
|
|
7
|
+
try {
|
|
8
|
+
Reflect.apply(func, null, []);
|
|
9
|
+
return true;
|
|
10
|
+
} catch (error) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
16
|
+
return function setMessageReactionMqtt(reaction, messageID, threadID, callback) {
|
|
17
|
+
if (!ctx.mqttClient) {
|
|
18
|
+
throw new Error('Not connected to MQTT');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
ctx.wsReqNumber += 1;
|
|
23
|
+
ctx.wsTaskNumber += 1;
|
|
24
|
+
|
|
25
|
+
const taskPayload = {
|
|
26
|
+
thread_key: threadID,
|
|
27
|
+
timestamp_ms: Date.now(),
|
|
28
|
+
message_id: messageID,
|
|
29
|
+
reaction: reaction,
|
|
30
|
+
actor_id: ctx.userID,
|
|
31
|
+
reaction_style: null,
|
|
32
|
+
sync_group: 1,
|
|
33
|
+
send_attribution: Math.random() < 0.5 ? 65537 : 524289
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const task = {
|
|
37
|
+
failure_count: null,
|
|
38
|
+
label: '29',
|
|
39
|
+
payload: JSON.stringify(taskPayload),
|
|
40
|
+
queue_name: JSON.stringify(['reaction', messageID]),
|
|
41
|
+
task_id: ctx.wsTaskNumber,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const content = {
|
|
45
|
+
app_id: '2220391788200892',
|
|
46
|
+
payload: JSON.stringify({
|
|
47
|
+
data_trace_id: null,
|
|
48
|
+
epoch_id: parseInt(generateOfflineThreadingID()),
|
|
49
|
+
tasks: [task],
|
|
50
|
+
version_id: '7158486590867448',
|
|
51
|
+
}),
|
|
52
|
+
request_id: ctx.wsReqNumber,
|
|
53
|
+
type: 3,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
if (isCallable(callback)) {
|
|
57
|
+
ctx.reqCallbacks[ctx.wsReqNumber] = callback;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var logger = require("../logger");
|
|
3
|
+
var VALID_OPTIONS = new Set([
|
|
4
|
+
"logLevel", "listenEvents", "pageID", "updatePresence", "forceLogin",
|
|
5
|
+
"selfListen", "selfListenEvent", "listenTyping", "useWebhook",
|
|
6
|
+
"autoReconnect", "reconnectDelay", "mqttTimeout", "e2ee", "e2eeDevicePath",
|
|
7
|
+
"userAgent", "messageParseMode", "locale"
|
|
8
|
+
]);
|
|
9
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
10
|
+
return function setOptions(options) {
|
|
11
|
+
if (typeof options !== "object" || options === null) {
|
|
12
|
+
return logger.warn("setOptions", "Options must be an object");
|
|
13
|
+
}
|
|
14
|
+
for (var key in options) {
|
|
15
|
+
if (!VALID_OPTIONS.has(key)) {
|
|
16
|
+
logger.warn("setOptions", "Unknown option: " + key);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
ctx.globalOptions[key] = options[key];
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function setPollVote(pollID, optionIDs, newOptionNames, callback) {
|
|
5
|
+
if (typeof newOptionNames === "function") { callback = newOptionNames; newOptionNames = []; }
|
|
6
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
7
|
+
if (!Array.isArray(optionIDs)) optionIDs = [optionIDs];
|
|
8
|
+
var form = { question_id: pollID };
|
|
9
|
+
optionIDs.forEach((id, i) => { form["selected_options[" + i + "]"] = id; });
|
|
10
|
+
(newOptionNames || []).forEach((name, i) => { form["new_options_text[" + i + "]"] = name; });
|
|
11
|
+
defaultFuncs.post("https://www.facebook.com/messaging/group_polling/update_vote/", ctx.jar, form)
|
|
12
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
13
|
+
.then(resData => { if (resData.error) throw resData; cb(null, resData); })
|
|
14
|
+
.catch(err => cb(err));
|
|
15
|
+
return promise;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fix by NTKhang
|
|
3
|
+
* update as Thursday, 10 February 2022
|
|
4
|
+
* do not remove the author name to get more updates
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
const utils = require("../utils");
|
|
10
|
+
// @NethWs3Dev
|
|
11
|
+
|
|
12
|
+
function formatData(resData) {
|
|
13
|
+
return {
|
|
14
|
+
viewer_feedback_reaction_info:
|
|
15
|
+
resData.feedback_react.feedback.viewer_feedback_reaction_info,
|
|
16
|
+
supported_reactions: resData.feedback_react.feedback.supported_reactions,
|
|
17
|
+
top_reactions: resData.feedback_react.feedback.top_reactions.edges,
|
|
18
|
+
reaction_count: resData.feedback_react.feedback.reaction_count,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
23
|
+
return function setPostReaction(postID, type, callback) {
|
|
24
|
+
let resolveFunc = function () {};
|
|
25
|
+
let rejectFunc = function () {};
|
|
26
|
+
const returnPromise = new Promise(function (resolve, reject) {
|
|
27
|
+
resolveFunc = resolve;
|
|
28
|
+
rejectFunc = reject;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (!callback) {
|
|
32
|
+
if (
|
|
33
|
+
utils.getType(type) === "Function" ||
|
|
34
|
+
utils.getType(type) === "AsyncFunction"
|
|
35
|
+
) {
|
|
36
|
+
callback = type;
|
|
37
|
+
type = 0;
|
|
38
|
+
} else {
|
|
39
|
+
callback = function (err, data) {
|
|
40
|
+
if (err) {
|
|
41
|
+
return rejectFunc(err);
|
|
42
|
+
}
|
|
43
|
+
resolveFunc(data);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const map = {
|
|
49
|
+
unlike: 0,
|
|
50
|
+
like: 1,
|
|
51
|
+
heart: 2,
|
|
52
|
+
love: 16,
|
|
53
|
+
haha: 4,
|
|
54
|
+
wow: 3,
|
|
55
|
+
sad: 7,
|
|
56
|
+
angry: 8,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if (utils.getType(type) !== "Number" && utils.getType(type) === "String") {
|
|
60
|
+
type = map[type.toLowerCase()];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (utils.getType(type) !== "Number" && utils.getType(type) !== "String") {
|
|
64
|
+
throw {
|
|
65
|
+
error: "setPostReaction: Invalid reaction type",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (type != 0 && !type) {
|
|
70
|
+
throw {
|
|
71
|
+
error: "setPostReaction: Invalid reaction type",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const form = {
|
|
76
|
+
av: ctx.userID,
|
|
77
|
+
fb_api_caller_class: "RelayModern",
|
|
78
|
+
fb_api_req_friendly_name: "CometUFIFeedbackReactMutation",
|
|
79
|
+
doc_id: "4769042373179384",
|
|
80
|
+
variables: JSON.stringify({
|
|
81
|
+
input: {
|
|
82
|
+
actor_id: ctx.userID,
|
|
83
|
+
feedback_id: new Buffer("feedback:" + postID).toString("base64"),
|
|
84
|
+
feedback_reaction: type,
|
|
85
|
+
feedback_source: "OBJECT",
|
|
86
|
+
is_tracking_encrypted: true,
|
|
87
|
+
tracking: [],
|
|
88
|
+
session_id: "f7dd50dd-db6e-4598-8cd9-561d5002b423",
|
|
89
|
+
client_mutation_id: Math.round(Math.random() * 19).toString(),
|
|
90
|
+
},
|
|
91
|
+
useDefaultActor: false,
|
|
92
|
+
scale: 3,
|
|
93
|
+
}),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
defaultFuncs
|
|
97
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
98
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
99
|
+
.then(function (resData) {
|
|
100
|
+
if (resData.errors) {
|
|
101
|
+
throw resData;
|
|
102
|
+
}
|
|
103
|
+
return callback(null, formatData(resData.data));
|
|
104
|
+
})
|
|
105
|
+
.catch(function (err) {
|
|
106
|
+
console.error("setPostReaction", err);
|
|
107
|
+
return callback(err);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return returnPromise;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const utils = require("../utils");
|
|
4
|
+
// @NethWs3Dev
|
|
5
|
+
module.exports = (defaultFuncs, api, ctx) => {
|
|
6
|
+
return (guard, callback = () => {}) => {
|
|
7
|
+
if (utils.getType(guard) !== "Boolean") {
|
|
8
|
+
throw {
|
|
9
|
+
error: "Please pass a boolean as a second argument.",
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
const uid = ctx.userID;
|
|
13
|
+
const form = {
|
|
14
|
+
av: uid,
|
|
15
|
+
variables: JSON.stringify({
|
|
16
|
+
input: {
|
|
17
|
+
is_shielded: guard ? true : false,
|
|
18
|
+
actor_id: uid,
|
|
19
|
+
client_mutation_id: "1"
|
|
20
|
+
},
|
|
21
|
+
scale: 1
|
|
22
|
+
}),
|
|
23
|
+
doc_id: "1477043292367183",
|
|
24
|
+
fb_api_req_friendly_name: "IsShieldedSetMutation",
|
|
25
|
+
fb_api_caller_class: "IsShieldedSetMutation"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return defaultFuncs
|
|
29
|
+
.post("https://www.facebook.com/api/graphql", ctx.jar, form)
|
|
30
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
31
|
+
.then(function(resData) {
|
|
32
|
+
if (resData.err) {
|
|
33
|
+
throw {
|
|
34
|
+
err: resData.err
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return callback();
|
|
38
|
+
})
|
|
39
|
+
.catch(err => {
|
|
40
|
+
utils.error("setProfileGuard", err);
|
|
41
|
+
return callback(err);
|
|
42
|
+
});;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ===========================================================
|
|
3
|
+
* 🔰 Owner & Developer
|
|
4
|
+
* -----------------------------------------------------------
|
|
5
|
+
* 🕊️ Respect the creator & give proper credits if reused.
|
|
6
|
+
* ===========================================================
|
|
7
|
+
*/
|
|
8
|
+
"use strict";
|
|
9
|
+
|
|
10
|
+
const utils = require("../utils");
|
|
11
|
+
const log = require("npmlog");
|
|
12
|
+
|
|
13
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
14
|
+
return function setProfileLock(enable, callback) {
|
|
15
|
+
let resolveFunc = function () { };
|
|
16
|
+
let rejectFunc = function () { };
|
|
17
|
+
const returnPromise = new Promise(function (resolve, reject) {
|
|
18
|
+
resolveFunc = resolve;
|
|
19
|
+
rejectFunc = reject;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (!callback) {
|
|
23
|
+
callback = function (err, data) {
|
|
24
|
+
if (err) {
|
|
25
|
+
return rejectFunc(err);
|
|
26
|
+
}
|
|
27
|
+
resolveFunc(data);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (typeof enable !== "boolean") {
|
|
32
|
+
return callback(new Error("enable must be a boolean value"));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const form = {
|
|
36
|
+
av: ctx.userID,
|
|
37
|
+
__aaid: 0,
|
|
38
|
+
__user: ctx.userID,
|
|
39
|
+
__a: 1,
|
|
40
|
+
__req: utils.getGUID(),
|
|
41
|
+
__hs: ctx.fb_dtsg_ag,
|
|
42
|
+
dpr: 1,
|
|
43
|
+
__ccg: "EXCELLENT",
|
|
44
|
+
__rev: ctx.req_ID,
|
|
45
|
+
__s: utils.getGUID(),
|
|
46
|
+
__hsi: ctx.hsi,
|
|
47
|
+
__comet_req: 15,
|
|
48
|
+
fb_dtsg: ctx.fb_dtsg,
|
|
49
|
+
jazoest: utils.getJazoest(ctx.fb_dtsg),
|
|
50
|
+
lsd: ctx.fb_dtsg,
|
|
51
|
+
__spin_r: ctx.req_ID,
|
|
52
|
+
__spin_b: "trunk",
|
|
53
|
+
__spin_t: Date.now(),
|
|
54
|
+
__crn: "comet.fbweb.CometProfileTimelineListViewRoute",
|
|
55
|
+
fb_api_caller_class: "RelayModern",
|
|
56
|
+
fb_api_req_friendly_name: "WemPrivateSharingMutation",
|
|
57
|
+
server_timestamps: true,
|
|
58
|
+
variables: JSON.stringify({
|
|
59
|
+
enable: !enable
|
|
60
|
+
}),
|
|
61
|
+
doc_id: "9144138075685633"
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
defaultFuncs
|
|
65
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
66
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
67
|
+
.then(function (resData) {
|
|
68
|
+
if (resData.error) {
|
|
69
|
+
throw resData;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const result = resData?.data?.toggle_wem_private_sharing_control_enabled;
|
|
73
|
+
|
|
74
|
+
if (!result) {
|
|
75
|
+
throw new Error("Cannot toggle profile lock status");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return callback(null, {
|
|
79
|
+
private_sharing_enabled: result.private_sharing_enabled,
|
|
80
|
+
is_ppg_converter: result.is_ppg_converter,
|
|
81
|
+
is_ppg_user: result.is_ppg_user,
|
|
82
|
+
last_toggle_time: result.private_sharing_last_toggle_time,
|
|
83
|
+
owner_id: result.owner_id
|
|
84
|
+
});
|
|
85
|
+
})
|
|
86
|
+
.catch(function (err) {
|
|
87
|
+
log.error("setProfileLock", err);
|
|
88
|
+
return callback(err);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return returnPromise;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ===========================================================
|
|
3
|
+
* 🔰 Owner & Developer
|
|
4
|
+
* -----------------------------------------------------------
|
|
5
|
+
* 🕊️ Respect the creator & give proper credits if reused.
|
|
6
|
+
* ===========================================================
|
|
7
|
+
*/
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var utils = require('../utils.js');
|
|
11
|
+
var log = require('npmlog');
|
|
12
|
+
|
|
13
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
|
14
|
+
return function setStoryReaction(storyID, react, callback) {
|
|
15
|
+
var resolveFunc = function () { };
|
|
16
|
+
var rejectFunc = function () { };
|
|
17
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
|
18
|
+
resolveFunc = resolve;
|
|
19
|
+
rejectFunc = reject;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (typeof react == 'function') {
|
|
23
|
+
callback = react;
|
|
24
|
+
react = '❤️'; // Default heart reaction
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!callback) {
|
|
28
|
+
callback = function (err, data) {
|
|
29
|
+
if (err) return rejectFunc(err);
|
|
30
|
+
resolveFunc(data);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!storyID) {
|
|
35
|
+
return callback({ error: "storyID is required" });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var reactionMap = {
|
|
39
|
+
1: '👍',
|
|
40
|
+
2: '❤️',
|
|
41
|
+
3: '🤗',
|
|
42
|
+
4: '😆',
|
|
43
|
+
5: '😮',
|
|
44
|
+
6: '😢',
|
|
45
|
+
7: '😡',
|
|
46
|
+
'like': '👍',
|
|
47
|
+
'love': '❤️',
|
|
48
|
+
'heart': '❤️',
|
|
49
|
+
'haha': '😆',
|
|
50
|
+
'wow': '😮',
|
|
51
|
+
'sad': '😢',
|
|
52
|
+
'angry': '😡'
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var reaction = reactionMap[react] || react || '❤️';
|
|
56
|
+
|
|
57
|
+
var form = {
|
|
58
|
+
av: ctx.userID,
|
|
59
|
+
__aaid: 0,
|
|
60
|
+
__user: ctx.userID,
|
|
61
|
+
__a: 1,
|
|
62
|
+
__req: utils.getSignatureID(),
|
|
63
|
+
__hs: ctx.fb_dtsg_ag,
|
|
64
|
+
dpr: 1,
|
|
65
|
+
__ccg: "EXCELLENT",
|
|
66
|
+
__rev: ctx.req_ID,
|
|
67
|
+
__s: utils.getSignatureID(),
|
|
68
|
+
__hsi: ctx.hsi,
|
|
69
|
+
__comet_req: 15,
|
|
70
|
+
fb_dtsg: ctx.fb_dtsg,
|
|
71
|
+
jazoest: ctx.ttstamp,
|
|
72
|
+
lsd: ctx.fb_dtsg,
|
|
73
|
+
__spin_r: ctx.req_ID,
|
|
74
|
+
__spin_b: "trunk",
|
|
75
|
+
__spin_t: Date.now(),
|
|
76
|
+
fb_api_caller_class: "RelayModern",
|
|
77
|
+
fb_api_req_friendly_name: "useStoriesSendReplyMutation",
|
|
78
|
+
variables: JSON.stringify({
|
|
79
|
+
input: {
|
|
80
|
+
attribution_id_v2: `StoriesCometSuspenseRoot.react,comet.stories.viewer,unexpected,${Date.now()},356653,,;CometHomeRoot.react,comet.home,tap_tabbar,${Date.now()},109945,4748854339,,`,
|
|
81
|
+
lightweight_reaction_actions: {
|
|
82
|
+
offsets: [0],
|
|
83
|
+
reaction: reaction
|
|
84
|
+
},
|
|
85
|
+
message: reaction,
|
|
86
|
+
story_id: storyID,
|
|
87
|
+
story_reply_type: "LIGHT_WEIGHT",
|
|
88
|
+
actor_id: ctx.userID,
|
|
89
|
+
client_mutation_id: String(Math.floor(Math.random() * 16) + 1)
|
|
90
|
+
}
|
|
91
|
+
}),
|
|
92
|
+
server_timestamps: true,
|
|
93
|
+
doc_id: "9697491553691692"
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
defaultFuncs
|
|
97
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
98
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
99
|
+
.then(function (resData) {
|
|
100
|
+
if (resData.error) throw resData;
|
|
101
|
+
|
|
102
|
+
// Parse successful response
|
|
103
|
+
if (resData.data && resData.data.direct_message_reply) {
|
|
104
|
+
const replyData = resData.data.direct_message_reply;
|
|
105
|
+
return callback(null, {
|
|
106
|
+
success: true,
|
|
107
|
+
client_mutation_id: replyData.client_mutation_id,
|
|
108
|
+
story_id: replyData.story?.id || storyID,
|
|
109
|
+
reaction: reaction,
|
|
110
|
+
story_reactions: replyData.story?.story_card_info?.story_card_reactions?.edges || [],
|
|
111
|
+
timestamp: Date.now()
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return callback(null, {
|
|
116
|
+
success: true,
|
|
117
|
+
reaction: reaction,
|
|
118
|
+
story_id: storyID,
|
|
119
|
+
timestamp: Date.now()
|
|
120
|
+
});
|
|
121
|
+
})
|
|
122
|
+
.catch(function (err) {
|
|
123
|
+
log.error("setStoryReaction", err);
|
|
124
|
+
return callback(err);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return returnPromise;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var utils = require('../utils.js');
|
|
5
|
+
var log = require('npmlog');
|
|
6
|
+
|
|
7
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
|
8
|
+
|
|
9
|
+
return function setStorySeen(storyID, callback) {
|
|
10
|
+
var resolveFunc = function () { };
|
|
11
|
+
var rejectFunc = function () { };
|
|
12
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
|
13
|
+
resolveFunc = resolve;
|
|
14
|
+
rejectFunc = reject;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
if (!callback) {
|
|
18
|
+
callback = function (err, data) {
|
|
19
|
+
if (err) return rejectFunc(err);
|
|
20
|
+
resolveFunc(data);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!storyID) {
|
|
25
|
+
return callback({ error: "storyID is required" });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Extract bucket_id from story_id if needed
|
|
29
|
+
var bucketID = storyID;
|
|
30
|
+
if (typeof storyID === 'string' && storyID.includes(':')) {
|
|
31
|
+
// Extract bucket ID from the story ID pattern
|
|
32
|
+
try {
|
|
33
|
+
var decoded = Buffer.from(storyID, 'base64').toString('utf-8');
|
|
34
|
+
var match = decoded.match(/(\d+)/);
|
|
35
|
+
if (match) {
|
|
36
|
+
bucketID = match[1];
|
|
37
|
+
}
|
|
38
|
+
} catch (e) {
|
|
39
|
+
// Fallback to using story ID as bucket ID
|
|
40
|
+
bucketID = storyID;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var form = {
|
|
45
|
+
av: ctx.userID,
|
|
46
|
+
__aaid: 0,
|
|
47
|
+
__user: ctx.userID,
|
|
48
|
+
__a: 1,
|
|
49
|
+
__req: utils.getSignatureID(),
|
|
50
|
+
__hs: ctx.fb_dtsg_ag,
|
|
51
|
+
dpr: 1,
|
|
52
|
+
__ccg: "EXCELLENT",
|
|
53
|
+
__rev: ctx.req_ID,
|
|
54
|
+
__s: utils.getSignatureID(),
|
|
55
|
+
__hsi: ctx.hsi,
|
|
56
|
+
__comet_req: 15,
|
|
57
|
+
fb_dtsg: ctx.fb_dtsg,
|
|
58
|
+
jazoest: ctx.ttstamp,
|
|
59
|
+
lsd: ctx.fb_dtsg,
|
|
60
|
+
__spin_r: ctx.req_ID,
|
|
61
|
+
__spin_b: "trunk",
|
|
62
|
+
__spin_t: Date.now(),
|
|
63
|
+
fb_api_caller_class: "RelayModern",
|
|
64
|
+
fb_api_req_friendly_name: "storiesUpdateSeenStateMutation",
|
|
65
|
+
variables: JSON.stringify({
|
|
66
|
+
input: {
|
|
67
|
+
bucket_id: bucketID,
|
|
68
|
+
story_id: storyID,
|
|
69
|
+
actor_id: ctx.userID,
|
|
70
|
+
client_mutation_id: String(Math.floor(Math.random() * 16) + 1)
|
|
71
|
+
},
|
|
72
|
+
scale: 1
|
|
73
|
+
}),
|
|
74
|
+
server_timestamps: true,
|
|
75
|
+
doc_id: "9567413276713742"
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
defaultFuncs
|
|
79
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
80
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
81
|
+
.then(function (resData) {
|
|
82
|
+
if (resData.error) throw resData;
|
|
83
|
+
|
|
84
|
+
return callback(null, {
|
|
85
|
+
success: true,
|
|
86
|
+
story_id: storyID,
|
|
87
|
+
bucket_id: bucketID,
|
|
88
|
+
seen_time: Date.now(),
|
|
89
|
+
response: resData
|
|
90
|
+
});
|
|
91
|
+
})
|
|
92
|
+
.catch(function (err) {
|
|
93
|
+
log.error("setStorySeen", err);
|
|
94
|
+
return callback(err);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return returnPromise;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function setThreadTheme(themeID, threadID, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
defaultFuncs.post("https://www.facebook.com/api/graphql/", ctx.jar, {
|
|
7
|
+
fb_api_req_friendly_name: "CometMessengerColorTetraSaveThemeMutation",
|
|
8
|
+
fb_api_caller_class: "RelayModern",
|
|
9
|
+
doc_id: "5785972814783490",
|
|
10
|
+
variables: JSON.stringify({ input: { actor_id: ctx.userID, client_mutation_id: String(ctx.clientMutationId++), thread_key: { thread_fbid: threadID }, theme_id: String(themeID) } })
|
|
11
|
+
})
|
|
12
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
13
|
+
.then(resData => { if (resData.error) throw resData; cb(null, resData); })
|
|
14
|
+
.catch(err => cb(err));
|
|
15
|
+
return promise;
|
|
16
|
+
};
|
|
17
|
+
};
|
package/src/setTitle.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function setTitle(newTitle, threadID, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
defaultFuncs.post("https://www.facebook.com/messaging/set_thread_name/", ctx.jar, {
|
|
7
|
+
thread_name: newTitle,
|
|
8
|
+
thread_id: threadID
|
|
9
|
+
})
|
|
10
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
11
|
+
.then(resData => { if (resData.error) throw resData; cb(null, resData); })
|
|
12
|
+
.catch(err => cb(err));
|
|
13
|
+
return promise;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function shareContact(text, senderID, threadID, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
var mqttClient = ctx.mqttClient || global.mqttClient;
|
|
7
|
+
if (!mqttClient) { cb({ error: "MQTT not connected" }); return promise; }
|
|
8
|
+
ctx.wsReqNumber = (ctx.wsReqNumber || 0) + 1;
|
|
9
|
+
ctx.wsTaskNumber = (ctx.wsTaskNumber || 0) + 1;
|
|
10
|
+
var queryPayload = { contact_id: senderID, sync_group: 1, text: text || "", thread_id: threadID };
|
|
11
|
+
var query = {
|
|
12
|
+
failure_count: null, label: '359',
|
|
13
|
+
payload: JSON.stringify(queryPayload),
|
|
14
|
+
queue_name: 'messenger_contact_sharing',
|
|
15
|
+
task_id: Math.random() * 1001 << 0
|
|
16
|
+
};
|
|
17
|
+
var content = {
|
|
18
|
+
app_id: '2220391788200892',
|
|
19
|
+
payload: JSON.stringify({
|
|
20
|
+
tasks: [query],
|
|
21
|
+
epoch_id: utils.generateOfflineThreadingID(),
|
|
22
|
+
version_id: '7214102258676893'
|
|
23
|
+
}),
|
|
24
|
+
request_id: ctx.wsReqNumber,
|
|
25
|
+
type: 3
|
|
26
|
+
};
|
|
27
|
+
if (typeof callback === "function") {
|
|
28
|
+
ctx.callback_Task[ctx.wsReqNumber] = { callback: cb, type: "shareContact" };
|
|
29
|
+
}
|
|
30
|
+
mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
|
|
31
|
+
return promise;
|
|
32
|
+
};
|
|
33
|
+
};
|
package/src/shareLink.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function shareLink(url, threadID, message, callback) {
|
|
5
|
+
if (typeof message === "function") { callback = message; message = ""; }
|
|
6
|
+
return api.sendMessage({ body: message || "", url }, threadID, callback);
|
|
7
|
+
};
|
|
8
|
+
};
|
package/src/sharePost.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function sharePost(postID, message, callback) {
|
|
5
|
+
if (typeof message === "function") { callback = message; message = ""; }
|
|
6
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
7
|
+
defaultFuncs.post("https://www.facebook.com/api/graphql/", ctx.jar, {
|
|
8
|
+
fb_api_req_friendly_name: "ComposerStoryCreateMutation",
|
|
9
|
+
fb_api_caller_class: "RelayModern",
|
|
10
|
+
doc_id: "6678754238817627",
|
|
11
|
+
variables: JSON.stringify({
|
|
12
|
+
input: {
|
|
13
|
+
actor_id: ctx.userID,
|
|
14
|
+
client_mutation_id: String(ctx.clientMutationId++),
|
|
15
|
+
composer_entry_point: "inline_jenga",
|
|
16
|
+
with_tags_ids: [],
|
|
17
|
+
message: { ranges: [], text: message || "" },
|
|
18
|
+
audience: { undirected_target_type: "SELF" },
|
|
19
|
+
attached_story_fbid: String(postID),
|
|
20
|
+
is_default_story: true,
|
|
21
|
+
is_inline_share: true,
|
|
22
|
+
inline_share_target: { inline_share_target_fbid: String(postID) }
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
27
|
+
.then(resData => { if (resData.error) throw resData; cb(null, resData); })
|
|
28
|
+
.catch(err => cb(err));
|
|
29
|
+
return promise;
|
|
30
|
+
};
|
|
31
|
+
};
|