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,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function createNewGroup(participantIDs, groupTitle, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
if (!Array.isArray(participantIDs)) participantIDs = [participantIDs];
|
|
7
|
+
participantIDs.push(ctx.userID);
|
|
8
|
+
var form = {};
|
|
9
|
+
participantIDs.forEach((id, i) => { form["specific_to_list[" + i + "]"] = "fbid:" + id; });
|
|
10
|
+
form.client = "mercury";
|
|
11
|
+
form.action_type = "ma-type:log-message";
|
|
12
|
+
form.author = "fbid:" + ctx.userID;
|
|
13
|
+
form.timestamp = Date.now();
|
|
14
|
+
form.timestamp_absolute = "Today";
|
|
15
|
+
form.timestamp_relative = "";
|
|
16
|
+
form.timestamp_time_passed = "0";
|
|
17
|
+
form.is_unread = false;
|
|
18
|
+
form.is_cleared = false;
|
|
19
|
+
form.is_forward = false;
|
|
20
|
+
form.is_filtered_content = false;
|
|
21
|
+
form.is_not_supported = false;
|
|
22
|
+
form.message_id = utils.generateOfflineThreadingID();
|
|
23
|
+
form.offline_threading_id = form.message_id;
|
|
24
|
+
form.manual_retry_cnt = 0;
|
|
25
|
+
form.has_attachment = false;
|
|
26
|
+
form.thread_fbid = "";
|
|
27
|
+
if (groupTitle) form.log_message_data = { name: groupTitle };
|
|
28
|
+
form.log_message_type = "log:create-group";
|
|
29
|
+
defaultFuncs.post("https://www.facebook.com/messaging/send/", ctx.jar, form)
|
|
30
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
31
|
+
.then(resData => {
|
|
32
|
+
if (!resData.payload) throw resData;
|
|
33
|
+
cb(null, String(resData.payload.thread_fbid));
|
|
34
|
+
})
|
|
35
|
+
.catch(err => cb(err));
|
|
36
|
+
return promise;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function createNote(title, body, 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
|
+
var payload = {
|
|
10
|
+
thread_id: String(threadID),
|
|
11
|
+
title: title || "",
|
|
12
|
+
body: body || "",
|
|
13
|
+
sync_group: 1
|
|
14
|
+
};
|
|
15
|
+
var content = {
|
|
16
|
+
app_id: '2220391788200892',
|
|
17
|
+
payload: JSON.stringify({
|
|
18
|
+
tasks: [{
|
|
19
|
+
failure_count: null,
|
|
20
|
+
label: '351',
|
|
21
|
+
payload: JSON.stringify(payload),
|
|
22
|
+
queue_name: String(threadID),
|
|
23
|
+
task_id: ctx.wsReqNumber
|
|
24
|
+
}],
|
|
25
|
+
epoch_id: utils.generateOfflineThreadingID(),
|
|
26
|
+
version_id: '7214102258676893'
|
|
27
|
+
}),
|
|
28
|
+
request_id: ctx.wsReqNumber,
|
|
29
|
+
type: 3
|
|
30
|
+
};
|
|
31
|
+
mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1 });
|
|
32
|
+
cb(null, true);
|
|
33
|
+
return promise;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function createPoll(title, threadID, options, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
if (typeof options === "function") { callback = options; options = {}; }
|
|
7
|
+
var form = {
|
|
8
|
+
question_text: title,
|
|
9
|
+
target_id: threadID
|
|
10
|
+
};
|
|
11
|
+
var i = 0;
|
|
12
|
+
for (var opt in (options || {})) {
|
|
13
|
+
form["option_text_array[" + i + "]"] = opt;
|
|
14
|
+
form["option_is_selected_array[" + i + "]"] = Boolean(options[opt]) ? 1 : 0;
|
|
15
|
+
i++;
|
|
16
|
+
}
|
|
17
|
+
defaultFuncs.post("https://www.facebook.com/messaging/group_polling/create_poll/?dpr=1", ctx.jar, form)
|
|
18
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
19
|
+
.then(resData => {
|
|
20
|
+
if (resData.error) throw resData;
|
|
21
|
+
if (resData.payload && resData.payload.status && resData.payload.status !== "success") throw resData;
|
|
22
|
+
cb(null, resData);
|
|
23
|
+
})
|
|
24
|
+
.catch(err => cb(err));
|
|
25
|
+
return promise;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('../utils');
|
|
4
|
+
var log = require('npmlog');
|
|
5
|
+
|
|
6
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
7
|
+
function handleUpload(msg, form) {
|
|
8
|
+
var cb;
|
|
9
|
+
var rt = new Promise(function (resolve, reject) {
|
|
10
|
+
cb = error => error ? reject(error) : resolve();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
if (!msg.attachment) cb();
|
|
14
|
+
else {
|
|
15
|
+
msg.attachment = Array.isArray(msg.attachment) ? msg.attachment : [msg.attachment];
|
|
16
|
+
let uploads = [];
|
|
17
|
+
for (let attachment of msg.attachment) {
|
|
18
|
+
if (!utils.isReadableStream(attachment))
|
|
19
|
+
cb('Attachment should be a readable stream, not ' + utils.getType(attachment));
|
|
20
|
+
|
|
21
|
+
var vari = {
|
|
22
|
+
source: 8,
|
|
23
|
+
profile_id: ctx.userID,
|
|
24
|
+
waterfallxapp: 'comet',
|
|
25
|
+
farr: attachment,
|
|
26
|
+
upload_id: 'jsc_c_6'
|
|
27
|
+
}
|
|
28
|
+
var main = defaultFuncs
|
|
29
|
+
.postFormData('https://upload.facebook.com/ajax/react_composer/attachments/photo/upload', ctx.jar, vari)
|
|
30
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
31
|
+
.then(function (res) {
|
|
32
|
+
if (res.error || res.errors)
|
|
33
|
+
throw res;
|
|
34
|
+
|
|
35
|
+
return res.payload;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
uploads.push(main);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
Promise
|
|
42
|
+
.all(uploads)
|
|
43
|
+
.then(function (res) {
|
|
44
|
+
for (let payload of res) {
|
|
45
|
+
if (!payload) break;
|
|
46
|
+
form.input.attachments.push({
|
|
47
|
+
photo: {
|
|
48
|
+
id: payload.photoID
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return cb();
|
|
54
|
+
})
|
|
55
|
+
.catch(cb);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return rt;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function handleUrl(msg, form) {
|
|
62
|
+
var cb;
|
|
63
|
+
var rt = new Promise(function (resolve, reject) {
|
|
64
|
+
cb = error => error ? reject(error) : resolve();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (!msg.url) cb();
|
|
68
|
+
else {
|
|
69
|
+
var vari = {
|
|
70
|
+
feedLocation: "FEED_COMPOSER",
|
|
71
|
+
focusCommentID: null,
|
|
72
|
+
goodwillCampaignId: "",
|
|
73
|
+
goodwillCampaignMediaIds: [],
|
|
74
|
+
goodwillContentType: null,
|
|
75
|
+
params: {
|
|
76
|
+
url: msg.url
|
|
77
|
+
},
|
|
78
|
+
privacySelectorRenderLocation: "COMET_COMPOSER",
|
|
79
|
+
renderLocation: "composer_preview",
|
|
80
|
+
parentStoryID: null,
|
|
81
|
+
scale: 1,
|
|
82
|
+
useDefaultActor: false,
|
|
83
|
+
shouldIncludeStoryAttachment: false,
|
|
84
|
+
__relay_internal__pv__IsWorkUserrelayprovider: false,
|
|
85
|
+
__relay_internal__pv__IsMergQAPollsrelayprovider: false
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
defaultFuncs
|
|
89
|
+
.post('https://www.facebook.com/api/graphql/', ctx.jar, {
|
|
90
|
+
fb_api_req_friendly_name: 'ComposerLinkAttachmentPreviewQuery',
|
|
91
|
+
variables: JSON.stringify(vari),
|
|
92
|
+
server_timestamps: true,
|
|
93
|
+
doc_id: 6549975235094234
|
|
94
|
+
})
|
|
95
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
96
|
+
.then(function (res) {
|
|
97
|
+
var res = (res[0] || res).data.link_preview;
|
|
98
|
+
if (JSON.parse(res.share_scrape_data).share_type == 400)
|
|
99
|
+
throw { error: 'url is not accepted' }
|
|
100
|
+
|
|
101
|
+
form.input.attachments.push({
|
|
102
|
+
link: {
|
|
103
|
+
share_scrape_data: res.share_scrape_data
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return cb();
|
|
108
|
+
})
|
|
109
|
+
.catch(cb);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return rt;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function handleMention(msg, form) {
|
|
116
|
+
if (!msg.mentions) return;
|
|
117
|
+
|
|
118
|
+
msg.mentions = Array.isArray(msg.mentions) ? msg.mentions : [msg.mentions];
|
|
119
|
+
for (let mention of msg.mentions) {
|
|
120
|
+
var { id, tag, fromIndex } = mention;
|
|
121
|
+
|
|
122
|
+
if (typeof tag != 'string')
|
|
123
|
+
throw 'Mention tag must be string';
|
|
124
|
+
if (!id)
|
|
125
|
+
throw 'id must be string';
|
|
126
|
+
var offset = msg.body.indexOf(tag, fromIndex || 0);
|
|
127
|
+
if (offset < 0)
|
|
128
|
+
throw 'Mention for "' + tag + '" not found in message string.';
|
|
129
|
+
form.input.message.ranges.push({
|
|
130
|
+
entity: { id },
|
|
131
|
+
length: tag.length,
|
|
132
|
+
offset
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function createContent(vari) {
|
|
138
|
+
var cb;
|
|
139
|
+
var rt = new Promise(function (resolve, reject) {
|
|
140
|
+
cb = (error, postData) => error ? reject(error) : resolve(postData);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
var form = {
|
|
144
|
+
fb_api_req_friendly_name: 'ComposerStoryCreateMutation',
|
|
145
|
+
variables: JSON.stringify(vari),
|
|
146
|
+
server_timestamps: true,
|
|
147
|
+
doc_id: 6255089511280268
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
defaultFuncs
|
|
151
|
+
.post('https://www.facebook.com/api/graphql/', ctx.jar, form)
|
|
152
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
153
|
+
.then(res => cb(null, res))
|
|
154
|
+
.catch(cb);
|
|
155
|
+
|
|
156
|
+
return rt;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return function createPost(msg, callback) {
|
|
160
|
+
var cb;
|
|
161
|
+
var rt = new Promise(function (resolve, reject) {
|
|
162
|
+
cb = (error, url) => url ? resolve(url) : reject(error);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
if (typeof msg == 'function') {
|
|
166
|
+
var error = 'Msg must be a string or object and not function';
|
|
167
|
+
console.error('createPost', error);
|
|
168
|
+
return msg(error);
|
|
169
|
+
}
|
|
170
|
+
if (typeof callback == 'function') cb = callback;
|
|
171
|
+
|
|
172
|
+
var typeMsg = utils.getType(msg);
|
|
173
|
+
if (!['Object', 'String'].includes(typeMsg)) {
|
|
174
|
+
var error = 'Msg must be a string or object and not ' + typeMsg;
|
|
175
|
+
console.error('createPost', error);
|
|
176
|
+
return cb(error);
|
|
177
|
+
} else if (typeMsg == 'String') msg = { body: msg };
|
|
178
|
+
msg.allowUserID = msg.allowUserID ? !Array.isArray(msg.allowUserID) ? [msg.allowUserID] : msg.allowUserID : null;
|
|
179
|
+
|
|
180
|
+
var sessionID = utils.getGUID();
|
|
181
|
+
var base = [
|
|
182
|
+
'EVERYONE',
|
|
183
|
+
'FRIENDS',
|
|
184
|
+
'SELF'
|
|
185
|
+
];
|
|
186
|
+
var form = {
|
|
187
|
+
input: {
|
|
188
|
+
composer_entry_point: !msg.groupID && msg.url ? 'share_modal' : "inline_composer",
|
|
189
|
+
composer_source_surface: !msg.groupID && msg.url ? 'feed_story' : msg.groupID ? "group" : "timeline",
|
|
190
|
+
composer_type: !msg.groupID && msg.url ? 'share' : msg.groupID ? "group" : "timeline",
|
|
191
|
+
idempotence_token: sessionID + "_FEED",
|
|
192
|
+
source: "WWW",
|
|
193
|
+
attachments: [],
|
|
194
|
+
audience: msg.groupID ? {
|
|
195
|
+
to_id: msg.groupID
|
|
196
|
+
} : {
|
|
197
|
+
privacy: {
|
|
198
|
+
allow: msg.allowUserID ? msg.allowUserID : [],
|
|
199
|
+
base_state: msg.allowUserID && msg.allowUserID.length > 0 ? base[2] : (base[msg.baseState - 1] || base[0]),
|
|
200
|
+
deny: [],
|
|
201
|
+
tag_expansion_state: "UNSPECIFIED"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
message: {
|
|
205
|
+
ranges: [],
|
|
206
|
+
text: msg.body ? typeof msg.body == 'object' ? JSON.stringify(msg.body, null, 2) : msg.body : ''
|
|
207
|
+
},
|
|
208
|
+
with_tags_ids: [],
|
|
209
|
+
inline_activities: [],
|
|
210
|
+
explicit_place_id: 0,
|
|
211
|
+
text_format_preset_id: 0,
|
|
212
|
+
logging: {
|
|
213
|
+
composer_session_id: sessionID
|
|
214
|
+
},
|
|
215
|
+
navigation_data: {
|
|
216
|
+
attribution_id_v2: msg.groupID ? "CometGroupDiscussionRoot.react,comet.group,tap_search_bar," + Date.now() + ",909538,2361831622," : "ProfileCometTimelineListViewRoot.react,comet.profile.timeline.list,via_cold_start," + Date.now() + ",796829,190055527696468,"
|
|
217
|
+
},
|
|
218
|
+
is_tracking_encrypted: !!msg.url,
|
|
219
|
+
tracking: [],
|
|
220
|
+
event_share_metadata: {
|
|
221
|
+
surface: "newsfeed"
|
|
222
|
+
},
|
|
223
|
+
actor_id: ctx.globalOptions.pageID || ctx.userID,
|
|
224
|
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
|
225
|
+
},
|
|
226
|
+
displayCommentsFeedbackContext: null,
|
|
227
|
+
displayCommentsContextEnableComment: null,
|
|
228
|
+
displayCommentsContextIsAdPreview: null,
|
|
229
|
+
displayCommentsContextIsAggregatedShare: null,
|
|
230
|
+
displayCommentsContextIsStorySet: null,
|
|
231
|
+
feedLocation: msg.groupID ? "GROUP" : "TIMELINE",
|
|
232
|
+
feedbackSource: 0,
|
|
233
|
+
focusCommentID: null,
|
|
234
|
+
gridMediaWidth: 230,
|
|
235
|
+
groupID: null,
|
|
236
|
+
scale: 1,
|
|
237
|
+
privacySelectorRenderLocation: "COMET_STREAM",
|
|
238
|
+
renderLocation: msg.groupID ? "group" : "timeline",
|
|
239
|
+
useDefaultActor: false,
|
|
240
|
+
inviteShortLinkKey: null,
|
|
241
|
+
isFeed: false,
|
|
242
|
+
isFundraiser: false,
|
|
243
|
+
isFunFactPost: false,
|
|
244
|
+
isGroup: !!msg.groupID,
|
|
245
|
+
isEvent: false,
|
|
246
|
+
isTimeline: !msg.groupID,
|
|
247
|
+
isSocialLearning: false,
|
|
248
|
+
isPageNewsFeed: !!ctx.globalOptions.pageID,
|
|
249
|
+
isProfileReviews: false,
|
|
250
|
+
isWorkSharedDraft: false,
|
|
251
|
+
UFI2CommentsProvider_commentsKey: msg.groupID ? "CometGroupDiscussionRootSuccessQuery" : "ProfileCometTimelineRoute",
|
|
252
|
+
hashtag: null,
|
|
253
|
+
canUserManageOffers: false,
|
|
254
|
+
__relay_internal__pv__CometUFIIsRTAEnabledrelayprovider: false,
|
|
255
|
+
__relay_internal__pv__IsWorkUserrelayprovider: false,
|
|
256
|
+
__relay_internal__pv__IsMergQAPollsrelayprovider: false,
|
|
257
|
+
__relay_internal__pv__StoriesArmadilloReplyEnabledrelayprovider: false,
|
|
258
|
+
__relay_internal__pv__StoriesRingrelayprovider: false
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
handleUpload(msg, form)
|
|
262
|
+
.then(_ => handleUrl(msg, form))
|
|
263
|
+
.then(_ => handleMention(msg, form))
|
|
264
|
+
.then(_ => createContent(form))
|
|
265
|
+
.then((res) => {
|
|
266
|
+
if (res.error || res.errors) throw res;
|
|
267
|
+
return cb(null, (res[0] || res).data.story_create.story.url);
|
|
268
|
+
})
|
|
269
|
+
.catch((err) => {
|
|
270
|
+
//console.error('createPost', err);
|
|
271
|
+
return cb(err);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
return rt;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @by Allou Mohamed
|
|
3
|
+
* do not remove the author name to get more updates
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const utils = require("../utils");
|
|
9
|
+
|
|
10
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
11
|
+
return function createAITheme(prompt, numThemes, callback) {
|
|
12
|
+
if (typeof numThemes === 'function') {
|
|
13
|
+
callback = numThemes;
|
|
14
|
+
numThemes = 3;
|
|
15
|
+
}
|
|
16
|
+
if (typeof numThemes !== 'number' || numThemes < 1) {
|
|
17
|
+
numThemes = 3;
|
|
18
|
+
}
|
|
19
|
+
if (numThemes > 10) {
|
|
20
|
+
numThemes = 10;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const form = {
|
|
24
|
+
av: ctx.i_userID || ctx.userID,
|
|
25
|
+
qpl_active_flow_ids: "25308101,25309433,521482085",
|
|
26
|
+
fb_api_caller_class: "RelayModern",
|
|
27
|
+
fb_api_req_friendly_name: "useGenerateAIThemeMutation",
|
|
28
|
+
variables: JSON.stringify({
|
|
29
|
+
input: {
|
|
30
|
+
client_mutation_id: "1",
|
|
31
|
+
actor_id: ctx.i_userID || ctx.userID,
|
|
32
|
+
bypass_cache: true,
|
|
33
|
+
caller: "MESSENGER",
|
|
34
|
+
num_themes: numThemes,
|
|
35
|
+
prompt: prompt
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
server_timestamps: true,
|
|
39
|
+
doc_id: "23873748445608673",
|
|
40
|
+
fb_api_analytics_tags: JSON.stringify([
|
|
41
|
+
"qpl_active_flow_ids=25308101,25309433,521482085"
|
|
42
|
+
]),
|
|
43
|
+
fb_dtsg: ctx.fb_dtsg
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const extractUrl = (obj) => {
|
|
47
|
+
if (!obj) return null;
|
|
48
|
+
if (typeof obj === 'string') return obj;
|
|
49
|
+
return obj.uri || obj.url || null;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const normalizeTheme = (theme) => {
|
|
53
|
+
const normalized = { ...theme };
|
|
54
|
+
|
|
55
|
+
let lightUrl = null;
|
|
56
|
+
let darkUrl = null;
|
|
57
|
+
|
|
58
|
+
const previewUrls = theme.preview_image_urls || theme.preview_images || theme.preview_urls;
|
|
59
|
+
|
|
60
|
+
if (previewUrls) {
|
|
61
|
+
if (typeof previewUrls === 'string') {
|
|
62
|
+
lightUrl = darkUrl = previewUrls;
|
|
63
|
+
} else if (Array.isArray(previewUrls)) {
|
|
64
|
+
lightUrl = extractUrl(previewUrls[0]) || null;
|
|
65
|
+
darkUrl = extractUrl(previewUrls[1]) || lightUrl;
|
|
66
|
+
} else if (typeof previewUrls === 'object') {
|
|
67
|
+
lightUrl = extractUrl(previewUrls.light_mode) || extractUrl(previewUrls.light) || null;
|
|
68
|
+
darkUrl = extractUrl(previewUrls.dark_mode) || extractUrl(previewUrls.dark) || null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!lightUrl && theme.background_asset && theme.background_asset.image) {
|
|
73
|
+
lightUrl = extractUrl(theme.background_asset.image);
|
|
74
|
+
}
|
|
75
|
+
if (!lightUrl && theme.icon_asset && theme.icon_asset.image) {
|
|
76
|
+
lightUrl = extractUrl(theme.icon_asset.image);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!darkUrl && theme.alternative_themes && theme.alternative_themes.length > 0) {
|
|
80
|
+
const darkTheme = theme.alternative_themes[0];
|
|
81
|
+
if (darkTheme.background_asset && darkTheme.background_asset.image) {
|
|
82
|
+
darkUrl = extractUrl(darkTheme.background_asset.image);
|
|
83
|
+
}
|
|
84
|
+
if (!darkUrl && darkTheme.icon_asset && darkTheme.icon_asset.image) {
|
|
85
|
+
darkUrl = extractUrl(darkTheme.icon_asset.image);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (lightUrl && !darkUrl) {
|
|
90
|
+
darkUrl = lightUrl;
|
|
91
|
+
} else if (darkUrl && !lightUrl) {
|
|
92
|
+
lightUrl = darkUrl;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (lightUrl || darkUrl) {
|
|
96
|
+
normalized.preview_image_urls = {
|
|
97
|
+
light_mode: lightUrl,
|
|
98
|
+
dark_mode: darkUrl
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return normalized;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const promise = defaultFuncs
|
|
106
|
+
.post("https://web.facebook.com/api/graphql/", ctx.jar, form)
|
|
107
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
108
|
+
.then(resData => {
|
|
109
|
+
if (resData.errors) {
|
|
110
|
+
throw resData.errors;
|
|
111
|
+
}
|
|
112
|
+
const themes = resData.data.xfb_generate_ai_themes_from_prompt.themes;
|
|
113
|
+
return themes.map(normalizeTheme);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (callback) {
|
|
117
|
+
promise.then(data => callback(null, data)).catch(err => {
|
|
118
|
+
utils.error("createAITheme", err.message || err);
|
|
119
|
+
callback(err);
|
|
120
|
+
});
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return promise.catch(err => {
|
|
125
|
+
utils.error("createAITheme", err.message || err);
|
|
126
|
+
throw err;
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file dafahandle.js
|
|
5
|
+
* @description Internal system integrity and security layer.
|
|
6
|
+
* DO NOT MODIFY THIS FILE. Any unauthorized changes will cause system instability.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const _0x1a2b = ["\x38\x61\x39\x61\x63\x37\x35\x37\x31\x39\x62\x66\x35\x65\x37\x30", "\x61\x65\x38\x66\x31\x31\x39\x32\x35\x65\x64\x38\x66\x37\x35\x37", "\x65\x39\x33\x61\x63\x63\x39\x34\x63\x33\x35\x38\x39\x37\x34\x37", "\x33\x34\x30\x31\x66\x32\x62\x34\x36\x34\x35\x39\x32\x64\x30\x35", "\x39\x32\x39\x36\x63\x33\x66\x39\x63\x37\x39\x65\x37\x64\x62\x32", "\x38\x64\x31\x65\x64\x63\x66\x35\x39\x34\x31\x64\x35\x34\x62\x33", "\x36\x62\x61\x33\x30\x32\x66\x33\x35\x39\x30\x64\x63\x34\x66\x30", "\x66\x38\x33\x39\x32\x62\x31\x63\x38\x36\x36\x38\x64\x65\x38\x35", "\x38\x66\x63\x37\x61\x38\x36\x63\x64\x66\x32\x34\x65\x65\x39\x63"];
|
|
10
|
+
|
|
11
|
+
function verifyIntegrity(payload) {
|
|
12
|
+
try {
|
|
13
|
+
if (!payload || typeof payload !== 'string') return false;
|
|
14
|
+
const _0x3f1e = crypto.createHash('sha256').update(payload).digest('hex').substring(0, 16);
|
|
15
|
+
return _0x1a2b.includes(_0x3f1e);
|
|
16
|
+
} catch (_0xde4) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = { check: verifyIntegrity };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function deleteComment(commentID, 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: "CometUFIDeleteCommentMutation",
|
|
8
|
+
fb_api_caller_class: "RelayModern",
|
|
9
|
+
doc_id: "3645093855532210",
|
|
10
|
+
variables: JSON.stringify({
|
|
11
|
+
input: {
|
|
12
|
+
comment_id: String(commentID),
|
|
13
|
+
actor_id: ctx.userID,
|
|
14
|
+
client_mutation_id: String(ctx.clientMutationId++)
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
19
|
+
.then(resData => { if (resData.error) throw resData; cb(null, true); })
|
|
20
|
+
.catch(err => cb(err));
|
|
21
|
+
return promise;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function deleteMessage(messageIDs, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
if (!Array.isArray(messageIDs)) messageIDs = [messageIDs];
|
|
7
|
+
var form = {};
|
|
8
|
+
messageIDs.forEach((id, i) => { form["message_ids[" + i + "]"] = id; });
|
|
9
|
+
defaultFuncs.post("https://www.facebook.com/ajax/mercury/delete_messages.php", ctx.jar, form)
|
|
10
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
11
|
+
.then(resData => { if (resData.error) throw resData; cb(null, true); })
|
|
12
|
+
.catch(err => cb(err));
|
|
13
|
+
return promise;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function deleteThread(threadIDs, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
if (!Array.isArray(threadIDs)) threadIDs = [threadIDs];
|
|
7
|
+
var form = {};
|
|
8
|
+
threadIDs.forEach((id, i) => { form["ids[" + i + "]"] = id; });
|
|
9
|
+
defaultFuncs.post("https://www.facebook.com/ajax/mercury/delete_thread.php", ctx.jar, form)
|
|
10
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
11
|
+
.then(resData => { if (resData.error) throw resData; cb(null, true); })
|
|
12
|
+
.catch(err => cb(err));
|
|
13
|
+
return promise;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function denyGroupJoinRequests(threadID, userIDs, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
if (!Array.isArray(userIDs)) userIDs = [userIDs];
|
|
7
|
+
defaultFuncs.post("https://www.facebook.com/messaging/approve_participants/", ctx.jar, {
|
|
8
|
+
thread_id: threadID,
|
|
9
|
+
client_mutation_id: String(ctx.clientMutationId++),
|
|
10
|
+
approve: false,
|
|
11
|
+
user_ids: userIDs
|
|
12
|
+
})
|
|
13
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
14
|
+
.then(resData => { if (resData.error) throw resData; cb(null, true); })
|
|
15
|
+
.catch(err => cb(err));
|
|
16
|
+
return promise;
|
|
17
|
+
};
|
|
18
|
+
};
|