hridoy-ultimate 8.0.2 → 9.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/CHANGELOG.md +68 -40
- package/LICENSE +23 -0
- package/MERGE_REPORT.md +54 -0
- package/README.md +158 -113
- package/THIRD_PARTY_NOTICES.md +36 -0
- package/docs/TEST_RESULTS.md +68 -0
- package/docs/UPSTREAM_API_DOCS.md +2712 -0
- package/func/checkUpdate.js +6 -0
- package/func/logAdapter.js +33 -0
- package/func/logger.js +48 -0
- package/index.d.ts +812 -0
- package/index.js +30 -824
- package/module/config.js +46 -0
- package/module/login.js +136 -0
- package/module/loginHelper.js +1413 -0
- package/module/options.js +55 -0
- package/package.json +75 -22
- package/scripts/run-tests.js +19 -0
- package/scripts/syntax-check.js +22 -0
- package/src/{addExternalModule.js → api/action/addExternalModule.js} +8 -8
- package/src/{changeAvatar.js → api/action/changeAvatar.js} +32 -33
- package/src/{changeBio.js → api/action/changeBio.js} +19 -22
- package/src/api/action/dismissScrapingWarning.js +50 -0
- package/src/api/action/enableAutoSaveAppState.js +73 -0
- package/src/{getCurrentUserID.js → api/action/getCurrentUserID.js} +1 -1
- package/src/api/action/handleFriendRequest.js +57 -0
- package/src/api/action/logout.js +95 -0
- package/src/api/action/refreshFb_dtsg.js +47 -0
- package/src/{setPostReaction.js → api/action/setPostReaction.js} +23 -31
- package/src/{unfriend.js → api/action/unfriend.js} +14 -14
- package/src/api/http/httpGet.js +46 -0
- package/src/api/http/httpPost.js +52 -0
- package/src/api/http/postFormData.js +47 -0
- package/src/api/messaging/addUserToGroup.js +68 -0
- package/src/api/messaging/changeAdminStatus.js +126 -0
- package/src/{changeArchivedStatus.js → api/messaging/changeArchivedStatus.js} +15 -17
- package/src/{changeBlockedStatus.js → api/messaging/changeBlockedStatus.js} +13 -16
- package/src/api/messaging/changeGroupImage.js +91 -0
- package/src/api/messaging/changeNickname.js +70 -0
- package/src/api/messaging/changeThreadColor.js +79 -0
- package/src/api/messaging/changeThreadEmoji.js +111 -0
- package/src/{createNewGroup.js → api/messaging/createNewGroup.js} +24 -26
- package/src/api/messaging/createPoll.js +46 -0
- package/src/api/messaging/createThemeAI.js +98 -0
- package/src/api/messaging/deleteMessage.js +136 -0
- package/src/{deleteThread.js → api/messaging/deleteThread.js} +14 -16
- package/src/api/messaging/editMessage.js +105 -0
- package/src/api/messaging/forwardAttachment.js +57 -0
- package/src/api/messaging/forwardMessage.js +134 -0
- package/src/{getEmojiUrl.js → api/messaging/getEmojiUrl.js} +2 -2
- package/src/{getFriendsList.js → api/messaging/getFriendsList.js} +16 -19
- package/src/{getMessage.js → api/messaging/getMessage.js} +160 -180
- package/src/api/messaging/getThemePictures.js +62 -0
- package/src/api/messaging/handleMessageRequest.js +65 -0
- package/src/api/messaging/markAsDelivered.js +69 -0
- package/src/api/messaging/markAsRead.js +110 -0
- package/src/api/messaging/markAsReadAll.js +56 -0
- package/src/api/messaging/markAsSeen.js +68 -0
- package/src/api/messaging/muteThread.js +50 -0
- package/src/api/messaging/pinMessage.js +115 -0
- package/src/api/messaging/removeUserFromGroup.js +62 -0
- package/src/{resolvePhotoUrl.js → api/messaging/resolvePhotoUrl.js} +11 -15
- package/src/api/messaging/scheduler.js +264 -0
- package/src/{searchForThread.js → api/messaging/searchForThread.js} +12 -12
- package/src/api/messaging/sendBroadcast.js +93 -0
- package/src/api/messaging/sendMessage.js +269 -0
- package/src/api/messaging/sendTypingIndicator.js +90 -0
- package/src/api/messaging/sessionGuard.js +130 -0
- package/src/api/messaging/setMessageReaction.js +114 -0
- package/src/api/messaging/setTitle.js +124 -0
- package/src/api/messaging/shareContact.js +98 -0
- package/src/{threadColors.js → api/messaging/threadColors.js} +2 -5
- package/src/api/messaging/unsendMessage.js +105 -0
- package/src/api/messaging/uploadAttachment.js +493 -0
- package/src/api/socket/OldMessage.js +199 -0
- package/src/api/socket/core/connectMqtt.js +304 -0
- package/src/api/socket/core/emitAuth.js +95 -0
- package/src/api/socket/core/getSeqID.js +331 -0
- package/src/api/socket/core/getTaskResponseData.js +25 -0
- package/src/api/socket/core/lifecycle.js +117 -0
- package/src/api/socket/core/parseDelta.js +387 -0
- package/src/api/socket/detail/buildStream.js +215 -0
- package/src/api/socket/detail/constants.js +28 -0
- package/src/api/socket/e2ee/crypto.js +173 -0
- package/src/api/socket/e2ee/index.js +977 -0
- package/src/api/socket/e2ee/localMediaServer.js +59 -0
- package/src/api/socket/e2ee/mediaDecode.js +155 -0
- package/src/api/socket/e2ee/native/NOTICE.md +29 -0
- package/{lib → src/api/socket/e2ee/native/lib}/index.mjs +109 -66
- package/src/api/socket/e2ee/native/nativeMediaBridge.js +273 -0
- package/src/api/socket/e2ee/proto/ArmadilloApplication.proto +281 -0
- package/src/api/socket/e2ee/proto/ArmadilloICDC.proto +14 -0
- package/src/api/socket/e2ee/proto/ConsumerApplication.proto +232 -0
- package/src/api/socket/e2ee/proto/MessageApplication.proto +82 -0
- package/src/api/socket/e2ee/proto/MessageTransport.proto +77 -0
- package/src/api/socket/e2ee/proto/WACommon.proto +66 -0
- package/src/api/socket/e2ee/proto/WAMediaTransport.proto +176 -0
- package/src/api/socket/e2ee/proto/proto-writer.ts +76 -0
- package/src/api/socket/e2ee/protocol.js +196 -0
- package/src/api/socket/e2ee/ratchet.js +219 -0
- package/src/api/socket/e2ee/store.js +182 -0
- package/src/api/socket/e2ee/vendor/fme/dist/index.cjs +6477 -0
- package/src/api/socket/e2ee/vendor/fme/proto/ArmadilloApplication.proto +281 -0
- package/src/api/socket/e2ee/vendor/fme/proto/ArmadilloICDC.proto +14 -0
- package/src/api/socket/e2ee/vendor/fme/proto/ConsumerApplication.proto +232 -0
- package/src/api/socket/e2ee/vendor/fme/proto/MessageApplication.proto +82 -0
- package/src/api/socket/e2ee/vendor/fme/proto/MessageTransport.proto +77 -0
- package/src/api/socket/e2ee/vendor/fme/proto/WACommon.proto +66 -0
- package/src/api/socket/e2ee/vendor/fme/proto/WAMediaTransport.proto +176 -0
- package/src/api/socket/listenE2EE.js +87 -0
- package/src/api/socket/listenMqtt.js +499 -0
- package/src/api/socket/middleware/index.js +216 -0
- package/src/api/socket/sendMessage.js +331 -0
- package/src/api/socket/sendMessageMqtt.js +69 -0
- package/src/{getThreadHistory.js → api/threads/getThreadHistory.js} +114 -132
- package/src/api/threads/getThreadInfo.js +329 -0
- package/src/api/threads/getThreadList.js +293 -0
- package/src/api/threads/getThreadPictures.js +78 -0
- package/src/{getUserID.js → api/users/getUserID.js} +22 -18
- package/src/api/users/getUserInfo.js +402 -0
- package/src/api/users/getUserInfoV2.js +134 -0
- package/src/app/MessengerBot.js +209 -0
- package/src/app/MessengerContext.js +32 -0
- package/src/app/createFcaClient.js +136 -0
- package/src/app/threadInfoRealtimeSync.js +284 -0
- package/src/core/sendReqMqtt.js +96 -0
- package/src/database/helpers.js +53 -0
- package/src/database/models/index.js +88 -0
- package/src/database/models/thread.js +50 -0
- package/src/database/models/user.js +46 -0
- package/src/database/threadData.js +94 -0
- package/src/database/userData.js +98 -0
- package/src/remote/remoteClient.js +123 -0
- package/src/utils/antiSuspension.js +219 -0
- package/src/utils/broadcast.js +51 -0
- package/src/utils/client.js +10 -0
- package/src/utils/constants.js +23 -0
- package/src/utils/cookies.js +85 -0
- package/src/utils/fingerprint.js +110 -0
- package/src/utils/format/attachment.js +357 -0
- package/src/utils/format/cookie.js +9 -0
- package/src/utils/format/date.js +50 -0
- package/src/utils/format/decode.js +44 -0
- package/src/utils/format/delta.js +195 -0
- package/src/utils/format/ids.js +64 -0
- package/src/utils/format/index.js +64 -0
- package/src/utils/format/message.js +88 -0
- package/src/utils/format/presence.js +132 -0
- package/src/utils/format/readTyp.js +44 -0
- package/src/utils/format/thread.js +42 -0
- package/src/utils/format/utils.js +141 -0
- package/src/utils/headers.js +125 -0
- package/src/utils/humanizer.js +256 -0
- package/src/utils/loginParser/autoLogin.js +125 -0
- package/src/utils/loginParser/extractDtsg.js +44 -0
- package/src/utils/loginParser/helpers.js +43 -0
- package/src/utils/loginParser/index.js +10 -0
- package/src/utils/loginParser/parseAndCheckLogin.js +241 -0
- package/src/utils/loginParser/textUtils.js +28 -0
- package/src/utils/nexca-logger.js +144 -0
- package/src/utils/nexca-utils.js +687 -0
- package/src/utils/request/client.js +26 -0
- package/src/utils/request/config.js +23 -0
- package/src/utils/request/defaults.js +46 -0
- package/src/utils/request/helpers.js +46 -0
- package/src/utils/request/index.js +17 -0
- package/src/utils/request/methods.js +163 -0
- package/src/utils/request/proxy.js +21 -0
- package/src/utils/request/retry.js +77 -0
- package/src/utils/request/sanitize.js +49 -0
- package/src/utils/typingIndicator.js +202 -0
- package/test/helpers/stub-modules.js +122 -0
- package/test/integration/logout.test.js +69 -0
- package/test/integration/mqtt-lifecycle.test.js +195 -0
- package/test/integration/package.test.js +116 -0
- package/test/integration/typing-wiring.test.js +71 -0
- package/test/unit/fingerprint.test.js +19 -0
- package/test/unit/humanizer.test.js +32 -0
- package/test/unit/lifecycle.test.js +92 -0
- package/test/unit/parsers.test.js +43 -0
- package/test/unit/typing.test.js +136 -0
- package/ANALYSIS.md +0 -31
- package/AUDIT_REPORT.md +0 -57
- package/advancedSystem.js +0 -95
- package/checkUpdate.js +0 -47
- package/config.json +0 -51
- package/e2ee.js +0 -738
- package/examples/basic-bot.js +0 -122
- package/examples/e2ee-bot.js +0 -141
- package/fca-config.example.json +0 -73
- package/scripts/check.js +0 -38
- package/src/OldMessage.js +0 -357
- package/src/addUserToGroup.js +0 -117
- package/src/changeAdminStatus.js +0 -105
- package/src/changeAvatarV2.js +0 -86
- package/src/changeAvt.js +0 -85
- package/src/changeBlockedStatusMqtt.js +0 -75
- package/src/changeCover.js +0 -73
- package/src/changeGroupImage.js +0 -137
- package/src/changeName.js +0 -79
- package/src/changeNickname.js +0 -61
- package/src/changeThreadColor.js +0 -67
- package/src/changeThreadEmoji.js +0 -57
- package/src/changeUsername.js +0 -59
- package/src/createCommentPost.js +0 -232
- package/src/createPoll.js +0 -73
- package/src/createPost.js +0 -276
- package/src/deleteMessage.js +0 -58
- package/src/editMessage.js +0 -76
- package/src/editMessageOld.js +0 -62
- package/src/follow.js +0 -74
- package/src/forwardAttachment.js +0 -62
- package/src/friendList.js +0 -104
- package/src/getAccess.js +0 -112
- package/src/getAvatarUser.js +0 -78
- package/src/getBotInitialData.js +0 -42
- package/src/getCtx.js +0 -5
- package/src/getOptions.js +0 -5
- package/src/getRegion.js +0 -7
- package/src/getThreadHistoryDeprecated.js +0 -71
- package/src/getThreadInfo.js +0 -232
- package/src/getThreadInfoDeprecated.js +0 -56
- package/src/getThreadList.js +0 -213
- package/src/getThreadListDeprecated.js +0 -46
- package/src/getThreadPictures.js +0 -59
- package/src/getThreadTheme.js +0 -81
- package/src/getUID.js +0 -119
- package/src/getUserInfo.js +0 -66
- package/src/handleFriendRequest.js +0 -46
- package/src/handleMessageRequest.js +0 -47
- package/src/httpGet.js +0 -49
- package/src/httpPost.js +0 -48
- package/src/httpPostFormData.js +0 -70
- package/src/listenMqtt.js +0 -1081
- package/src/listenNotification.js +0 -85
- package/src/logout.js +0 -18
- package/src/markAsDelivered.js +0 -47
- package/src/markAsRead.js +0 -72
- package/src/markAsReadAll.js +0 -40
- package/src/markAsSeen.js +0 -48
- package/src/metaTheme.js +0 -189
- package/src/muteThread.js +0 -45
- package/src/note.js +0 -228
- package/src/pinMessage.js +0 -54
- package/src/refreshFb_dtsg.js +0 -49
- package/src/removeSuspiciousAccount.js +0 -78
- package/src/removeUserFromGroup.js +0 -81
- package/src/reply.js +0 -442
- package/src/searchFriends.js +0 -140
- package/src/searchStickers.js +0 -53
- package/src/send.js +0 -46
- package/src/sendButtons.js +0 -163
- package/src/sendComment.js +0 -159
- package/src/sendFriendRequest.js +0 -112
- package/src/sendMessage.js +0 -441
- package/src/sendMessageMqtt.js +0 -323
- package/src/sendTypingIndicator.js +0 -68
- package/src/sendTypingIndicatorV2.js +0 -22
- package/src/setActiveStatus.js +0 -92
- package/src/setMessageReaction.js +0 -150
- package/src/setMessageReactionMqtt.js +0 -104
- package/src/setMessageReactionSafe.js +0 -44
- package/src/setProfileGuard.js +0 -44
- package/src/setProfileLock.js +0 -97
- package/src/setStoryReaction.js +0 -133
- package/src/setStorySeen.js +0 -108
- package/src/setThreadTheme.js +0 -102
- package/src/setTitle.js +0 -92
- package/src/shareContact.js +0 -110
- package/src/shareLink.js +0 -59
- package/src/stopListenMqtt.js +0 -60
- package/src/storyManager.js +0 -357
- package/src/suggestFriend.js +0 -132
- package/src/unsendMessage.js +0 -68
- package/src/uploadAttachment.js +0 -115
- package/test/fixes-1_2_4.test.js +0 -118
- package/test/mqtt-stop.test.js +0 -32
- package/test/reaction-mqtt.test.js +0 -57
- package/utils.js +0 -3056
- /package/{build → src/api/socket/e2ee/native/build}/messagix.dll +0 -0
- /package/{build → src/api/socket/e2ee/native/build}/messagix.so +0 -0
package/src/editMessage.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use_strict";
|
|
2
|
-
/**
|
|
3
|
-
* @author RFS-ADRENO
|
|
4
|
-
* @rewrittenBy Isai Ivanov
|
|
5
|
-
*/
|
|
6
|
-
const generateOfflineThreadingId = require('../utils');
|
|
7
|
-
|
|
8
|
-
function canBeCalled(func) {
|
|
9
|
-
return typeof func === "function";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A function for editing bot's messages.
|
|
14
|
-
* @param {string} text - The text with which the bot will edit its messages.
|
|
15
|
-
* @param {string} messageID - The message ID of the message the bot will edit.
|
|
16
|
-
* @param {Object} callback - Callback for the function.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
|
20
|
-
return function editMessage(text, messageID, callback) {
|
|
21
|
-
// ── editMessageE2EE: route E2EE messages through the bridge ──────────────
|
|
22
|
-
if (ctx.globalOptions && ctx.globalOptions.enableE2EE) {
|
|
23
|
-
var _e2eeMod = require('../e2ee');
|
|
24
|
-
var _jid = global._e2eeMessageMap && global._e2eeMessageMap.get(String(messageID));
|
|
25
|
-
if (_jid && _e2eeMod.isE2EEChatJid(_jid)) {
|
|
26
|
-
var _p = _e2eeMod.createBridge(ctx).editMessage(_jid, messageID, text)
|
|
27
|
-
.then(function (r) { if (typeof callback === "function") callback(null, r); return r; })
|
|
28
|
-
.catch(function (e) { if (typeof callback === "function") callback(e); throw e; });
|
|
29
|
-
return _p;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// ── end editMessageE2EE ───────────────────────────────────────────────────
|
|
33
|
-
|
|
34
|
-
if (!ctx.mqttClient) {
|
|
35
|
-
throw new Error('Not connected to MQTT');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
ctx.wsReqNumber += 1;
|
|
39
|
-
ctx.wsTaskNumber += 1;
|
|
40
|
-
|
|
41
|
-
const queryPayload = {
|
|
42
|
-
message_id: messageID,
|
|
43
|
-
text: text
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const query = {
|
|
47
|
-
failure_count: null,
|
|
48
|
-
label: '742',
|
|
49
|
-
payload: JSON.stringify(queryPayload),
|
|
50
|
-
queue_name: 'edit_message',
|
|
51
|
-
task_id: ctx.wsTaskNumber
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const context = {
|
|
55
|
-
app_id: '2220391788200892',
|
|
56
|
-
payload: {
|
|
57
|
-
data_trace_id: null,
|
|
58
|
-
epoch_id: parseInt(generateOfflineThreadingId),
|
|
59
|
-
tasks: [query],
|
|
60
|
-
version_id: '6903494529735864'
|
|
61
|
-
},
|
|
62
|
-
request_id: ctx.wsReqNumber,
|
|
63
|
-
type: 3
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
context.payload = JSON.stringify(context.payload);
|
|
67
|
-
|
|
68
|
-
// if (canBeCalled(callback)) {
|
|
69
|
-
// ctx.reqCallbacks[ctx.wsReqNumber] = callback;
|
|
70
|
-
// }
|
|
71
|
-
|
|
72
|
-
ctx.mqttClient.publish('/ls_req', JSON.stringify(context), {
|
|
73
|
-
qos: 1, retain: false
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
};
|
package/src/editMessageOld.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use_strict";
|
|
2
|
-
|
|
3
|
-
const { generateOfflineThreadingID } = require('../utils');
|
|
4
|
-
|
|
5
|
-
function isCallable(func) {
|
|
6
|
-
return typeof func === "function";
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
|
10
|
-
|
|
11
|
-
return function editMessage(text, messageID, callback) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (!ctx.mqttClient) {
|
|
15
|
-
throw new Error('Not connected to MQTT');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
ctx.wsReqNumber ??= 0;
|
|
19
|
-
ctx.wsTaskNumber ??= 0;
|
|
20
|
-
|
|
21
|
-
ctx.wsReqNumber += 1;
|
|
22
|
-
ctx.wsTaskNumber += 1;
|
|
23
|
-
|
|
24
|
-
const taskPayload = {
|
|
25
|
-
message_id: messageID,
|
|
26
|
-
text: text,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const task = {
|
|
30
|
-
failure_count: null,
|
|
31
|
-
label: '742',
|
|
32
|
-
payload: JSON.stringify(taskPayload),
|
|
33
|
-
queue_name: 'edit_message',
|
|
34
|
-
task_id: ctx.wsTaskNumber,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const content = {
|
|
38
|
-
app_id: '2220391788200892',
|
|
39
|
-
payload: {
|
|
40
|
-
data_trace_id: null,
|
|
41
|
-
epoch_id: parseInt(generateOfflineThreadingID()),
|
|
42
|
-
tasks: [],
|
|
43
|
-
version_id: '6903494529735864',
|
|
44
|
-
},
|
|
45
|
-
request_id: ctx.wsReqNumber,
|
|
46
|
-
type: 3,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
content.payload.tasks.push(task);
|
|
50
|
-
content.payload = JSON.stringify(content.payload);
|
|
51
|
-
|
|
52
|
-
if (isCallable(callback)) {
|
|
53
|
-
ctx.reqCallbacks[ctx.wsReqNumber] = callback;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
|
|
57
|
-
require(__dirname.replace("/fca-unofficial/src", "/handlers")).modifymsg({
|
|
58
|
-
body: text,
|
|
59
|
-
msgId: messageID
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
}
|
package/src/follow.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Author @YanMaglinte
|
|
5
|
-
* https://github.com/YANDEVA
|
|
6
|
-
*
|
|
7
|
-
* Example:
|
|
8
|
-
* api.follow("100090794779367", true); // Set true to follow, false if otherwise.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
//Fixed by Neth
|
|
12
|
-
|
|
13
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
|
14
|
-
return function follow(senderID, boolean, callback) {
|
|
15
|
-
/*if (!ctx.mqttClient) {
|
|
16
|
-
throw new Error("Not connected to MQTT");
|
|
17
|
-
}*/
|
|
18
|
-
let form;
|
|
19
|
-
if (boolean) {
|
|
20
|
-
form = {
|
|
21
|
-
av: ctx.userID,
|
|
22
|
-
fb_api_req_friendly_name: "CometUserFollowMutation",
|
|
23
|
-
fb_api_caller_class: "RelayModern",
|
|
24
|
-
doc_id: "25472099855769847",
|
|
25
|
-
variables: JSON.stringify({
|
|
26
|
-
input: {
|
|
27
|
-
attribution_id_v2:
|
|
28
|
-
"ProfileCometTimelineListViewRoot.react,comet.profile.timeline.list,via_cold_start,1717249218695,723451,250100865708545,,",
|
|
29
|
-
is_tracking_encrypted: true,
|
|
30
|
-
subscribe_location: "PROFILE",
|
|
31
|
-
subscribee_id: senderID,
|
|
32
|
-
tracking: null,
|
|
33
|
-
actor_id: ctx.userID,
|
|
34
|
-
client_mutation_id: "1",
|
|
35
|
-
},
|
|
36
|
-
scale: 1,
|
|
37
|
-
}),
|
|
38
|
-
};
|
|
39
|
-
} else {
|
|
40
|
-
form = {
|
|
41
|
-
av: ctx.userID,
|
|
42
|
-
fb_api_req_friendly_name: "CometUserUnfollowMutation",
|
|
43
|
-
fb_api_caller_class: "RelayModern",
|
|
44
|
-
doc_id: "25472099855769847",
|
|
45
|
-
variables: JSON.stringify({
|
|
46
|
-
action_render_location: "WWW_COMET_FRIEND_MENU",
|
|
47
|
-
input: {
|
|
48
|
-
attribution_id_v2:
|
|
49
|
-
"ProfileCometTimelineListViewRoot.react,comet.profile.timeline.list,tap_search_bar,1717294006136,602597,250100865708545,,",
|
|
50
|
-
is_tracking_encrypted: true,
|
|
51
|
-
subscribe_location: "PROFILE",
|
|
52
|
-
tracking: null,
|
|
53
|
-
unsubscribee_id: senderID,
|
|
54
|
-
actor_id: ctx.userID,
|
|
55
|
-
client_mutation_id: "10",
|
|
56
|
-
},
|
|
57
|
-
scale: 1,
|
|
58
|
-
}),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
api.httpPost("https://www.facebook.com/api/graphql/", form, (err, data) => {
|
|
63
|
-
if (err) {
|
|
64
|
-
if (typeof callback === "function") {
|
|
65
|
-
callback(err);
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
if (typeof callback === "function") {
|
|
69
|
-
callback(null, data);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
};
|
package/src/forwardAttachment.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var log = require("npmlog");
|
|
4
|
-
|
|
5
|
-
const utils = require("../utils");
|
|
6
|
-
// @NethWs3Dev
|
|
7
|
-
|
|
8
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
|
9
|
-
return function forwardAttachment(attachmentID, userOrUsers, callback) {
|
|
10
|
-
let resolveFunc = function () {};
|
|
11
|
-
let rejectFunc = function () {};
|
|
12
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
|
13
|
-
resolveFunc = resolve;
|
|
14
|
-
rejectFunc = reject;
|
|
15
|
-
});
|
|
16
|
-
if (!callback) {
|
|
17
|
-
callback = function (err) {
|
|
18
|
-
if (err) {
|
|
19
|
-
return rejectFunc(err);
|
|
20
|
-
}
|
|
21
|
-
resolveFunc();
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const form = {
|
|
26
|
-
attachment_id: attachmentID,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
if (utils.getType(userOrUsers) !== "Array") {
|
|
30
|
-
userOrUsers = [userOrUsers];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const timestamp = Math.floor(Date.now() / 1000);
|
|
34
|
-
|
|
35
|
-
for (let i = 0; i < userOrUsers.length; i++) {
|
|
36
|
-
//That's good, the key of the array is really timestmap in seconds + index
|
|
37
|
-
//Probably time when the attachment will be sent?
|
|
38
|
-
form["recipient_map[" + (timestamp + i) + "]"] = userOrUsers[i];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
defaultFuncs
|
|
42
|
-
.post(
|
|
43
|
-
"https://www.facebook.com/mercury/attachments/forward/",
|
|
44
|
-
ctx.jar,
|
|
45
|
-
form,
|
|
46
|
-
)
|
|
47
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
48
|
-
.then(function (resData) {
|
|
49
|
-
if (resData.error) {
|
|
50
|
-
throw resData;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return callback();
|
|
54
|
-
})
|
|
55
|
-
.catch(function (err) {
|
|
56
|
-
log.error("forwardAttachment", err);
|
|
57
|
-
return callback(err);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return returnPromise;
|
|
61
|
-
};
|
|
62
|
-
};
|
package/src/friendList.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ===========================================================
|
|
3
|
-
* 🧑💻 Author: HRIDOY (HRIDOY)
|
|
4
|
-
* 🔰 Owner & Developer
|
|
5
|
-
* 🌐 GitHub: https://github.com/hridoy-dev
|
|
6
|
-
* -----------------------------------------------------------
|
|
7
|
-
* 🕊️ Respect the creator & give proper credits if reused.
|
|
8
|
-
* ===========================================================
|
|
9
|
-
*/
|
|
10
|
-
"use strict";
|
|
11
|
-
|
|
12
|
-
var log = require("npmlog");
|
|
13
|
-
|
|
14
|
-
const utils = require("../utils");
|
|
15
|
-
|
|
16
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
|
17
|
-
/** Developed by HRIDOY | GitHub: hridoy-dev | Instagram: */
|
|
18
|
-
return function friendList(callback) {
|
|
19
|
-
let resolveFunc = function () {};
|
|
20
|
-
let rejectFunc = function () {};
|
|
21
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
|
22
|
-
resolveFunc = resolve;
|
|
23
|
-
rejectFunc = reject;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
if (!callback) {
|
|
27
|
-
callback = function (err, friendList) {
|
|
28
|
-
if (err) {
|
|
29
|
-
return rejectFunc(err);
|
|
30
|
-
}
|
|
31
|
-
resolveFunc(friendList);
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const form = {
|
|
36
|
-
av: ctx.userID,
|
|
37
|
-
__user: ctx.userID,
|
|
38
|
-
__a: 1,
|
|
39
|
-
__req: utils.getSignatureID(),
|
|
40
|
-
__hs: "20353.HYP:comet_pkg.2.1...0",
|
|
41
|
-
dpr: 1,
|
|
42
|
-
__ccg: "EXCELLENT",
|
|
43
|
-
__rev: "1027407131",
|
|
44
|
-
__s: utils.getSignatureID(),
|
|
45
|
-
__hsi: "7552796416884228248",
|
|
46
|
-
__comet_req: 15,
|
|
47
|
-
fb_dtsg: ctx.fb_dtsg,
|
|
48
|
-
jazoest: ctx.ttstamp,
|
|
49
|
-
lsd: ctx.fb_dtsg,
|
|
50
|
-
__spin_r: "1027407131",
|
|
51
|
-
__spin_b: "trunk",
|
|
52
|
-
__spin_t: Date.now(),
|
|
53
|
-
fb_api_caller_class: "RelayModern",
|
|
54
|
-
fb_api_req_friendly_name: "FriendingCometAllFriendsRootQuery",
|
|
55
|
-
variables: JSON.stringify({ scale: 2 }),
|
|
56
|
-
server_timestamps: true,
|
|
57
|
-
doc_id: "24426868700236815"
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
defaultFuncs
|
|
61
|
-
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
|
62
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
63
|
-
.then(function (resData) {
|
|
64
|
-
if (!resData || !resData.data) {
|
|
65
|
-
throw { error: "friendList returned empty object." };
|
|
66
|
-
}
|
|
67
|
-
if (resData.error) {
|
|
68
|
-
throw resData;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const friendsData = resData.data.viewer?.all_friends?.edges || [];
|
|
72
|
-
const formattedFriends = friendsData.map(edge => {
|
|
73
|
-
const friend = edge.node;
|
|
74
|
-
return {
|
|
75
|
-
userID: friend.id,
|
|
76
|
-
name: friend.name,
|
|
77
|
-
shortName: friend.short_name,
|
|
78
|
-
gender: friend.gender,
|
|
79
|
-
profilePicture: friend.profile_picture?.uri || null,
|
|
80
|
-
profileUrl: friend.url,
|
|
81
|
-
friendshipStatus: friend.friendship_status,
|
|
82
|
-
socialContext: friend.social_context?.text || "",
|
|
83
|
-
isSecureThread: friend.is_secure_thread,
|
|
84
|
-
subscribeStatus: friend.subscribe_status
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const result = {
|
|
89
|
-
totalCount: resData.data.viewer?.all_friends_data?.count || 0,
|
|
90
|
-
friendCount: resData.data.viewer?.all_friends_data?.friend_count || 0,
|
|
91
|
-
friends: formattedFriends
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
callback(null, result);
|
|
95
|
-
})
|
|
96
|
-
.catch(function (err) {
|
|
97
|
-
log.error("friendList", err);
|
|
98
|
-
return callback(err);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
return returnPromise;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
/** Developed by HRIDOY | GitHub: hridoy-dev | Please give credits if reused. */
|
package/src/getAccess.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var utils = require('../utils');
|
|
4
|
-
var log = require('npmlog');
|
|
5
|
-
|
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
|
7
|
-
return function getAccess(authCode = '', callback) {
|
|
8
|
-
var cb;
|
|
9
|
-
var url = 'https://business.facebook.com/';
|
|
10
|
-
var Referer = url + 'security/twofactor/reauth/?twofac_next=' + encodeURIComponent(url + 'content_management') + '&type=avoid_bypass&app_id=0&save_device=0';
|
|
11
|
-
var rt = new Promise(function (resolve, reject) {
|
|
12
|
-
cb = (error, token) => token ? resolve(token) : reject(error);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
if (typeof authCode == 'function') {
|
|
16
|
-
callback = authCode;
|
|
17
|
-
authCode = '';
|
|
18
|
-
}
|
|
19
|
-
if (typeof callback == 'function') cb = callback;
|
|
20
|
-
if (!!ctx.access_token)
|
|
21
|
-
cb(null, ctx.access_token);
|
|
22
|
-
else
|
|
23
|
-
utils
|
|
24
|
-
.get(url + 'content_management', ctx.jar, null, ctx.globalOptions, null, {
|
|
25
|
-
noRef: true,
|
|
26
|
-
Origin: url
|
|
27
|
-
})
|
|
28
|
-
.then(function (res) {
|
|
29
|
-
var html = res.body;
|
|
30
|
-
var lsd = utils.getFrom(html, "[\"LSD\",[],{\"token\":\"", "\"}");
|
|
31
|
-
return lsd;
|
|
32
|
-
})
|
|
33
|
-
.then(function (lsd) {
|
|
34
|
-
function submitCode(code) {
|
|
35
|
-
var pCb;
|
|
36
|
-
var rtPromise = new Promise(function (resolve) {
|
|
37
|
-
pCb = (error, token) => resolve(cb(error, token));
|
|
38
|
-
});
|
|
39
|
-
if (typeof code != 'string')
|
|
40
|
-
pCb({
|
|
41
|
-
error: 'submitCode',
|
|
42
|
-
lerror: 'code must be string',
|
|
43
|
-
continue: submitCode
|
|
44
|
-
});
|
|
45
|
-
else
|
|
46
|
-
defaultFuncs
|
|
47
|
-
.post(url + 'security/twofactor/reauth/enter/', ctx.jar, {
|
|
48
|
-
approvals_code: code,
|
|
49
|
-
save_device: true,
|
|
50
|
-
lsd
|
|
51
|
-
}, ctx.globalOptions, null, {
|
|
52
|
-
Referer,
|
|
53
|
-
Origin: url
|
|
54
|
-
})
|
|
55
|
-
.then(function (res) {
|
|
56
|
-
var { payload } = JSON.parse(res.body.split(';').pop() || '{}');
|
|
57
|
-
if (payload && !payload.codeConfirmed)
|
|
58
|
-
throw {
|
|
59
|
-
error: 'submitCode',
|
|
60
|
-
lerror: payload.message,
|
|
61
|
-
continue: submitCode
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return;
|
|
65
|
-
})
|
|
66
|
-
.then(function () {
|
|
67
|
-
return utils
|
|
68
|
-
.get(url + 'content_management', ctx.jar, null, ctx.globalOptions, null, { noRef: true })
|
|
69
|
-
.then(function (res) {
|
|
70
|
-
var html = res.body;
|
|
71
|
-
var token = /"accessToken":"(\S+)","clientID":/g.exec(html);
|
|
72
|
-
|
|
73
|
-
return [html, token];
|
|
74
|
-
});
|
|
75
|
-
})
|
|
76
|
-
.then(function (res) {
|
|
77
|
-
if (!res[1])
|
|
78
|
-
throw {
|
|
79
|
-
error: 'token-undefined',
|
|
80
|
-
htmlData: res[0]
|
|
81
|
-
}
|
|
82
|
-
ctx.access_token = res[1][1];
|
|
83
|
-
return pCb(null, res[1][1]);
|
|
84
|
-
})
|
|
85
|
-
.catch(function (err) {
|
|
86
|
-
log.error('getAccess', err.error || err);
|
|
87
|
-
return pCb(err);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
return rtPromise;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (authCode.length == 6 && !isNaN(authCode))
|
|
94
|
-
submitCode(authCode.toString());
|
|
95
|
-
else if (typeof callback == 'function')
|
|
96
|
-
throw {
|
|
97
|
-
error: 'submitCode',
|
|
98
|
-
continue: submitCode
|
|
99
|
-
}
|
|
100
|
-
else
|
|
101
|
-
throw {
|
|
102
|
-
error: 'authentication code must be string or number or callback must be a function to continue'
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
.catch(function (err) {
|
|
106
|
-
log.error('getAccess', typeof callback == 'function' ? (err.error || err) : err);
|
|
107
|
-
return cb(err);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
return rt;
|
|
111
|
-
}
|
|
112
|
-
}
|
package/src/getAvatarUser.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var utils = require('../utils');
|
|
4
|
-
var log = require('npmlog');
|
|
5
|
-
|
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
|
7
|
-
function handleAvatar(userIDs, height, width) {
|
|
8
|
-
var cb;
|
|
9
|
-
var uploads = [];
|
|
10
|
-
var rtPromise = new Promise(function (resolve, reject) {
|
|
11
|
-
cb = (error, data) => data ? resolve(data) : reject(error);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// Getting User Data From GraphAPI In The Loop
|
|
15
|
-
userIDs.map(function (v) {
|
|
16
|
-
var mainPromise = defaultFuncs
|
|
17
|
-
.get(`https://graph.facebook.com/${v}/picture?height=${height}&width=${width}&redirect=false&access_token=` + ctx.access_token, ctx.jar)
|
|
18
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
|
19
|
-
.then(function (res) {
|
|
20
|
-
return {
|
|
21
|
-
userID: v,
|
|
22
|
-
url: res.data.url
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
.catch(function (err) {
|
|
26
|
-
return cb(err);
|
|
27
|
-
});
|
|
28
|
-
uploads.push(mainPromise);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// resolve all promises
|
|
32
|
-
Promise
|
|
33
|
-
.all(uploads)
|
|
34
|
-
.then(function (res) {
|
|
35
|
-
return cb(null, res.reduce(function (Obj, { userID, url }) {
|
|
36
|
-
Obj[userID] = url;
|
|
37
|
-
return Obj;
|
|
38
|
-
}, {}));
|
|
39
|
-
})
|
|
40
|
-
.catch(function (err) {
|
|
41
|
-
return cb(err);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return rtPromise;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return function getAvatarUser(userIDs, size = [1500, 1500], callback) {
|
|
48
|
-
var cb;
|
|
49
|
-
var rtPromise = new Promise(function (resolve, reject) {
|
|
50
|
-
cb = (err, res) => res ? resolve(res) : reject(err);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
(typeof size == 'string' || typeof size == 'number') ? size = [size, size] : Array.isArray(size) && size.length == 1 ? size = [size[0], size[0]] : null;
|
|
54
|
-
|
|
55
|
-
if (typeof size == 'function') {
|
|
56
|
-
callback = size;
|
|
57
|
-
size = [1500, 1500];
|
|
58
|
-
}
|
|
59
|
-
if (typeof callback == 'function') cb = callback;
|
|
60
|
-
if (!Array.isArray(userIDs)) userIDs = [userIDs];
|
|
61
|
-
var [height, width] = size;
|
|
62
|
-
if (!ctx.access_token) {
|
|
63
|
-
log.error('getAvatarUser', 'Cant get access_token');
|
|
64
|
-
return cb('Cant get access_token');
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
handleAvatar(userIDs, height, width)
|
|
68
|
-
.then(function (res) {
|
|
69
|
-
return cb(null, res);
|
|
70
|
-
})
|
|
71
|
-
.catch(function (err) {
|
|
72
|
-
log.error('getAvatarUser', err);
|
|
73
|
-
return cb(err);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
return rtPromise;
|
|
77
|
-
}
|
|
78
|
-
}
|
package/src/getBotInitialData.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const utils = require("../utils");
|
|
4
|
-
|
|
5
|
-
module.exports = (defaultFuncs, api, ctx) => {
|
|
6
|
-
return async (callback) => {
|
|
7
|
-
let resolveFunc = () => {};
|
|
8
|
-
let rejectFunc = () => {};
|
|
9
|
-
const returnPromise = new Promise((resolve, reject) => {
|
|
10
|
-
resolveFunc = resolve;
|
|
11
|
-
rejectFunc = reject;
|
|
12
|
-
});
|
|
13
|
-
if (!callback) {
|
|
14
|
-
callback = (err, data) => {
|
|
15
|
-
if (err) {
|
|
16
|
-
return rejectFunc(err);
|
|
17
|
-
}
|
|
18
|
-
resolveFunc(data);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
utils.log("Fetching account info...");
|
|
22
|
-
api.httpGet(`https://www.facebook.com/profile.php?id=${ctx.userID}`, null, {
|
|
23
|
-
customUserAgent: utils.windowsUserAgent
|
|
24
|
-
}, (err, data) => {
|
|
25
|
-
if (err) throw err;
|
|
26
|
-
const profileMatch = data.match(/"CurrentUserInitialData",\[\],\{(.*?)\},(.*?)\]/);
|
|
27
|
-
if (profileMatch && profileMatch[1]){
|
|
28
|
-
const accountJson = JSON.parse(`{${profileMatch[1]}}`);
|
|
29
|
-
accountJson.name = accountJson.NAME;
|
|
30
|
-
accountJson.uid = accountJson.USER_ID;
|
|
31
|
-
delete accountJson.NAME;
|
|
32
|
-
delete accountJson.USER_ID;
|
|
33
|
-
return callback(null, {
|
|
34
|
-
...accountJson
|
|
35
|
-
});
|
|
36
|
-
} else return callback(null, { error: "Something went wrong. Maybe its possible that it has a limitation due to spam requests. You can try again later." });
|
|
37
|
-
}, true);
|
|
38
|
-
return returnPromise;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
|
package/src/getCtx.js
DELETED
package/src/getOptions.js
DELETED