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,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
@NethWs3Dev
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// @NethWs3Dev
|
|
8
|
+
module.exports = function (defaultFuncs, api, ctx){
|
|
9
|
+
return function stopListenMqtt() {
|
|
10
|
+
if (!ctx.mqttClient) {
|
|
11
|
+
throw new Error("Not connected to MQTT");
|
|
12
|
+
}
|
|
13
|
+
console.log("stopListenMqtt", "Stopping...");
|
|
14
|
+
ctx.mqttClient.unsubscribe("/webrtc");
|
|
15
|
+
ctx.mqttClient.unsubscribe("/rtc_multi");
|
|
16
|
+
ctx.mqttClient.unsubscribe("/onevc");
|
|
17
|
+
ctx.mqttClient.publish("/browser_close", "{}");
|
|
18
|
+
ctx.mqttClient.end(false, (...data) => {
|
|
19
|
+
console.log("stopListenMqtt", "Stopped");
|
|
20
|
+
ctx.mqttClient = null;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,353 @@
|
|
|
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 storyManager(options, 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 (!callback) {
|
|
23
|
+
callback = function (err, data) {
|
|
24
|
+
if (err) return rejectFunc(err);
|
|
25
|
+
resolveFunc(data);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!options || typeof options !== 'object') {
|
|
30
|
+
return callback({ error: "Options object is required" });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { action, attachment, storyID } = options;
|
|
34
|
+
|
|
35
|
+
if (!action || !['add', 'upload', 'delete', 'check'].includes(action)) {
|
|
36
|
+
return callback({ error: "Action must be 'add', 'upload', 'delete', or 'check'" });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Helper function to upload story attachment
|
|
40
|
+
function uploadStoryAttachment(attachment) {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
if (!utils.isReadableStream(attachment)) {
|
|
43
|
+
return reject({ error: 'Attachment should be a readable stream and not ' + utils.getType(attachment) });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const uploadForm = {
|
|
47
|
+
source: "8",
|
|
48
|
+
profile_id: ctx.userID,
|
|
49
|
+
waterfallxapp: "comet_stories",
|
|
50
|
+
farr: attachment,
|
|
51
|
+
upload_id: "jsc_c_m"
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const uploadUrl = `https://upload.facebook.com/ajax/react_composer/attachments/photo/upload?av=${ctx.userID}&__aaid=0&__user=${ctx.userID}&__a=1&__req=${utils.getSignatureID()}&__hs=${ctx.fb_dtsg_ag}&dpr=1&__ccg=EXCELLENT&__rev=${ctx.req_ID}&__s=${utils.getSignatureID()}&__hsi=${ctx.hsi}&__comet_req=15&fb_dtsg=${ctx.fb_dtsg}&jazoest=${ctx.ttstamp}&lsd=${ctx.fb_dtsg}&__spin_r=${ctx.req_ID}&__spin_b=trunk&__spin_t=${Date.now()}`;
|
|
55
|
+
|
|
56
|
+
defaultFuncs
|
|
57
|
+
.postFormData(uploadUrl, ctx.jar, uploadForm)
|
|
58
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
59
|
+
.then(function (resData) {
|
|
60
|
+
if (resData.error || !resData.payload || !resData.payload.photoID) {
|
|
61
|
+
throw resData || { error: "Upload failed - no photo ID returned" };
|
|
62
|
+
}
|
|
63
|
+
resolve(resData.payload.photoID);
|
|
64
|
+
})
|
|
65
|
+
.catch(reject);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Helper function to create story
|
|
70
|
+
function createStory(photoID) {
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
const form = {
|
|
73
|
+
av: ctx.userID,
|
|
74
|
+
__aaid: 0,
|
|
75
|
+
__user: ctx.userID,
|
|
76
|
+
__a: 1,
|
|
77
|
+
__req: utils.getSignatureID(),
|
|
78
|
+
__hs: ctx.fb_dtsg_ag,
|
|
79
|
+
dpr: 1,
|
|
80
|
+
__ccg: "EXCELLENT",
|
|
81
|
+
__rev: ctx.req_ID,
|
|
82
|
+
__s: utils.getSignatureID(),
|
|
83
|
+
__hsi: ctx.hsi,
|
|
84
|
+
__comet_req: 15,
|
|
85
|
+
fb_dtsg: ctx.fb_dtsg,
|
|
86
|
+
jazoest: ctx.ttstamp,
|
|
87
|
+
lsd: ctx.fb_dtsg,
|
|
88
|
+
__spin_r: ctx.req_ID,
|
|
89
|
+
__spin_b: "trunk",
|
|
90
|
+
__spin_t: Date.now(),
|
|
91
|
+
fb_api_caller_class: "RelayModern",
|
|
92
|
+
fb_api_req_friendly_name: "StoriesCreateMutation",
|
|
93
|
+
variables: JSON.stringify({
|
|
94
|
+
input: {
|
|
95
|
+
audiences: [{
|
|
96
|
+
stories: {
|
|
97
|
+
self: {
|
|
98
|
+
target_id: ctx.userID
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}],
|
|
102
|
+
audiences_is_complete: true,
|
|
103
|
+
logging: {
|
|
104
|
+
composer_session_id: `${Math.random().toString(36).substring(2, 8)}-${Math.random().toString(36).substring(2, 4)}-${Math.random().toString(36).substring(2, 4)}-${Math.random().toString(36).substring(2, 4)}-${Math.random().toString(36).substring(2, 12)}`
|
|
105
|
+
},
|
|
106
|
+
navigation_data: {
|
|
107
|
+
attribution_id_v2: `StoriesCreateRoot.react,comet.stories.create,unexpected,${Date.now()},545826,,;CometHomeRoot.react,comet.home,tap_tabbar,${Date.now()},661597,4748854339,,`
|
|
108
|
+
},
|
|
109
|
+
source: "WWW",
|
|
110
|
+
attachments: [{
|
|
111
|
+
photo: {
|
|
112
|
+
id: photoID,
|
|
113
|
+
overlays: []
|
|
114
|
+
}
|
|
115
|
+
}],
|
|
116
|
+
tracking: [null],
|
|
117
|
+
actor_id: ctx.userID,
|
|
118
|
+
client_mutation_id: String(Math.floor(Math.random() * 16) + 1)
|
|
119
|
+
}
|
|
120
|
+
}),
|
|
121
|
+
server_timestamps: true,
|
|
122
|
+
doc_id: "24226878183562473"
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
defaultFuncs
|
|
126
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
127
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
128
|
+
.then(function (resData) {
|
|
129
|
+
if (resData.error || !resData.data || !resData.data.story_create) {
|
|
130
|
+
throw resData || { error: "Story creation failed" };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Extract story ID from response
|
|
134
|
+
let extractedStoryId = null;
|
|
135
|
+
const storyData = resData.data.story_create;
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
if (storyData.viewer && storyData.viewer.actor && storyData.viewer.actor.story_bucket) {
|
|
139
|
+
const storyNodes = storyData.viewer.actor.story_bucket.nodes;
|
|
140
|
+
if (storyNodes && storyNodes.length > 0 && storyNodes[0].first_story_to_show) {
|
|
141
|
+
extractedStoryId = storyNodes[0].first_story_to_show.id;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
} catch (e) {
|
|
145
|
+
log.warn("createStory", "Could not extract story ID from response:", e);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
resolve({
|
|
149
|
+
story_id: extractedStoryId,
|
|
150
|
+
logging_token: storyData.logging_token,
|
|
151
|
+
full_response: resData
|
|
152
|
+
});
|
|
153
|
+
})
|
|
154
|
+
.catch(reject);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Helper function to delete story
|
|
159
|
+
function deleteStory(storyID) {
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
const form = {
|
|
162
|
+
av: ctx.userID,
|
|
163
|
+
__aaid: 0,
|
|
164
|
+
__user: ctx.userID,
|
|
165
|
+
__a: 1,
|
|
166
|
+
__req: utils.getSignatureID(),
|
|
167
|
+
__hs: ctx.fb_dtsg_ag,
|
|
168
|
+
dpr: 1,
|
|
169
|
+
__ccg: "EXCELLENT",
|
|
170
|
+
__rev: ctx.req_ID,
|
|
171
|
+
__s: utils.getSignatureID(),
|
|
172
|
+
__hsi: ctx.hsi,
|
|
173
|
+
__comet_req: 15,
|
|
174
|
+
fb_dtsg: ctx.fb_dtsg,
|
|
175
|
+
jazoest: ctx.ttstamp,
|
|
176
|
+
lsd: ctx.fb_dtsg,
|
|
177
|
+
__spin_r: ctx.req_ID,
|
|
178
|
+
__spin_b: "trunk",
|
|
179
|
+
__spin_t: Date.now(),
|
|
180
|
+
fb_api_caller_class: "RelayModern",
|
|
181
|
+
fb_api_req_friendly_name: "StoriesDeleteCardOptionMenuItem_StoriesDeleteMutation",
|
|
182
|
+
variables: JSON.stringify({
|
|
183
|
+
input: {
|
|
184
|
+
story_ids: [storyID],
|
|
185
|
+
actor_id: ctx.userID,
|
|
186
|
+
client_mutation_id: String(Math.floor(Math.random() * 16) + 1)
|
|
187
|
+
},
|
|
188
|
+
enable_profile_story_consumption: false
|
|
189
|
+
}),
|
|
190
|
+
server_timestamps: true,
|
|
191
|
+
doc_id: "30236153679305121"
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
defaultFuncs
|
|
195
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
196
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
197
|
+
.then(function (resData) {
|
|
198
|
+
if (resData.error) {
|
|
199
|
+
throw resData;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (!resData.data || !resData.data.stories_delete) {
|
|
203
|
+
throw { error: "Delete response missing expected data" };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
resolve({
|
|
207
|
+
deleted_story_ids: resData.data.stories_delete.deleted_story_thread_ids || [storyID],
|
|
208
|
+
success: true
|
|
209
|
+
});
|
|
210
|
+
})
|
|
211
|
+
.catch(reject);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Helper function to check user stories
|
|
216
|
+
function checkUserStories() {
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
const form = {
|
|
219
|
+
av: ctx.userID,
|
|
220
|
+
__aaid: 0,
|
|
221
|
+
__user: ctx.userID,
|
|
222
|
+
__a: 1,
|
|
223
|
+
__req: utils.getSignatureID(),
|
|
224
|
+
__hs: ctx.fb_dtsg_ag,
|
|
225
|
+
dpr: 1,
|
|
226
|
+
__ccg: "EXCELLENT",
|
|
227
|
+
__rev: ctx.req_ID,
|
|
228
|
+
__s: utils.getSignatureID(),
|
|
229
|
+
__hsi: ctx.hsi,
|
|
230
|
+
__comet_req: 15,
|
|
231
|
+
fb_dtsg: ctx.fb_dtsg,
|
|
232
|
+
jazoest: ctx.ttstamp,
|
|
233
|
+
lsd: ctx.fb_dtsg,
|
|
234
|
+
__spin_r: ctx.req_ID,
|
|
235
|
+
__spin_b: "trunk",
|
|
236
|
+
__spin_t: Date.now(),
|
|
237
|
+
fb_api_caller_class: "RelayModern",
|
|
238
|
+
fb_api_req_friendly_name: "CometStoriesSuspenseViewerPaginationQuery",
|
|
239
|
+
variables: JSON.stringify({
|
|
240
|
+
count: 50,
|
|
241
|
+
scale: 1,
|
|
242
|
+
id: ctx.userID
|
|
243
|
+
}),
|
|
244
|
+
server_timestamps: true,
|
|
245
|
+
doc_id: "7723194127725452"
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
defaultFuncs
|
|
249
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
250
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
251
|
+
.then(function (resData) {
|
|
252
|
+
if (resData.error) {
|
|
253
|
+
throw resData;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
let stories = [];
|
|
257
|
+
try {
|
|
258
|
+
if (resData.data && resData.data.node && resData.data.node.story_bucket) {
|
|
259
|
+
const storyBucket = resData.data.node.story_bucket;
|
|
260
|
+
if (storyBucket.unified_stories && storyBucket.unified_stories.edges) {
|
|
261
|
+
stories = storyBucket.unified_stories.edges.map(edge => ({
|
|
262
|
+
id: edge.node.id,
|
|
263
|
+
creation_time: edge.node.creation_time,
|
|
264
|
+
attachments: edge.node.attachments || [],
|
|
265
|
+
bucket_id: storyBucket.id
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
} catch (e) {
|
|
270
|
+
log.warn("checkUserStories", "Error parsing stories:", e);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
resolve(stories);
|
|
274
|
+
})
|
|
275
|
+
.catch(reject);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Execute based on action
|
|
280
|
+
switch (action) {
|
|
281
|
+
case 'upload':
|
|
282
|
+
if (!attachment) {
|
|
283
|
+
return callback({ error: "Attachment is required for upload action" });
|
|
284
|
+
}
|
|
285
|
+
uploadStoryAttachment(attachment)
|
|
286
|
+
.then(photoID => {
|
|
287
|
+
callback(null, { success: true, photoID: photoID });
|
|
288
|
+
})
|
|
289
|
+
.catch(callback);
|
|
290
|
+
break;
|
|
291
|
+
|
|
292
|
+
case 'add':
|
|
293
|
+
if (!attachment) {
|
|
294
|
+
return callback({ error: "Attachment is required for add action" });
|
|
295
|
+
}
|
|
296
|
+
uploadStoryAttachment(attachment)
|
|
297
|
+
.then(photoID => {
|
|
298
|
+
return createStory(photoID).then(result => ({ photoID, result }));
|
|
299
|
+
})
|
|
300
|
+
.then(({ photoID, result }) => {
|
|
301
|
+
callback(null, {
|
|
302
|
+
success: true,
|
|
303
|
+
story_id: result.story_id,
|
|
304
|
+
logging_token: result.logging_token,
|
|
305
|
+
photoID: photoID,
|
|
306
|
+
full_response: result.full_response
|
|
307
|
+
});
|
|
308
|
+
})
|
|
309
|
+
.catch(err => {
|
|
310
|
+
log.error("storyManager add", err);
|
|
311
|
+
callback(err);
|
|
312
|
+
});
|
|
313
|
+
break;
|
|
314
|
+
|
|
315
|
+
case 'delete':
|
|
316
|
+
if (!storyID) {
|
|
317
|
+
return callback({ error: "Story ID is required for delete action" });
|
|
318
|
+
}
|
|
319
|
+
deleteStory(storyID)
|
|
320
|
+
.then(result => {
|
|
321
|
+
callback(null, {
|
|
322
|
+
success: true,
|
|
323
|
+
deleted_story_ids: result.deleted_story_ids
|
|
324
|
+
});
|
|
325
|
+
})
|
|
326
|
+
.catch(err => {
|
|
327
|
+
log.error("storyManager delete", err);
|
|
328
|
+
callback(err);
|
|
329
|
+
});
|
|
330
|
+
break;
|
|
331
|
+
|
|
332
|
+
case 'check':
|
|
333
|
+
checkUserStories()
|
|
334
|
+
.then(stories => {
|
|
335
|
+
callback(null, {
|
|
336
|
+
success: true,
|
|
337
|
+
stories: stories,
|
|
338
|
+
count: stories ? stories.length : 0
|
|
339
|
+
});
|
|
340
|
+
})
|
|
341
|
+
.catch(err => {
|
|
342
|
+
log.error("storyManager check", err);
|
|
343
|
+
callback(err);
|
|
344
|
+
});
|
|
345
|
+
break;
|
|
346
|
+
|
|
347
|
+
default:
|
|
348
|
+
callback({ error: "Invalid action" });
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return returnPromise;
|
|
352
|
+
};
|
|
353
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ===========================================================
|
|
3
|
+
* 💫 META THEME GENERATOR MODULE 💫
|
|
4
|
+
* ===========================================================
|
|
5
|
+
* 🔰 Owner & Developer
|
|
6
|
+
* 🧠 Description:
|
|
7
|
+
* This module generates beautiful Messenger AI themes
|
|
8
|
+
* using Meta's hidden GraphQL endpoints. It allows you to
|
|
9
|
+
* create unique chat themes based on your custom prompt
|
|
10
|
+
* or optional image inspiration.
|
|
11
|
+
* -----------------------------------------------------------
|
|
12
|
+
* ⚙️ Features:
|
|
13
|
+
* • Generate AI-based Messenger chat themes.
|
|
14
|
+
* • Custom prompt & optional image URL input.
|
|
15
|
+
* • Returns structured theme data with full color mapping.
|
|
16
|
+
* -----------------------------------------------------------
|
|
17
|
+
* 🕊️ Respect the creator & give proper credits if reused.
|
|
18
|
+
* ===========================================================
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
"use strict";
|
|
22
|
+
|
|
23
|
+
var utils = require("../utils");
|
|
24
|
+
var log = require("npmlog");
|
|
25
|
+
|
|
26
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
27
|
+
return function suggestFriend(count, cursor, callback) {
|
|
28
|
+
var resolveFunc = function () { };
|
|
29
|
+
var rejectFunc = function () { };
|
|
30
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
|
31
|
+
resolveFunc = resolve;
|
|
32
|
+
rejectFunc = reject;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (!callback) {
|
|
36
|
+
callback = function (err, data) {
|
|
37
|
+
if (err) return rejectFunc(err);
|
|
38
|
+
resolveFunc(data);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (typeof count === 'function') {
|
|
43
|
+
callback = count;
|
|
44
|
+
count = 30;
|
|
45
|
+
cursor = null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (typeof cursor === 'function') {
|
|
49
|
+
callback = cursor;
|
|
50
|
+
cursor = null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
count = count || 30;
|
|
54
|
+
|
|
55
|
+
var form = {
|
|
56
|
+
av: ctx.userID,
|
|
57
|
+
__aaid: 0,
|
|
58
|
+
__user: ctx.userID,
|
|
59
|
+
__a: 1,
|
|
60
|
+
__req: utils.getSignatureID(),
|
|
61
|
+
__hs: "20405.HYP:comet_pkg.2.1...0",
|
|
62
|
+
dpr: 1,
|
|
63
|
+
__ccg: "EXCELLENT",
|
|
64
|
+
__rev: "1029835515",
|
|
65
|
+
__s: utils.getSignatureID(),
|
|
66
|
+
__hsi: Date.now(),
|
|
67
|
+
__comet_req: 15,
|
|
68
|
+
fb_dtsg: ctx.fb_dtsg,
|
|
69
|
+
jazoest: ctx.ttstamp,
|
|
70
|
+
lsd: ctx.fb_dtsg,
|
|
71
|
+
__spin_r: "1029835515",
|
|
72
|
+
__spin_b: "trunk",
|
|
73
|
+
__spin_t: Date.now(),
|
|
74
|
+
__crn: "comet.fbweb.CometPYMKSuggestionsRoute",
|
|
75
|
+
fb_api_caller_class: "RelayModern",
|
|
76
|
+
fb_api_req_friendly_name: "FriendingCometPYMKPanelPaginationQuery",
|
|
77
|
+
server_timestamps: true,
|
|
78
|
+
variables: JSON.stringify({
|
|
79
|
+
count: count,
|
|
80
|
+
cursor: cursor,
|
|
81
|
+
location: "FRIENDS_HOME_MAIN",
|
|
82
|
+
scale: 3
|
|
83
|
+
}),
|
|
84
|
+
doc_id: "9917809191634193"
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
defaultFuncs
|
|
88
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
89
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
90
|
+
.then(function (resData) {
|
|
91
|
+
if (resData.error) {
|
|
92
|
+
throw resData;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (resData.data && resData.data.viewer && resData.data.viewer.people_you_may_know) {
|
|
96
|
+
var pymkData = resData.data.viewer.people_you_may_know;
|
|
97
|
+
var suggestions = pymkData.edges.map(function (edge) {
|
|
98
|
+
var node = edge.node;
|
|
99
|
+
return {
|
|
100
|
+
id: node.id,
|
|
101
|
+
name: node.name,
|
|
102
|
+
url: node.url,
|
|
103
|
+
friendshipStatus: node.friendship_status,
|
|
104
|
+
profilePicture: node.profile_picture ? node.profile_picture.uri : null,
|
|
105
|
+
mutualFriends: node.social_context ? node.social_context.text : "",
|
|
106
|
+
topMutualFriends: node.social_context_top_mutual_friends || []
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
var result = {
|
|
111
|
+
suggestions: suggestions,
|
|
112
|
+
hasNextPage: pymkData.page_info.has_next_page,
|
|
113
|
+
endCursor: pymkData.page_info.end_cursor
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return callback(null, result);
|
|
117
|
+
} else {
|
|
118
|
+
return callback({ error: "Invalid response format" });
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
.catch(function (err) {
|
|
122
|
+
log.error("suggestFriend", err);
|
|
123
|
+
return callback(err);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
return returnPromise;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = function (_defaultFuncs, _api, _ctx) {
|
|
4
|
+
// Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more
|
|
5
|
+
return {
|
|
6
|
+
//Old hex colors.
|
|
7
|
+
////MessengerBlue: null,
|
|
8
|
+
////Viking: "#44bec7",
|
|
9
|
+
////GoldenPoppy: "#ffc300",
|
|
10
|
+
////RadicalRed: "#fa3c4c",
|
|
11
|
+
////Shocking: "#d696bb",
|
|
12
|
+
////PictonBlue: "#6699cc",
|
|
13
|
+
////FreeSpeechGreen: "#13cf13",
|
|
14
|
+
////Pumpkin: "#ff7e29",
|
|
15
|
+
////LightCoral: "#e68585",
|
|
16
|
+
////MediumSlateBlue: "#7646ff",
|
|
17
|
+
////DeepSkyBlue: "#20cef5",
|
|
18
|
+
////Fern: "#67b868",
|
|
19
|
+
////Cameo: "#d4a88c",
|
|
20
|
+
////BrilliantRose: "#ff5ca1",
|
|
21
|
+
////BilobaFlower: "#a695c7"
|
|
22
|
+
|
|
23
|
+
//#region This part is for backward compatibly
|
|
24
|
+
//trying to match the color one-by-one. kill me plz
|
|
25
|
+
MessengerBlue: "196241301102133", //DefaultBlue
|
|
26
|
+
Viking: "1928399724138152", //TealBlue
|
|
27
|
+
GoldenPoppy: "174636906462322", //Yellow
|
|
28
|
+
RadicalRed: "2129984390566328", //Red
|
|
29
|
+
Shocking: "2058653964378557", //LavenderPurple
|
|
30
|
+
FreeSpeechGreen: "2136751179887052", //Green
|
|
31
|
+
Pumpkin: "175615189761153", //Orange
|
|
32
|
+
LightCoral: "980963458735625", //CoralPink
|
|
33
|
+
MediumSlateBlue: "234137870477637", //BrightPurple
|
|
34
|
+
DeepSkyBlue: "2442142322678320", //AquaBlue
|
|
35
|
+
BrilliantRose: "169463077092846", //HotPink
|
|
36
|
+
//i've tried my best, everything else can't be mapped. (or is it?) -UIRI 2020
|
|
37
|
+
//#endregion
|
|
38
|
+
|
|
39
|
+
DefaultBlue: "196241301102133",
|
|
40
|
+
HotPink: "169463077092846",
|
|
41
|
+
AquaBlue: "2442142322678320",
|
|
42
|
+
BrightPurple: "234137870477637",
|
|
43
|
+
CoralPink: "980963458735625",
|
|
44
|
+
Orange: "175615189761153",
|
|
45
|
+
Green: "2136751179887052",
|
|
46
|
+
LavenderPurple: "2058653964378557",
|
|
47
|
+
Red: "2129984390566328",
|
|
48
|
+
Yellow: "174636906462322",
|
|
49
|
+
TealBlue: "1928399724138152",
|
|
50
|
+
Aqua: "417639218648241",
|
|
51
|
+
Mango: "930060997172551",
|
|
52
|
+
Berry: "164535220883264",
|
|
53
|
+
Citrus: "370940413392601",
|
|
54
|
+
Candy: "205488546921017",
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* July 06, 2022
|
|
58
|
+
* added by @NTKhang
|
|
59
|
+
*/
|
|
60
|
+
Earth: "1833559466821043",
|
|
61
|
+
Support: "365557122117011",
|
|
62
|
+
Music: "339021464972092",
|
|
63
|
+
Pride: "1652456634878319",
|
|
64
|
+
DoctorStrange: "538280997628317",
|
|
65
|
+
LoFi: "1060619084701625",
|
|
66
|
+
Sky: "3190514984517598",
|
|
67
|
+
LunarNewYear: "357833546030778",
|
|
68
|
+
Celebration: "627144732056021",
|
|
69
|
+
Chill: "390127158985345",
|
|
70
|
+
StrangerThings: "1059859811490132",
|
|
71
|
+
Dune: "1455149831518874",
|
|
72
|
+
Care: "275041734441112",
|
|
73
|
+
Astrology: "3082966625307060",
|
|
74
|
+
JBalvin: "184305226956268",
|
|
75
|
+
Birthday: "621630955405500",
|
|
76
|
+
Cottagecore: "539927563794799",
|
|
77
|
+
Ocean: "736591620215564",
|
|
78
|
+
Love: "741311439775765",
|
|
79
|
+
TieDye: "230032715012014",
|
|
80
|
+
Monochrome: "788274591712841",
|
|
81
|
+
Default: "3259963564026002",
|
|
82
|
+
Rocket: "582065306070020",
|
|
83
|
+
Berry2: "724096885023603",
|
|
84
|
+
Candy2: "624266884847972",
|
|
85
|
+
Unicorn: "273728810607574",
|
|
86
|
+
Tropical: "262191918210707",
|
|
87
|
+
Maple: "2533652183614000",
|
|
88
|
+
Sushi: "909695489504566",
|
|
89
|
+
Citrus2: "557344741607350",
|
|
90
|
+
Lollipop: "280333826736184",
|
|
91
|
+
Shadow: "271607034185782",
|
|
92
|
+
Rose: "1257453361255152",
|
|
93
|
+
Lavender: "571193503540759",
|
|
94
|
+
Tulip: "2873642949430623",
|
|
95
|
+
Classic: "3273938616164733",
|
|
96
|
+
Peach: "3022526817824329",
|
|
97
|
+
Honey: "672058580051520",
|
|
98
|
+
Kiwi: "3151463484918004",
|
|
99
|
+
Grape: "193497045377796",
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* July 15, 2022
|
|
103
|
+
* added by @NTKhang
|
|
104
|
+
*/
|
|
105
|
+
NonBinary: "737761000603635",
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* November 25, 2022
|
|
109
|
+
* added by @NTKhang
|
|
110
|
+
*/
|
|
111
|
+
ThankfulForFriends: "1318983195536293",
|
|
112
|
+
Transgender: "504518465021637",
|
|
113
|
+
TaylorSwift: "769129927636836",
|
|
114
|
+
NationalComingOutDay: "788102625833584",
|
|
115
|
+
Autumn: "822549609168155",
|
|
116
|
+
Cyberpunk2077: "780962576430091",
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* May 13, 2023
|
|
120
|
+
*/
|
|
121
|
+
MothersDay: "1288506208402340",
|
|
122
|
+
APAHM: "121771470870245",
|
|
123
|
+
Parenthood: "810978360551741",
|
|
124
|
+
StarWars: "1438011086532622",
|
|
125
|
+
GuardianOfTheGalaxy: "101275642962533",
|
|
126
|
+
Bloom: "158263147151440",
|
|
127
|
+
BubbleTea: "195296273246380",
|
|
128
|
+
Basketball: "6026716157422736",
|
|
129
|
+
ElephantsAndFlowers: "693996545771691",
|
|
130
|
+
};
|
|
131
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function unfollowUser(userID, 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: "CometUserUnfollowMutation",
|
|
8
|
+
fb_api_caller_class: "RelayModern",
|
|
9
|
+
doc_id: "2990388441010824",
|
|
10
|
+
variables: JSON.stringify({
|
|
11
|
+
input: {
|
|
12
|
+
actor_id: ctx.userID,
|
|
13
|
+
client_mutation_id: String(ctx.clientMutationId++),
|
|
14
|
+
unsubscribe_from_actor_id: String(userID)
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
19
|
+
.then(resData => { if (resData.error) throw resData; cb(null, resData); })
|
|
20
|
+
.catch(err => cb(err));
|
|
21
|
+
return promise;
|
|
22
|
+
};
|
|
23
|
+
};
|
package/src/unfriend.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function unfriend(userID, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
defaultFuncs.post("https://www.facebook.com/ajax/profile/removefriendconfirm.php", ctx.jar, {
|
|
7
|
+
uid: userID,
|
|
8
|
+
confirmed: 1
|
|
9
|
+
})
|
|
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,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var utils = require("../utils");
|
|
3
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
|
4
|
+
return function unsendMessage(messageID, callback) {
|
|
5
|
+
var { promise, callback: cb } = utils.wrapCallback(callback);
|
|
6
|
+
defaultFuncs.post("https://www.facebook.com/messaging/unsend_message/", ctx.jar, {
|
|
7
|
+
message_id: messageID
|
|
8
|
+
})
|
|
9
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
10
|
+
.then(resData => { if (resData.error) throw resData; cb(null, true); })
|
|
11
|
+
.catch(err => cb(err));
|
|
12
|
+
return promise;
|
|
13
|
+
};
|
|
14
|
+
};
|