fca-arif-auto 1.0.20 → 12.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/Extra/Balancer.js +49 -0
- package/Extra/Bypass/956/index.js +234 -0
- package/Extra/Bypass/test/aaaa.json +169 -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 +1 -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/Step_1.js +6 -0
- package/Extra/Security/Step_2.js +22 -0
- package/Extra/Security/Step_3.js +22 -0
- package/Extra/Security/index.js +5 -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/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-MIT → LICENSE.txt} +6 -6
- package/Language/index.json +228 -0
- package/Main.js +1290 -0
- package/README.md +4 -4
- package/SECURITY.md +17 -0
- package/broadcast.js +44 -0
- package/index.js +424 -465
- package/logger.js +66 -0
- package/package.json +91 -42
- 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 +21 -57
- package/src/changeAdminStatus.js +22 -46
- package/src/changeArchivedStatus.js +12 -26
- package/src/{changeAvatarV2.js → changeAvt.js} +2 -3
- package/src/changeBio.js +15 -26
- package/src/changeBlockedStatus.js +9 -22
- package/src/changeGroupImage.js +26 -55
- package/src/changeNickname.js +14 -28
- package/src/changeThreadColor.js +19 -22
- package/src/changeThreadEmoji.js +12 -25
- package/src/createNewGroup.js +18 -36
- package/src/createPoll.js +17 -28
- package/src/deleteMessage.js +14 -25
- package/src/deleteThread.js +13 -26
- package/src/editMessage.js +50 -56
- package/src/forwardAttachment.js +16 -28
- package/src/getAccessToken.js +28 -0
- package/src/getCurrentUserID.js +3 -3
- 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 +286 -89
- package/src/getThreadInfoOLD.js +422 -0
- package/src/getThreadList.js +158 -215
- package/src/getThreadMain.js +220 -0
- package/src/getThreadPictures.js +20 -40
- package/src/getUID.js +49 -112
- package/src/getUserID.js +14 -18
- package/src/getUserInfo.js +75 -34
- 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 +14 -25
- package/src/handleMessageRequest.js +21 -37
- package/src/httpGet.js +22 -37
- package/src/httpPost.js +20 -36
- package/src/httpPostFormData.js +23 -52
- package/src/listenMqtt.js +667 -414
- package/src/listenMqttV1.js +846 -0
- package/src/logout.js +17 -24
- package/src/markAsDelivered.js +16 -23
- package/src/markAsRead.js +28 -43
- package/src/markAsReadAll.js +14 -21
- package/src/markAsSeen.js +19 -29
- package/src/muteThread.js +13 -18
- package/src/removeUserFromGroup.js +18 -48
- package/src/resolvePhotoUrl.js +14 -22
- package/src/searchForThread.js +13 -23
- package/src/sendMessage.js +125 -181
- package/src/sendMqttMessage.js +71 -0
- package/src/sendTypingIndicator.js +80 -28
- package/src/setMessageReaction.js +20 -33
- package/src/setPostReaction.js +95 -105
- package/src/setTitle.js +19 -35
- package/src/shareContact.js +37 -92
- package/src/shareLink.js +5 -6
- package/src/threadColors.js +17 -109
- package/src/unfriend.js +11 -20
- package/src/unsendMessage.js +33 -30
- package/src/unsendMqttMessage.js +66 -0
- package/test/data/something.mov +1 -0
- package/test/data/test.png +1 -0
- package/utils.js +2908 -1247
- package/.upm/store.json +0 -1
- package/ARIF-FCA.json +0 -4
- package/replit.nix +0 -3
- package/src/changeAvatar.js +0 -136
- package/src/changeBlockedStatusMqtt.js +0 -80
- package/src/changeCover.js +0 -72
- package/src/changeName.js +0 -78
- package/src/changeUsername.js +0 -58
- package/src/createCommentPost.js +0 -229
- package/src/createPost.js +0 -275
- 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/getBotInitialData.js +0 -42
- 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 -316
- package/src/setMessageReactionMqtt.js +0 -62
- package/src/setProfileGuard.js +0 -44
- package/src/setStoryReaction.js +0 -64
- package/src/stopListenMqtt.js +0 -23
- package/src/uploadAttachment.js +0 -94
package/.upm/store.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":2,"languages":{"nodejs-npm":{"specfileHash":"9c1daf70fa913035bdc35b14bd0cd834","lockfileHash":"afe00810f9cef88d191fa428eb7d1d88"}}}
|
package/ARIF-FCA.json
DELETED
package/replit.nix
DELETED
package/src/changeAvatar.js
DELETED
@@ -1,136 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
// @NethWs3Dev
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
function handleUpload(image, callback) {
|
8
|
-
const uploads = [];
|
9
|
-
|
10
|
-
const form = {
|
11
|
-
profile_id: ctx.userID,
|
12
|
-
photo_source: 57,
|
13
|
-
av: 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
|
-
console.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.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.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.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
|
-
console.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,72 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var utils = require('../utils');
|
4
|
-
|
5
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
6
|
-
return function changeCover(image, callback) {
|
7
|
-
var cb;
|
8
|
-
var rt = new Promise(function (resolve, reject) {
|
9
|
-
cb = (error, url) => error ? reject(error) : resolve(url);
|
10
|
-
});
|
11
|
-
|
12
|
-
if (typeof image == 'function') {
|
13
|
-
callback = image;
|
14
|
-
image = null;
|
15
|
-
}
|
16
|
-
if (typeof callback == 'function') cb = callback;
|
17
|
-
if (!utils.isReadableStream(image)) {
|
18
|
-
var error = 'image should be a readable stream, not ' + utils.getType(image);
|
19
|
-
console.error('changeCover', error);
|
20
|
-
cb(error);
|
21
|
-
}
|
22
|
-
else {
|
23
|
-
defaultFuncs
|
24
|
-
.postFormData('https://www.facebook.com/profile/picture/upload/', ctx.jar, {
|
25
|
-
profile_id: ctx.userID,
|
26
|
-
photo_source: 57,
|
27
|
-
av: ctx.userID,
|
28
|
-
file: image
|
29
|
-
})
|
30
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
31
|
-
.then(function (res) {
|
32
|
-
if (res.error || res.errors || !res.payload)
|
33
|
-
throw res;
|
34
|
-
|
35
|
-
var vari = {
|
36
|
-
input: {
|
37
|
-
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,,`,
|
38
|
-
cover_photo_id: res.payload.fbid,
|
39
|
-
focus: {
|
40
|
-
x: 0.5,
|
41
|
-
y: 1
|
42
|
-
},
|
43
|
-
target_user_id: ctx.userID,
|
44
|
-
actor_id: ctx.userID,
|
45
|
-
client_mutation_id: Math.round(Math.random() * 19).toString()
|
46
|
-
},
|
47
|
-
scale: 1,
|
48
|
-
contextualProfileContext: null
|
49
|
-
}
|
50
|
-
return defaultFuncs
|
51
|
-
.post('https://www.facebook.com/api/graphql', ctx.jar, {
|
52
|
-
doc_id: 8247793861913071,
|
53
|
-
server_timestamps: true,
|
54
|
-
fb_api_req_friendly_name: 'ProfileCometCoverPhotoUpdateMutation',
|
55
|
-
variables: JSON.stringify(vari)
|
56
|
-
})
|
57
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs));
|
58
|
-
})
|
59
|
-
.then(function (res) {
|
60
|
-
if (res.errors)
|
61
|
-
throw res;
|
62
|
-
return cb(null, res.data.user_update_cover_photo.user.cover_photo.photo.url);
|
63
|
-
})
|
64
|
-
.catch(function (err) {
|
65
|
-
console.error('changeCover', err);
|
66
|
-
return cb(err);
|
67
|
-
});
|
68
|
-
}
|
69
|
-
|
70
|
-
return rt;
|
71
|
-
}
|
72
|
-
}
|
package/src/changeName.js
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var utils = require('./../utils.js');
|
4
|
-
|
5
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
6
|
-
return function changeName(input, format, callback) {
|
7
|
-
var cb;
|
8
|
-
var rt = new Promise(function (resolve, reject) {
|
9
|
-
cb = error => error ? reject(error) : resolve();
|
10
|
-
});
|
11
|
-
|
12
|
-
if (typeof input == 'function') {
|
13
|
-
callback = input;
|
14
|
-
input = null;
|
15
|
-
}
|
16
|
-
if (typeof format == 'function') {
|
17
|
-
callback = format;
|
18
|
-
format = 'complete';
|
19
|
-
}
|
20
|
-
if (typeof callback == 'function') cb = callback;
|
21
|
-
if (utils.getType(input) != 'Object') {
|
22
|
-
var error = 'name must be an object, not ' + utils.getType(input);
|
23
|
-
log('changeName', error);
|
24
|
-
return cb(error);
|
25
|
-
}
|
26
|
-
|
27
|
-
var { first_name, middle_name, last_name } = input;
|
28
|
-
if (!first_name || !last_name) {
|
29
|
-
console.error('changeName', 'name is not be accepted');
|
30
|
-
return cb('name is not be accepted');
|
31
|
-
}
|
32
|
-
|
33
|
-
middle_name = middle_name || '';
|
34
|
-
|
35
|
-
var full_name =
|
36
|
-
format == 'complete' ? last_name + ' ' + (middle_name != '' ? middle_name + ' ' : '') + first_name :
|
37
|
-
format == 'standard' ? last_name + ' ' + first_name :
|
38
|
-
format == 'reversed' ? first_name + ' ' + (middle_name != '' ? middle_name + ' ' : '') + last_name :
|
39
|
-
last_name + ' ' + (middle_name != '' ? middle_name + ' ' : '') + first_name;
|
40
|
-
|
41
|
-
var form = {
|
42
|
-
fb_api_caller_class: 'RelayModern',
|
43
|
-
fb_api_req_friendly_name: 'useFXIMUpdateNameMutation',
|
44
|
-
variables: JSON.stringify({
|
45
|
-
client_mutation_id: utils.getGUID(),
|
46
|
-
family_device_id: "device_id_fetch_datr",
|
47
|
-
identity_ids: [ctx.userID],
|
48
|
-
full_name,
|
49
|
-
first_name,
|
50
|
-
middle_name,
|
51
|
-
last_name,
|
52
|
-
interface: 'FB_WEB'
|
53
|
-
}),
|
54
|
-
server_timestamps: true,
|
55
|
-
doc_id: '5763510853763960'
|
56
|
-
}
|
57
|
-
|
58
|
-
defaultFuncs
|
59
|
-
.post('https://accountscenter.facebook.com/api/graphql/', ctx.jar, form, null, null, {
|
60
|
-
Origin: 'https://accountscenter.facebook.com',
|
61
|
-
Referer: `https://accountscenter.facebook.com/profiles/${ctx.userID}/name`
|
62
|
-
})
|
63
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
64
|
-
.then(function (res) {
|
65
|
-
if (res.errors)
|
66
|
-
throw res;
|
67
|
-
else if (res.data.fxim_update_identity_name.error)
|
68
|
-
throw res.data.fxim_update_identity_name.error;
|
69
|
-
return cb();
|
70
|
-
})
|
71
|
-
.catch(function (err) {
|
72
|
-
console.error('changeName', err);
|
73
|
-
return cb(err);
|
74
|
-
});
|
75
|
-
|
76
|
-
return rt;
|
77
|
-
}
|
78
|
-
}
|
package/src/changeUsername.js
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var utils = require('../utils');
|
4
|
-
|
5
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
6
|
-
return function changeUsername(username, callback) {
|
7
|
-
var cb;
|
8
|
-
var rt = new Promise(function (resolve, reject) {
|
9
|
-
cb = (error, info) => info ? resolve(info) : reject(error);
|
10
|
-
});
|
11
|
-
|
12
|
-
if (typeof username == 'function') {
|
13
|
-
var error = 'username must be a string, and not ' + utils.getType(username);
|
14
|
-
console.error('changeUsername', error);
|
15
|
-
return username(error);
|
16
|
-
}
|
17
|
-
if (typeof callback == 'function') cb = callback;
|
18
|
-
if (typeof username != 'string') {
|
19
|
-
var error = 'username must be a string, and not ' + utils.getType(username);
|
20
|
-
console.error('changeUsername', error);
|
21
|
-
return cb(error);
|
22
|
-
}
|
23
|
-
|
24
|
-
var form = {
|
25
|
-
fb_api_caller_class: 'RelayModern',
|
26
|
-
fb_api_req_friendly_name: 'useFXIMUpdateUsernameMutation',
|
27
|
-
variables: JSON.stringify({
|
28
|
-
client_mutation_id: utils.getGUID(),
|
29
|
-
family_device_id: "device_id_fetch_datr",
|
30
|
-
identity_ids: [ctx.userID],
|
31
|
-
username,
|
32
|
-
interface: "FB_WEB"
|
33
|
-
}),
|
34
|
-
server_timestamps: true,
|
35
|
-
doc_id: 5737739449613305
|
36
|
-
}
|
37
|
-
|
38
|
-
defaultFuncs
|
39
|
-
.post('https://accountscenter.facebook.com/api/graphql/', ctx.jar, form, null, null, {
|
40
|
-
Origin: 'https://accountscenter.facebook.com',
|
41
|
-
Referer: `https://accountscenter.facebook.com/profiles/${ctx.userID}/username/?entrypoint=fb_account_center`
|
42
|
-
})
|
43
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
44
|
-
.then(function (res) {
|
45
|
-
if (res.errors)
|
46
|
-
throw res;
|
47
|
-
else if (res.data.fxim_update_identity_username.error)
|
48
|
-
throw res.data.fxim_update_identity_username.error;
|
49
|
-
return cb();
|
50
|
-
})
|
51
|
-
.catch(function (err) {
|
52
|
-
console.error('changeUsername', err);
|
53
|
-
return cb(err);
|
54
|
-
});
|
55
|
-
|
56
|
-
return rt;
|
57
|
-
}
|
58
|
-
}
|
package/src/createCommentPost.js
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var utils = require('../utils.js');
|
4
|
-
|
5
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
6
|
-
function handleUpload(msg, form) {
|
7
|
-
var cb;
|
8
|
-
var uploads = [];
|
9
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
10
|
-
cb = error => error ? reject(error) : resolve();
|
11
|
-
});
|
12
|
-
|
13
|
-
for (let item of msg.attachments) {
|
14
|
-
if (!utils.isReadableStream(item))
|
15
|
-
return cb({ error: 'image should be a readable stream and not ' + utils.getType(image) });
|
16
|
-
|
17
|
-
var httpData = defaultFuncs
|
18
|
-
.postFormData('https://www.facebook.com/ajax/ufi/upload/', ctx.jar, {
|
19
|
-
profile_id: ctx.userID,
|
20
|
-
source: 19,
|
21
|
-
target_id: ctx.userID,
|
22
|
-
file: item
|
23
|
-
})
|
24
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
25
|
-
.then(function (res) {
|
26
|
-
if (res.errors || res.error || !res.payload)
|
27
|
-
throw res;
|
28
|
-
|
29
|
-
return {
|
30
|
-
media: {
|
31
|
-
id: res.payload.fbid
|
32
|
-
}
|
33
|
-
}
|
34
|
-
})
|
35
|
-
.catch(cb);
|
36
|
-
|
37
|
-
uploads.push(httpData);
|
38
|
-
}
|
39
|
-
|
40
|
-
Promise
|
41
|
-
.all(uploads)
|
42
|
-
.then(function (main) {
|
43
|
-
main.forEach(item => form.input.attachments.push(item));
|
44
|
-
|
45
|
-
return cb();
|
46
|
-
})
|
47
|
-
.catch(cb);
|
48
|
-
|
49
|
-
return returnPromise;
|
50
|
-
}
|
51
|
-
|
52
|
-
function handleURL(msg, form) {
|
53
|
-
if (typeof msg.url == 'string') {
|
54
|
-
form.input.attachments = [
|
55
|
-
{
|
56
|
-
link: {
|
57
|
-
external: {
|
58
|
-
url: msg.url
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
];
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
function handleMentions(msg, form) {
|
67
|
-
for (let item of msg.mentions) {
|
68
|
-
var { tag, id, fromIndex } = item;
|
69
|
-
|
70
|
-
if (typeof tag != 'string')
|
71
|
-
throw 'Mention tag must be string';
|
72
|
-
if (!id)
|
73
|
-
throw 'id must be string';
|
74
|
-
var offset = msg.body.indexOf(tag, fromIndex || 0);
|
75
|
-
if (offset < 0)
|
76
|
-
throw 'Mention for "' + tag + '" not found in message string.';
|
77
|
-
form.input.message.ranges.push({
|
78
|
-
entity: { id },
|
79
|
-
length: tag.length,
|
80
|
-
offset
|
81
|
-
});
|
82
|
-
}
|
83
|
-
}
|
84
|
-
|
85
|
-
function handleSticker(msg, form) {
|
86
|
-
if (msg.sticker) {
|
87
|
-
form.input.attachments = [
|
88
|
-
{
|
89
|
-
media: {
|
90
|
-
id: msg.sticker
|
91
|
-
}
|
92
|
-
}
|
93
|
-
];
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
function createContent(form) {
|
98
|
-
var cb;
|
99
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
100
|
-
cb = (error, info) => info ? resolve(info) : reject(error);
|
101
|
-
});
|
102
|
-
|
103
|
-
defaultFuncs
|
104
|
-
.post('https://www.facebook.com/api/graphql/', ctx.jar, {
|
105
|
-
fb_api_caller_class: 'RelayModern',
|
106
|
-
fb_api_req_friendly_name: 'useCometUFICreateCommentMutation',
|
107
|
-
variables: JSON.stringify(form),
|
108
|
-
server_timestamps: !0,
|
109
|
-
doc_id: 6993516810709754
|
110
|
-
})
|
111
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
112
|
-
.then(function (res) {
|
113
|
-
if (res.errors)
|
114
|
-
throw res;
|
115
|
-
|
116
|
-
var res = res.data.comment_create;
|
117
|
-
var info = {
|
118
|
-
id: res.feedback_comment_edge.node.id,
|
119
|
-
url: res.feedback_comment_edge.node.feedback.url,
|
120
|
-
count: res.feedback.total_comment_count
|
121
|
-
}
|
122
|
-
return cb(null, info);
|
123
|
-
})
|
124
|
-
.catch(cb);
|
125
|
-
|
126
|
-
return returnPromise;
|
127
|
-
}
|
128
|
-
|
129
|
-
return function createCommentPost(msg, postID, callback, replyCommentID) {
|
130
|
-
var cb;
|
131
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
132
|
-
cb = (error, info) => info ? resolve(info) : reject(error);
|
133
|
-
});
|
134
|
-
|
135
|
-
if (typeof msg == 'function') {
|
136
|
-
var error = 'Message must be a string or object!!';
|
137
|
-
console.error('createCommentPost', error);
|
138
|
-
return msg(error);
|
139
|
-
}
|
140
|
-
if (typeof postID == 'function') {
|
141
|
-
var error = 'postID must be a string!!';
|
142
|
-
console.error('createCommentPost', error);
|
143
|
-
return postID(error);
|
144
|
-
}
|
145
|
-
if (typeof callback == 'string') {
|
146
|
-
replyCommentID = callback;
|
147
|
-
callback = null;
|
148
|
-
}
|
149
|
-
if (typeof callback == 'function')
|
150
|
-
cb = calback;
|
151
|
-
|
152
|
-
var MessageType = utils.getType(msg);
|
153
|
-
|
154
|
-
if (MessageType == 'String')
|
155
|
-
msg = {
|
156
|
-
body: msg,
|
157
|
-
attachments: [],
|
158
|
-
mentions: [],
|
159
|
-
sticker: null,
|
160
|
-
url: null
|
161
|
-
}
|
162
|
-
else if (MessageType == 'Object') {
|
163
|
-
msg.mentions ? !Array.isArray(msg.mentions) ? msg.mentions = [msg.mentions] : null : msg.mentions = [];
|
164
|
-
msg.attachments ? !Array.isArray(msg.attachments) ? msg.attachments = [msg.attachments] : null : msg.attachments = [];
|
165
|
-
isNaN(msg.sticker) ? msg.sticker = null : null;
|
166
|
-
msg.body ? typeof msg.body == 'object' ? msg.body = JSON.stringify(msg.body) : null : msg.body = '';
|
167
|
-
} else {
|
168
|
-
var error = 'Message must be a string or object!!';
|
169
|
-
console.error('createCommentPost', error);
|
170
|
-
return cb(error);
|
171
|
-
}
|
172
|
-
if (typeof postID != 'string') {
|
173
|
-
var error = 'postID must be a string!!';
|
174
|
-
console.error('createCommentPost', error);
|
175
|
-
return cb(error);
|
176
|
-
}
|
177
|
-
|
178
|
-
if (typeof replyCommentID != 'string')
|
179
|
-
replyCommentID = null;
|
180
|
-
|
181
|
-
var form = {
|
182
|
-
feedLocation: 'NEWSFEED',
|
183
|
-
feedbackSource: 1,
|
184
|
-
groupID: null,
|
185
|
-
input: {
|
186
|
-
client_mutation_id: Math.round(Math.random() * 19).toString(),
|
187
|
-
actor_id: ctx.userID,
|
188
|
-
attachments: [],
|
189
|
-
feedback_id: Buffer.from('feedback:' + postID).toString('base64'),
|
190
|
-
formatting_style: null,
|
191
|
-
message: {
|
192
|
-
ranges: [],
|
193
|
-
text: msg.body
|
194
|
-
},
|
195
|
-
reply_comment_parent_fbid: replyCommentID ? isNaN(replyCommentID) ? replyCommentID : Buffer.from('comment:' + postID + '_' + replyCommentID).toString('base64') : null,
|
196
|
-
reply_target_clicked: !!replyCommentID,
|
197
|
-
attribution_id_v2:
|
198
|
-
'CometHomeRoot.react,comet.home,via_cold_start,'
|
199
|
-
+ Date.now()
|
200
|
-
+ ',156248,4748854339,,',
|
201
|
-
vod_video_timestamp: null,
|
202
|
-
feedback_referrer: '/',
|
203
|
-
is_tracking_encrypted: !0,
|
204
|
-
tracking: [],
|
205
|
-
feedback_source: 'NEWS_FEED',
|
206
|
-
idempotence_token: 'client:' + utils.getGUID(),
|
207
|
-
session_id: utils.getGUID()
|
208
|
-
},
|
209
|
-
inviteShortLinkKey: null,
|
210
|
-
renderLocation: null,
|
211
|
-
scale: 1,
|
212
|
-
useDefaultActor: !1,
|
213
|
-
focusCommentID: null
|
214
|
-
}
|
215
|
-
|
216
|
-
handleUpload(msg, form)
|
217
|
-
.then(_ => handleURL(msg, form))
|
218
|
-
.then(_ => handleMentions(msg, form))
|
219
|
-
.then(_ => handleSticker(msg, form))
|
220
|
-
.then(_ => createContent(form))
|
221
|
-
.then(info => cb(null, info))
|
222
|
-
.catch(function (err) {
|
223
|
-
console.error('createCommentPost', err);
|
224
|
-
return cb(null, err);
|
225
|
-
})
|
226
|
-
|
227
|
-
return returnPromise;
|
228
|
-
}
|
229
|
-
}
|