fca-smart-shankar 13.0.0 → 16.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/.cache/replit/env/latest +56 -0
- package/.cache/replit/env/latest.json +1 -0
- package/.cache/replit/modules/nodejs-14.res +1 -0
- package/.cache/replit/modules/replit.res +1 -0
- package/.cache/replit/modules/web.res +1 -0
- package/.cache/replit/modules.stamp +0 -0
- package/.cache/typescript/5.5/package.json +1 -0
- package/.config/configstore/update-notifier-npm.json +4 -0
- package/.gitattributes +2 -0
- package/.replit +3 -12
- package/.upm/store.json +1 -1
- package/Extra/Balancer.js +49 -0
- package/Extra/Bypass/956/index.js +234 -0
- package/Extra/Bypass/test/aaaa.json +170 -0
- package/Extra/Bypass/test/index.js +188 -0
- package/Extra/Database/index.js +469 -0
- package/Extra/ExtraAddons.js +82 -0
- package/Extra/ExtraFindUID.js +62 -0
- package/Extra/ExtraGetThread.js +365 -0
- package/Extra/ExtraScreenShot.js +430 -0
- package/Extra/ExtraUptimeRobot.js +38 -0
- package/Extra/Html/Classic/script.js +119 -0
- package/Extra/Html/Classic/style.css +8 -0
- package/Extra/Security/AES_256_GCM/index.js +0 -0
- package/Extra/Security/Base/Step_1.js +6 -0
- package/Extra/Security/Base/Step_2.js +22 -0
- package/Extra/Security/Base/Step_3.js +22 -0
- package/Extra/Security/Base/index.js +191 -0
- package/Extra/Security/Index.js +5 -0
- package/Extra/Security/Step_1.js +6 -0
- package/Extra/Security/Step_2.js +22 -0
- package/Extra/Security/Step_3.js +22 -0
- package/Extra/Src/Change_Environment.js +24 -0
- package/Extra/Src/Check_Update.js +67 -0
- package/Extra/Src/History.js +115 -0
- package/Extra/Src/Instant_Update.js +65 -0
- package/Extra/Src/Last-Run.js +65 -0
- package/Extra/Src/Premium.js +81 -0
- package/Extra/Src/Release_Memory.js +160 -0
- package/Extra/Src/Websocket.js +213 -0
- package/Extra/Src/image/checkmate.jpg +0 -0
- package/Extra/Src/test.js +28 -0
- package/Extra/Src/uuid.js +137 -0
- package/Func/AcceptAgreement.js +31 -0
- package/Func/ClearCache.js +64 -0
- package/Func/ReportV1.js +54 -0
- package/LICENSE +678 -0
- package/Language/index.json +228 -0
- package/Main.js +1444 -0
- package/README.md +30 -175
- package/SECURITY.md +18 -0
- package/broadcast.js +44 -0
- package/index.js +414 -511
- package/logger.js +66 -0
- package/package.json +85 -370
- package/src/Dev_Horizon_Data.js +125 -0
- package/src/Dev_getThreadInfoOLD.js +422 -0
- package/src/Dev_shareTest2.js +68 -0
- package/src/Dev_shareTest3.js +71 -0
- package/src/Premium.js +25 -0
- package/src/Screenshot.js +83 -0
- package/src/addExternalModule.js +5 -14
- package/src/addUserToGroup.js +20 -56
- package/src/changeAdminStatus.js +20 -44
- package/src/changeArchivedStatus.js +11 -25
- package/src/{changeAvatarV2.js → changeAvt.js} +2 -3
- package/src/changeBio.js +15 -26
- package/src/changeBlockedStatus.js +8 -21
- package/src/changeGroupImage.js +24 -53
- package/src/changeNickname.js +13 -27
- package/src/changeThreadColor.js +19 -22
- package/src/changeThreadEmoji.js +11 -24
- package/src/createNewGroup.js +20 -38
- package/src/createPoll.js +16 -27
- package/src/deleteMessage.js +13 -24
- package/src/deleteThread.js +12 -25
- package/src/editMessage.js +53 -71
- package/src/forwardAttachment.js +15 -27
- package/src/getAccessToken.js +28 -0
- package/src/getCurrentUserID.js +1 -1
- package/src/getEmojiUrl.js +8 -10
- package/src/getFriendsList.js +15 -25
- package/src/getMessage.js +81 -813
- package/src/getThreadHistory.js +98 -241
- package/src/getThreadInfo.js +287 -90
- package/src/getThreadInfoOLD.js +422 -0
- package/src/getThreadList.js +157 -214
- package/src/getThreadMain.js +220 -0
- package/src/getThreadPictures.js +19 -39
- package/src/getUID.js +50 -113
- package/src/getUserID.js +14 -18
- package/src/getUserInfo.js +71 -65
- package/src/getUserInfoMain.js +65 -0
- package/src/getUserInfoV2.js +32 -0
- package/src/getUserInfoV3.js +63 -0
- package/src/getUserInfoV4.js +55 -0
- package/src/getUserInfoV5.js +61 -0
- package/src/handleFriendRequest.js +13 -24
- package/src/handleMessageRequest.js +20 -36
- package/src/httpGet.js +18 -34
- package/src/httpPost.js +18 -35
- package/src/httpPostFormData.js +24 -53
- package/src/listenMqtt.js +944 -680
- package/src/listenMqttV1.js +846 -0
- package/src/logout.js +15 -22
- package/src/markAsDelivered.js +15 -25
- package/src/markAsRead.js +27 -45
- package/src/markAsReadAll.js +14 -21
- package/src/markAsSeen.js +18 -28
- package/src/muteThread.js +12 -17
- package/src/removeUserFromGroup.js +17 -47
- package/src/resolvePhotoUrl.js +13 -21
- package/src/searchForThread.js +13 -23
- package/src/sendMessage.js +117 -178
- package/src/sendMqttMessage.js +71 -0
- package/src/sendTypingIndicator.js +16 -46
- package/src/setMessageReaction.js +20 -33
- package/src/setPostReaction.js +95 -105
- package/src/setTitle.js +18 -34
- package/src/shareContact.js +37 -92
- package/src/shareLink.js +4 -5
- package/src/threadColors.js +18 -110
- package/src/unfriend.js +9 -18
- package/src/unsendMessage.js +34 -31
- package/src/unsendMqttMessage.js +66 -0
- package/test/Database_Test.js +4 -0
- package/test/Db2.js +530 -0
- package/test/Shankar_Database/A_README.md +1 -0
- package/test/Shankar_Database/Database.db +0 -0
- package/test/data/shareAttach.js +1 -1
- package/test/env/.env +0 -0
- package/test/example-db.db +0 -0
- package/test/memoryleak.js +18 -0
- package/test/test.js +1 -1
- package/test/testname.js +1342 -0
- package/test/testv2.js +3 -0
- package/utils.js +2918 -1393
- package/CHANGELOG.md +0 -2
- package/LICENSE-MIT +0 -21
- package/generated-icon.png +0 -0
- package/replit.nix +0 -5
- package/shankar-fca.json +0 -4
- package/src/changeAvatar.js +0 -136
- package/src/changeBlockedStatusMqtt.js +0 -80
- package/src/changeCover.js +0 -73
- package/src/changeName.js +0 -79
- package/src/changeUsername.js +0 -59
- package/src/createCommentPost.js +0 -230
- package/src/createPost.js +0 -277
- package/src/data/getThreadInfo.json +0 -1
- package/src/editMessageOld.js +0 -67
- package/src/follow.js +0 -74
- package/src/getAccess.js +0 -112
- package/src/getAvatarUser.js +0 -78
- package/src/getRegion.js +0 -7
- package/src/getThreadHistoryDeprecated.js +0 -93
- package/src/getThreadInfoDeprecated.js +0 -80
- package/src/getThreadListDeprecated.js +0 -75
- package/src/listenNotification.js +0 -85
- package/src/pinMessage.js +0 -59
- package/src/refreshFb_dtsg.js +0 -89
- package/src/searchStickers.js +0 -53
- package/src/sendMessageMqtt.js +0 -322
- package/src/sendTypingIndicatorV2.js +0 -28
- package/src/setMessageReactionMqtt.js +0 -62
- package/src/setProfileGuard.js +0 -45
- package/src/setStoryReaction.js +0 -64
- package/src/stopListenMqtt.js +0 -26
- package/src/uploadAttachment.js +0 -94
package/CHANGELOG.md
DELETED
package/LICENSE-MIT
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2015 Avery, Benjamin, David, Maude
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
package/generated-icon.png
DELETED
Binary file
|
package/replit.nix
DELETED
package/shankar-fca.json
DELETED
package/src/changeAvatar.js
DELETED
@@ -1,136 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
function handleUpload(image, callback) {
|
8
|
-
const uploads = [];
|
9
|
-
|
10
|
-
const form = {
|
11
|
-
profile_id: ctx.i_userID || ctx.userID,
|
12
|
-
photo_source: 57,
|
13
|
-
av: ctx.i_userID || ctx.userID,
|
14
|
-
file: image,
|
15
|
-
};
|
16
|
-
|
17
|
-
uploads.push(
|
18
|
-
defaultFuncs
|
19
|
-
.postFormData(
|
20
|
-
"https://www.facebook.com/profile/picture/upload/",
|
21
|
-
ctx.jar,
|
22
|
-
form,
|
23
|
-
{},
|
24
|
-
)
|
25
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
26
|
-
.then(function (resData) {
|
27
|
-
if (resData.error) {
|
28
|
-
throw resData;
|
29
|
-
}
|
30
|
-
return resData;
|
31
|
-
}),
|
32
|
-
);
|
33
|
-
|
34
|
-
// resolve all promises
|
35
|
-
Promise.all(uploads)
|
36
|
-
.then(function (resData) {
|
37
|
-
callback(null, resData);
|
38
|
-
})
|
39
|
-
.catch(function (err) {
|
40
|
-
log.error("handleUpload", err);
|
41
|
-
return callback(err);
|
42
|
-
});
|
43
|
-
}
|
44
|
-
|
45
|
-
return function changeAvatar(
|
46
|
-
image,
|
47
|
-
caption = "",
|
48
|
-
timestamp = null,
|
49
|
-
callback,
|
50
|
-
) {
|
51
|
-
let resolveFunc = function () {};
|
52
|
-
let rejectFunc = function () {};
|
53
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
54
|
-
resolveFunc = resolve;
|
55
|
-
rejectFunc = reject;
|
56
|
-
});
|
57
|
-
|
58
|
-
if (!timestamp && utils.getType(caption) === "Number") {
|
59
|
-
timestamp = caption;
|
60
|
-
caption = "";
|
61
|
-
}
|
62
|
-
|
63
|
-
if (
|
64
|
-
!timestamp &&
|
65
|
-
!callback &&
|
66
|
-
(utils.getType(caption) == "Function" ||
|
67
|
-
utils.getType(caption) == "AsyncFunction")
|
68
|
-
) {
|
69
|
-
callback = caption;
|
70
|
-
caption = "";
|
71
|
-
timestamp = null;
|
72
|
-
}
|
73
|
-
|
74
|
-
if (!callback)
|
75
|
-
callback = function (err, data) {
|
76
|
-
if (err) {
|
77
|
-
return rejectFunc(err);
|
78
|
-
}
|
79
|
-
resolveFunc(data);
|
80
|
-
};
|
81
|
-
|
82
|
-
if (!utils.isReadableStream(image))
|
83
|
-
return callback("Image is not a readable stream");
|
84
|
-
|
85
|
-
handleUpload(image, function (err, payload) {
|
86
|
-
if (err) {
|
87
|
-
return callback(err);
|
88
|
-
}
|
89
|
-
|
90
|
-
const form = {
|
91
|
-
av: ctx.i_userID || ctx.userID,
|
92
|
-
fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
|
93
|
-
fb_api_caller_class: "RelayModern",
|
94
|
-
doc_id: "5066134240065849",
|
95
|
-
variables: JSON.stringify({
|
96
|
-
input: {
|
97
|
-
caption,
|
98
|
-
existing_photo_id: payload[0].payload.fbid,
|
99
|
-
expiration_time: timestamp,
|
100
|
-
profile_id: ctx.i_userID || ctx.userID,
|
101
|
-
profile_pic_method: "EXISTING",
|
102
|
-
profile_pic_source: "TIMELINE",
|
103
|
-
scaled_crop_rect: {
|
104
|
-
height: 1,
|
105
|
-
width: 1,
|
106
|
-
x: 0,
|
107
|
-
y: 0,
|
108
|
-
},
|
109
|
-
skip_cropping: true,
|
110
|
-
actor_id: ctx.i_userID || ctx.userID,
|
111
|
-
client_mutation_id: Math.round(Math.random() * 19).toString(),
|
112
|
-
},
|
113
|
-
isPage: false,
|
114
|
-
isProfile: true,
|
115
|
-
scale: 3,
|
116
|
-
}),
|
117
|
-
};
|
118
|
-
|
119
|
-
defaultFuncs
|
120
|
-
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
121
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
122
|
-
.then(function (resData) {
|
123
|
-
if (resData.errors) {
|
124
|
-
throw resData;
|
125
|
-
}
|
126
|
-
return callback(null, resData[0].data.profile_picture_set);
|
127
|
-
})
|
128
|
-
.catch(function (err) {
|
129
|
-
log.error("changeAvatar", err);
|
130
|
-
return callback(err);
|
131
|
-
});
|
132
|
-
});
|
133
|
-
|
134
|
-
return returnPromise;
|
135
|
-
};
|
136
|
-
};
|
@@ -1,80 +0,0 @@
|
|
1
|
-
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
const { generateOfflineThreadingID, getCurrentTimestamp, getGUID } = require('../utils.js');
|
5
|
-
|
6
|
-
function isCallable(func) {
|
7
|
-
try {
|
8
|
-
Reflect.apply(func, null, []);
|
9
|
-
return true;
|
10
|
-
} catch (error) {
|
11
|
-
return false;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
16
|
-
return function changeBlockedStatusMqtt(userID, status, type, callback) {
|
17
|
-
if (!ctx.mqttClient) {
|
18
|
-
throw new Error('Not connected to MQTT');
|
19
|
-
}
|
20
|
-
|
21
|
-
ctx.wsReqNumber += 1;
|
22
|
-
ctx.wsTaskNumber += 1;
|
23
|
-
|
24
|
-
const label = '334';
|
25
|
-
let userBlockAction = 0;
|
26
|
-
|
27
|
-
switch (type) {
|
28
|
-
case 'messenger':
|
29
|
-
if (status) {
|
30
|
-
userBlockAction = 1; // Block
|
31
|
-
} else {
|
32
|
-
userBlockAction = 0; // Unblock
|
33
|
-
}
|
34
|
-
break;
|
35
|
-
case 'facebook':
|
36
|
-
if (status) {
|
37
|
-
userBlockAction = 3; // Block
|
38
|
-
} else {
|
39
|
-
userBlockAction = 2; // Unblock
|
40
|
-
}
|
41
|
-
break;
|
42
|
-
default:
|
43
|
-
throw new Error('Invalid type');
|
44
|
-
}
|
45
|
-
|
46
|
-
const taskPayload = {
|
47
|
-
blockee_id: userID,
|
48
|
-
request_id: getGUID(),
|
49
|
-
user_block_action: userBlockAction,
|
50
|
-
};
|
51
|
-
|
52
|
-
const payload = JSON.stringify(taskPayload);
|
53
|
-
const version = '25393437286970779';
|
54
|
-
|
55
|
-
const task = {
|
56
|
-
failure_count: null,
|
57
|
-
label: label,
|
58
|
-
payload: payload,
|
59
|
-
queue_name: 'native_sync_block',
|
60
|
-
task_id: ctx.wsTaskNumber,
|
61
|
-
};
|
62
|
-
|
63
|
-
const content = {
|
64
|
-
app_id: '2220391788200892',
|
65
|
-
payload: JSON.stringify({
|
66
|
-
tasks: [task],
|
67
|
-
epoch_id: parseInt(generateOfflineThreadingID()),
|
68
|
-
version_id: version,
|
69
|
-
}),
|
70
|
-
request_id: ctx.wsReqNumber,
|
71
|
-
type: 3,
|
72
|
-
};
|
73
|
-
|
74
|
-
if (isCallable(callback)) {
|
75
|
-
ctx.reqCallbacks[ctx.wsReqNumber] = callback;
|
76
|
-
}
|
77
|
-
|
78
|
-
ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
|
79
|
-
};
|
80
|
-
};
|
package/src/changeCover.js
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var utils = require('../utils.js');
|
4
|
-
var log = require('npmlog');
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function changeCover(image, callback) {
|
8
|
-
var cb;
|
9
|
-
var rt = new Promise(function (resolve, reject) {
|
10
|
-
cb = (error, url) => error ? reject(error) : resolve(url);
|
11
|
-
});
|
12
|
-
|
13
|
-
if (typeof image == 'function') {
|
14
|
-
callback = image;
|
15
|
-
image = null;
|
16
|
-
}
|
17
|
-
if (typeof callback == 'function') cb = callback;
|
18
|
-
if (!utils.isReadableStream(image)) {
|
19
|
-
var error = 'image should be a readable stream, not ' + utils.getType(image);
|
20
|
-
log.error('changeCover', error);
|
21
|
-
cb(error);
|
22
|
-
}
|
23
|
-
else {
|
24
|
-
defaultFuncs
|
25
|
-
.postFormData('https://www.facebook.com/profile/picture/upload/', ctx.jar, {
|
26
|
-
profile_id: ctx.userID,
|
27
|
-
photo_source: 57,
|
28
|
-
av: ctx.userID,
|
29
|
-
file: image
|
30
|
-
})
|
31
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
32
|
-
.then(function (res) {
|
33
|
-
if (res.error || res.errors || !res.payload)
|
34
|
-
throw res;
|
35
|
-
|
36
|
-
var vari = {
|
37
|
-
input: {
|
38
|
-
attribution_id_v2: `ProfileCometCollectionRoot.react,comet.profile.collection.photos_by,unexpected,${Date.now()},770083,,;ProfileCometCollectionRoot.react,comet.profile.collection.photos_albums,unexpected,${Date.now()},470774,,;ProfileCometCollectionRoot.react,comet.profile.collection.photos,unexpected,${Date.now()},94740,,;ProfileCometCollectionRoot.react,comet.profile.collection.saved_reels_on_profile,unexpected,${Date.now()},89669,,;ProfileCometCollectionRoot.react,comet.profile.collection.reels_tab,unexpected,${Date.now()},152201,,`,
|
39
|
-
cover_photo_id: res.payload.fbid,
|
40
|
-
focus: {
|
41
|
-
x: 0.5,
|
42
|
-
y: 1
|
43
|
-
},
|
44
|
-
target_user_id: ctx.userID,
|
45
|
-
actor_id: ctx.userID,
|
46
|
-
client_mutation_id: Math.round(Math.random() * 19).toString()
|
47
|
-
},
|
48
|
-
scale: 1,
|
49
|
-
contextualProfileContext: null
|
50
|
-
}
|
51
|
-
return defaultFuncs
|
52
|
-
.post('https://www.facebook.com/api/graphql', ctx.jar, {
|
53
|
-
doc_id: 8247793861913071,
|
54
|
-
server_timestamps: true,
|
55
|
-
fb_api_req_friendly_name: 'ProfileCometCoverPhotoUpdateMutation',
|
56
|
-
variables: JSON.stringify(vari)
|
57
|
-
})
|
58
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs));
|
59
|
-
})
|
60
|
-
.then(function (res) {
|
61
|
-
if (res.errors)
|
62
|
-
throw res;
|
63
|
-
return cb(null, res.data.user_update_cover_photo.user.cover_photo.photo.url);
|
64
|
-
})
|
65
|
-
.catch(function (err) {
|
66
|
-
log.error('changeCover', err);
|
67
|
-
return cb(err);
|
68
|
-
});
|
69
|
-
}
|
70
|
-
|
71
|
-
return rt;
|
72
|
-
}
|
73
|
-
}
|
package/src/changeName.js
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var utils = require('./../utils.js');
|
4
|
-
var log = require('npmlog');
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function changeName(input, format, callback) {
|
8
|
-
var cb;
|
9
|
-
var rt = new Promise(function (resolve, reject) {
|
10
|
-
cb = error => error ? reject(error) : resolve();
|
11
|
-
});
|
12
|
-
|
13
|
-
if (typeof input == 'function') {
|
14
|
-
callback = input;
|
15
|
-
input = null;
|
16
|
-
}
|
17
|
-
if (typeof format == 'function') {
|
18
|
-
callback = format;
|
19
|
-
format = 'complete';
|
20
|
-
}
|
21
|
-
if (typeof callback == 'function') cb = callback;
|
22
|
-
if (utils.getType(input) != 'Object') {
|
23
|
-
var error = 'name must be an object, not ' + utils.getType(input);
|
24
|
-
log('changeName', error);
|
25
|
-
return cb(error);
|
26
|
-
}
|
27
|
-
|
28
|
-
var { first_name, middle_name, last_name } = input;
|
29
|
-
if (!first_name || !last_name) {
|
30
|
-
log.error('changeName', 'name is not be accepted');
|
31
|
-
return cb('name is not be accepted');
|
32
|
-
}
|
33
|
-
|
34
|
-
middle_name = middle_name || '';
|
35
|
-
|
36
|
-
var full_name =
|
37
|
-
format == 'complete' ? last_name + ' ' + (middle_name != '' ? middle_name + ' ' : '') + first_name :
|
38
|
-
format == 'standard' ? last_name + ' ' + first_name :
|
39
|
-
format == 'reversed' ? first_name + ' ' + (middle_name != '' ? middle_name + ' ' : '') + last_name :
|
40
|
-
last_name + ' ' + (middle_name != '' ? middle_name + ' ' : '') + first_name;
|
41
|
-
|
42
|
-
var form = {
|
43
|
-
fb_api_caller_class: 'RelayModern',
|
44
|
-
fb_api_req_friendly_name: 'useFXIMUpdateNameMutation',
|
45
|
-
variables: JSON.stringify({
|
46
|
-
client_mutation_id: utils.getGUID(),
|
47
|
-
family_device_id: "device_id_fetch_datr",
|
48
|
-
identity_ids: [ctx.userID],
|
49
|
-
full_name,
|
50
|
-
first_name,
|
51
|
-
middle_name,
|
52
|
-
last_name,
|
53
|
-
interface: 'FB_WEB'
|
54
|
-
}),
|
55
|
-
server_timestamps: true,
|
56
|
-
doc_id: '5763510853763960'
|
57
|
-
}
|
58
|
-
|
59
|
-
defaultFuncs
|
60
|
-
.post('https://accountscenter.facebook.com/api/graphql/', ctx.jar, form, null, null, {
|
61
|
-
Origin: 'https://accountscenter.facebook.com',
|
62
|
-
Referer: `https://accountscenter.facebook.com/profiles/${ctx.userID}/name`
|
63
|
-
})
|
64
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
65
|
-
.then(function (res) {
|
66
|
-
if (res.errors)
|
67
|
-
throw res;
|
68
|
-
else if (res.data.fxim_update_identity_name.error)
|
69
|
-
throw res.data.fxim_update_identity_name.error;
|
70
|
-
return cb();
|
71
|
-
})
|
72
|
-
.catch(function (err) {
|
73
|
-
log.error('changeName', err);
|
74
|
-
return cb(err);
|
75
|
-
});
|
76
|
-
|
77
|
-
return rt;
|
78
|
-
}
|
79
|
-
}
|
package/src/changeUsername.js
DELETED
@@ -1,59 +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 changeUsername(username, callback) {
|
8
|
-
var cb;
|
9
|
-
var rt = new Promise(function (resolve, reject) {
|
10
|
-
cb = (error, info) => info ? resolve(info) : reject(error);
|
11
|
-
});
|
12
|
-
|
13
|
-
if (typeof username == 'function') {
|
14
|
-
var error = 'username must be a string, and not ' + utils.getType(username);
|
15
|
-
log.error('changeUsername', error);
|
16
|
-
return username(error);
|
17
|
-
}
|
18
|
-
if (typeof callback == 'function') cb = callback;
|
19
|
-
if (typeof username != 'string') {
|
20
|
-
var error = 'username must be a string, and not ' + utils.getType(username);
|
21
|
-
log.error('changeUsername', error);
|
22
|
-
return cb(error);
|
23
|
-
}
|
24
|
-
|
25
|
-
var form = {
|
26
|
-
fb_api_caller_class: 'RelayModern',
|
27
|
-
fb_api_req_friendly_name: 'useFXIMUpdateUsernameMutation',
|
28
|
-
variables: JSON.stringify({
|
29
|
-
client_mutation_id: utils.getGUID(),
|
30
|
-
family_device_id: "device_id_fetch_datr",
|
31
|
-
identity_ids: [ctx.userID],
|
32
|
-
username,
|
33
|
-
interface: "FB_WEB"
|
34
|
-
}),
|
35
|
-
server_timestamps: true,
|
36
|
-
doc_id: 5737739449613305
|
37
|
-
}
|
38
|
-
|
39
|
-
defaultFuncs
|
40
|
-
.post('https://accountscenter.facebook.com/api/graphql/', ctx.jar, form, null, null, {
|
41
|
-
Origin: 'https://accountscenter.facebook.com',
|
42
|
-
Referer: `https://accountscenter.facebook.com/profiles/${ctx.userID}/username/?entrypoint=fb_account_center`
|
43
|
-
})
|
44
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
45
|
-
.then(function (res) {
|
46
|
-
if (res.errors)
|
47
|
-
throw res;
|
48
|
-
else if (res.data.fxim_update_identity_username.error)
|
49
|
-
throw res.data.fxim_update_identity_username.error;
|
50
|
-
return cb();
|
51
|
-
})
|
52
|
-
.catch(function (err) {
|
53
|
-
log.error('changeUsername', err);
|
54
|
-
return cb(err);
|
55
|
-
});
|
56
|
-
|
57
|
-
return rt;
|
58
|
-
}
|
59
|
-
}
|
package/src/createCommentPost.js
DELETED
@@ -1,230 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var utils = require('../utils.js');
|
4
|
-
var log = require('npmlog');
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
function handleUpload(msg, form) {
|
8
|
-
var cb;
|
9
|
-
var uploads = [];
|
10
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
cb = error => error ? reject(error) : resolve();
|
12
|
-
});
|
13
|
-
|
14
|
-
for (let item of msg.attachments) {
|
15
|
-
if (!utils.isReadableStream(item))
|
16
|
-
return cb({ error: 'image should be a readable stream and not ' + utils.getType(image) });
|
17
|
-
|
18
|
-
var httpData = defaultFuncs
|
19
|
-
.postFormData('https://www.facebook.com/ajax/ufi/upload/', ctx.jar, {
|
20
|
-
profile_id: ctx.userID,
|
21
|
-
source: 19,
|
22
|
-
target_id: ctx.userID,
|
23
|
-
file: item
|
24
|
-
})
|
25
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
26
|
-
.then(function (res) {
|
27
|
-
if (res.errors || res.error || !res.payload)
|
28
|
-
throw res;
|
29
|
-
|
30
|
-
return {
|
31
|
-
media: {
|
32
|
-
id: res.payload.fbid
|
33
|
-
}
|
34
|
-
}
|
35
|
-
})
|
36
|
-
.catch(cb);
|
37
|
-
|
38
|
-
uploads.push(httpData);
|
39
|
-
}
|
40
|
-
|
41
|
-
Promise
|
42
|
-
.all(uploads)
|
43
|
-
.then(function (main) {
|
44
|
-
main.forEach(item => form.input.attachments.push(item));
|
45
|
-
|
46
|
-
return cb();
|
47
|
-
})
|
48
|
-
.catch(cb);
|
49
|
-
|
50
|
-
return returnPromise;
|
51
|
-
}
|
52
|
-
|
53
|
-
function handleURL(msg, form) {
|
54
|
-
if (typeof msg.url == 'string') {
|
55
|
-
form.input.attachments = [
|
56
|
-
{
|
57
|
-
link: {
|
58
|
-
external: {
|
59
|
-
url: msg.url
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
];
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
function handleMentions(msg, form) {
|
68
|
-
for (let item of msg.mentions) {
|
69
|
-
var { tag, id, fromIndex } = item;
|
70
|
-
|
71
|
-
if (typeof tag != 'string')
|
72
|
-
throw 'Mention tag must be string';
|
73
|
-
if (!id)
|
74
|
-
throw 'id must be string';
|
75
|
-
var offset = msg.body.indexOf(tag, fromIndex || 0);
|
76
|
-
if (offset < 0)
|
77
|
-
throw 'Mention for "' + tag + '" not found in message string.';
|
78
|
-
form.input.message.ranges.push({
|
79
|
-
entity: { id },
|
80
|
-
length: tag.length,
|
81
|
-
offset
|
82
|
-
});
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|
86
|
-
function handleSticker(msg, form) {
|
87
|
-
if (msg.sticker) {
|
88
|
-
form.input.attachments = [
|
89
|
-
{
|
90
|
-
media: {
|
91
|
-
id: msg.sticker
|
92
|
-
}
|
93
|
-
}
|
94
|
-
];
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
function createContent(form) {
|
99
|
-
var cb;
|
100
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
101
|
-
cb = (error, info) => info ? resolve(info) : reject(error);
|
102
|
-
});
|
103
|
-
|
104
|
-
defaultFuncs
|
105
|
-
.post('https://www.facebook.com/api/graphql/', ctx.jar, {
|
106
|
-
fb_api_caller_class: 'RelayModern',
|
107
|
-
fb_api_req_friendly_name: 'useCometUFICreateCommentMutation',
|
108
|
-
variables: JSON.stringify(form),
|
109
|
-
server_timestamps: !0,
|
110
|
-
doc_id: 6993516810709754
|
111
|
-
})
|
112
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
113
|
-
.then(function (res) {
|
114
|
-
if (res.errors)
|
115
|
-
throw res;
|
116
|
-
|
117
|
-
var res = res.data.comment_create;
|
118
|
-
var info = {
|
119
|
-
id: res.feedback_comment_edge.node.id,
|
120
|
-
url: res.feedback_comment_edge.node.feedback.url,
|
121
|
-
count: res.feedback.total_comment_count
|
122
|
-
}
|
123
|
-
return cb(null, info);
|
124
|
-
})
|
125
|
-
.catch(cb);
|
126
|
-
|
127
|
-
return returnPromise;
|
128
|
-
}
|
129
|
-
|
130
|
-
return function createCommentPost(msg, postID, callback, replyCommentID) {
|
131
|
-
var cb;
|
132
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
133
|
-
cb = (error, info) => info ? resolve(info) : reject(error);
|
134
|
-
});
|
135
|
-
|
136
|
-
if (typeof msg == 'function') {
|
137
|
-
var error = 'Message must be a string or object!!';
|
138
|
-
log.error('createCommentPost', error);
|
139
|
-
return msg(error);
|
140
|
-
}
|
141
|
-
if (typeof postID == 'function') {
|
142
|
-
var error = 'postID must be a string!!';
|
143
|
-
log.error('createCommentPost', error);
|
144
|
-
return postID(error);
|
145
|
-
}
|
146
|
-
if (typeof callback == 'string') {
|
147
|
-
replyCommentID = callback;
|
148
|
-
callback = null;
|
149
|
-
}
|
150
|
-
if (typeof callback == 'function')
|
151
|
-
cb = calback;
|
152
|
-
|
153
|
-
var MessageType = utils.getType(msg);
|
154
|
-
|
155
|
-
if (MessageType == 'String')
|
156
|
-
msg = {
|
157
|
-
body: msg,
|
158
|
-
attachments: [],
|
159
|
-
mentions: [],
|
160
|
-
sticker: null,
|
161
|
-
url: null
|
162
|
-
}
|
163
|
-
else if (MessageType == 'Object') {
|
164
|
-
msg.mentions ? !Array.isArray(msg.mentions) ? msg.mentions = [msg.mentions] : null : msg.mentions = [];
|
165
|
-
msg.attachments ? !Array.isArray(msg.attachments) ? msg.attachments = [msg.attachments] : null : msg.attachments = [];
|
166
|
-
isNaN(msg.sticker) ? msg.sticker = null : null;
|
167
|
-
msg.body ? typeof msg.body == 'object' ? msg.body = JSON.stringify(msg.body) : null : msg.body = '';
|
168
|
-
} else {
|
169
|
-
var error = 'Message must be a string or object!!';
|
170
|
-
log.error('createCommentPost', error);
|
171
|
-
return cb(error);
|
172
|
-
}
|
173
|
-
if (typeof postID != 'string') {
|
174
|
-
var error = 'postID must be a string!!';
|
175
|
-
log.error('createCommentPost', error);
|
176
|
-
return cb(error);
|
177
|
-
}
|
178
|
-
|
179
|
-
if (typeof replyCommentID != 'string')
|
180
|
-
replyCommentID = null;
|
181
|
-
|
182
|
-
var form = {
|
183
|
-
feedLocation: 'NEWSFEED',
|
184
|
-
feedbackSource: 1,
|
185
|
-
groupID: null,
|
186
|
-
input: {
|
187
|
-
client_mutation_id: Math.round(Math.random() * 19).toString(),
|
188
|
-
actor_id: ctx.userID,
|
189
|
-
attachments: [],
|
190
|
-
feedback_id: Buffer.from('feedback:' + postID).toString('base64'),
|
191
|
-
formatting_style: null,
|
192
|
-
message: {
|
193
|
-
ranges: [],
|
194
|
-
text: msg.body
|
195
|
-
},
|
196
|
-
reply_comment_parent_fbid: replyCommentID ? isNaN(replyCommentID) ? replyCommentID : Buffer.from('comment:' + postID + '_' + replyCommentID).toString('base64') : null,
|
197
|
-
reply_target_clicked: !!replyCommentID,
|
198
|
-
attribution_id_v2:
|
199
|
-
'CometHomeRoot.react,comet.home,via_cold_start,'
|
200
|
-
+ Date.now()
|
201
|
-
+ ',156248,4748854339,,',
|
202
|
-
vod_video_timestamp: null,
|
203
|
-
feedback_referrer: '/',
|
204
|
-
is_tracking_encrypted: !0,
|
205
|
-
tracking: [],
|
206
|
-
feedback_source: 'NEWS_FEED',
|
207
|
-
idempotence_token: 'client:' + utils.getGUID(),
|
208
|
-
session_id: utils.getGUID()
|
209
|
-
},
|
210
|
-
inviteShortLinkKey: null,
|
211
|
-
renderLocation: null,
|
212
|
-
scale: 1,
|
213
|
-
useDefaultActor: !1,
|
214
|
-
focusCommentID: null
|
215
|
-
}
|
216
|
-
|
217
|
-
handleUpload(msg, form)
|
218
|
-
.then(_ => handleURL(msg, form))
|
219
|
-
.then(_ => handleMentions(msg, form))
|
220
|
-
.then(_ => handleSticker(msg, form))
|
221
|
-
.then(_ => createContent(form))
|
222
|
-
.then(info => cb(null, info))
|
223
|
-
.catch(function (err) {
|
224
|
-
log.error('createCommentPost', err);
|
225
|
-
return cb(null, err);
|
226
|
-
})
|
227
|
-
|
228
|
-
return returnPromise;
|
229
|
-
}
|
230
|
-
}
|