alicezetion 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- package/.cache/replit/__replit_disk_meta.json +1 -1
- package/.cache/replit/nix/env.json +1 -1
- package/index.js +601 -386
- package/leiamnash/addExternalModule.js +19 -16
- package/leiamnash/addUserToGroup.js +113 -79
- package/leiamnash/changeAdminStatus.js +79 -79
- package/leiamnash/changeArchivedStatus.js +55 -41
- package/leiamnash/changeBio.js +77 -65
- package/leiamnash/changeBlockedStatus.js +47 -36
- package/leiamnash/changeGroupImage.js +129 -106
- package/leiamnash/changeNickname.js +59 -45
- package/leiamnash/changeThreadColor.js +71 -62
- package/leiamnash/changeThreadEmoji.js +55 -42
- package/leiamnash/chat.js +459 -374
- package/leiamnash/createNewGroup.js +86 -70
- package/leiamnash/createPoll.js +71 -60
- package/leiamnash/deleteMessage.js +56 -45
- package/leiamnash/deleteThread.js +56 -43
- package/leiamnash/forwardAttachment.js +60 -48
- package/leiamnash/getCurrentUserID.js +7 -7
- package/leiamnash/getEmojiUrl.js +29 -27
- package/leiamnash/getFriendsList.js +84 -73
- package/leiamnash/getThreadHistory.js +645 -537
- package/leiamnash/getThreadHistoryDeprecated.js +93 -0
- package/leiamnash/getThreadInfo.js +206 -425
- package/leiamnash/getThreadInfoDeprecated.js +80 -0
- package/leiamnash/getThreadList.js +238 -213
- package/leiamnash/getThreadListDeprecated.js +75 -0
- package/leiamnash/getThreadPictures.js +79 -59
- package/leiamnash/getUserID.js +66 -62
- package/leiamnash/getUserInfo.js +72 -113
- package/leiamnash/handleFriendRequest.js +61 -46
- package/leiamnash/handleMessageRequest.js +65 -49
- package/leiamnash/httpGet.js +52 -49
- package/leiamnash/httpPost.js +52 -48
- package/leiamnash/listenMqtt.js +789 -787
- package/leiamnash/logout.js +75 -68
- package/leiamnash/markAsDelivered.js +58 -48
- package/leiamnash/markAsRead.js +80 -70
- package/leiamnash/markAsReadAll.js +49 -42
- package/leiamnash/markAsSeen.js +59 -51
- package/leiamnash/muteThread.js +52 -47
- package/leiamnash/removeUserFromGroup.js +79 -49
- package/leiamnash/resolvePhotoUrl.js +45 -37
- package/leiamnash/searchForThread.js +53 -43
- package/leiamnash/sendTypingIndicator.js +103 -80
- package/leiamnash/setMessageReaction.js +117 -109
- package/leiamnash/setPostReaction.js +76 -102
- package/leiamnash/setTitle.js +86 -74
- package/leiamnash/threadColors.js +57 -39
- package/leiamnash/unfriend.js +52 -43
- package/leiamnash/unsendMessage.js +49 -40
- package/package.json +72 -90
- package/utils.js +1356 -1684
- package/Extra/Database/index.js +0 -469
- package/Extra/ExtraAddons.js +0 -82
- package/Extra/ExtraFindUID.js +0 -62
- package/Extra/ExtraGetThread.js +0 -340
- package/Extra/ExtraScreenShot.js +0 -430
- package/Extra/ExtraUptimeRobot.js +0 -38
- package/Extra/Html/Classic/script.js +0 -119
- package/Extra/Html/Classic/style.css +0 -8
- package/Extra/Security/AES_256_GCM/index.js +0 -0
- package/Extra/Security/Base/Step_1.js +0 -6
- package/Extra/Security/Base/Step_2.js +0 -22
- package/Extra/Security/Base/Step_3.js +0 -22
- package/Extra/Security/Base/index.js +0 -174
- package/Extra/Security/Index.js +0 -5
- package/Extra/Security/Step_1.js +0 -6
- package/Extra/Security/Step_2.js +0 -22
- package/Extra/Security/Step_3.js +0 -22
- package/Extra/Src/Change_Environment.js +0 -24
- package/Extra/Src/Check_Update.js +0 -67
- package/Extra/Src/History.js +0 -115
- package/Extra/Src/Instant_Update.js +0 -65
- package/Extra/Src/Last-Run.js +0 -65
- package/Extra/Src/Premium.js +0 -81
- package/Extra/Src/Release_Memory.js +0 -41
- package/Extra/Src/Websocket.js +0 -213
- package/Extra/Src/image/checkmate.jpg +0 -0
- package/Extra/Src/uuid.js +0 -137
- package/Func/AcceptAgreement.js +0 -31
- package/Func/ClearCache.js +0 -64
- package/Func/ReportV1.js +0 -54
- package/Language/index.json +0 -217
- package/Main.js +0 -1270
- package/broadcast.js +0 -40
- package/leiamnash/Dev_Horizon_Data.js +0 -125
- package/leiamnash/Premium.js +0 -25
- package/leiamnash/Screenshot.js +0 -83
- package/leiamnash/changeAvt.js +0 -85
- package/leiamnash/getAccessToken.js +0 -28
- package/leiamnash/getMessage.js +0 -80
- package/leiamnash/getThreadMain.js +0 -220
- package/leiamnash/getUID.js +0 -59
- package/leiamnash/getUserInfoMain.js +0 -65
- package/leiamnash/getUserInfoV2.js +0 -32
- package/leiamnash/getUserInfoV3.js +0 -63
- package/leiamnash/getUserInfoV4.js +0 -55
- package/leiamnash/getUserInfoV5.js +0 -61
- package/leiamnash/httpPostFormData.js +0 -41
- package/leiamnash/sendMessage.js +0 -379
- package/logger.js +0 -66
@@ -1,16 +1,19 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
|
5
|
-
module.exports = function
|
6
|
-
return function addExternalModule(moduleObj) {
|
7
|
-
if (utils.getType(moduleObj) == "Object") {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
};
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
|
5
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
6
|
+
return function addExternalModule(moduleObj) {
|
7
|
+
if (utils.getType(moduleObj) == "Object") {
|
8
|
+
for (let apiName in moduleObj) {
|
9
|
+
if (utils.getType(moduleObj[apiName]) == "Function") {
|
10
|
+
api[apiName] = moduleObj[apiName](defaultFuncs, api, ctx);
|
11
|
+
} else {
|
12
|
+
throw new Error(`Item "${apiName}" in moduleObj must be a function, not ${utils.getType(moduleObj[apiName])}!`);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
} else {
|
16
|
+
throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
|
17
|
+
}
|
18
|
+
};
|
19
|
+
};
|
@@ -1,79 +1,113 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var utils = require("../utils");
|
4
|
-
var log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function
|
7
|
-
return function addUserToGroup(userID, threadID, callback) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
10
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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 addUserToGroup(userID, threadID, callback) {
|
8
|
+
var resolveFunc = function(){};
|
9
|
+
var rejectFunc = function(){};
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
15
|
+
if (
|
16
|
+
!callback &&
|
17
|
+
(utils.getType(threadID) === "Function" ||
|
18
|
+
utils.getType(threadID) === "AsyncFunction")
|
19
|
+
) {
|
20
|
+
throw { error: "please pass a threadID as a second argument." };
|
21
|
+
}
|
22
|
+
|
23
|
+
if (!callback) {
|
24
|
+
callback = function(err) {
|
25
|
+
if (err) {
|
26
|
+
return rejectFunc(err);
|
27
|
+
}
|
28
|
+
resolveFunc();
|
29
|
+
};
|
30
|
+
}
|
31
|
+
|
32
|
+
if (
|
33
|
+
utils.getType(threadID) !== "Number" &&
|
34
|
+
utils.getType(threadID) !== "String"
|
35
|
+
) {
|
36
|
+
throw {
|
37
|
+
error:
|
38
|
+
"ThreadID should be of type Number or String and not " +
|
39
|
+
utils.getType(threadID) +
|
40
|
+
"."
|
41
|
+
};
|
42
|
+
}
|
43
|
+
|
44
|
+
if (utils.getType(userID) !== "Array") {
|
45
|
+
userID = [userID];
|
46
|
+
}
|
47
|
+
|
48
|
+
var messageAndOTID = utils.generateOfflineThreadingID();
|
49
|
+
var form = {
|
50
|
+
client: "mercury",
|
51
|
+
action_type: "ma-type:log-message",
|
52
|
+
author: "fbid:" + ctx.userID,
|
53
|
+
thread_id: "",
|
54
|
+
timestamp: Date.now(),
|
55
|
+
timestamp_absolute: "Today",
|
56
|
+
timestamp_relative: utils.generateTimestampRelative(),
|
57
|
+
timestamp_time_passed: "0",
|
58
|
+
is_unread: false,
|
59
|
+
is_cleared: false,
|
60
|
+
is_forward: false,
|
61
|
+
is_filtered_content: false,
|
62
|
+
is_filtered_content_bh: false,
|
63
|
+
is_filtered_content_account: false,
|
64
|
+
is_spoof_warning: false,
|
65
|
+
source: "source:chat:web",
|
66
|
+
"source_tags[0]": "source:chat",
|
67
|
+
log_message_type: "log:subscribe",
|
68
|
+
status: "0",
|
69
|
+
offline_threading_id: messageAndOTID,
|
70
|
+
message_id: messageAndOTID,
|
71
|
+
threading_id: utils.generateThreadingID(ctx.clientID),
|
72
|
+
manual_retry_cnt: "0",
|
73
|
+
thread_fbid: threadID
|
74
|
+
};
|
75
|
+
|
76
|
+
for (var i = 0; i < userID.length; i++) {
|
77
|
+
if (
|
78
|
+
utils.getType(userID[i]) !== "Number" &&
|
79
|
+
utils.getType(userID[i]) !== "String"
|
80
|
+
) {
|
81
|
+
throw {
|
82
|
+
error:
|
83
|
+
"Elements of userID should be of type Number or String and not " +
|
84
|
+
utils.getType(userID[i]) +
|
85
|
+
"."
|
86
|
+
};
|
87
|
+
}
|
88
|
+
|
89
|
+
form["log_message_data[added_participants][" + i + "]"] =
|
90
|
+
"fbid:" + userID[i];
|
91
|
+
}
|
92
|
+
|
93
|
+
defaultFuncs
|
94
|
+
.post("https://www.facebook.com/messaging/send/", ctx.jar, form)
|
95
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
96
|
+
.then(function(resData) {
|
97
|
+
if (!resData) {
|
98
|
+
throw { error: "Add to group failed." };
|
99
|
+
}
|
100
|
+
if (resData.error) {
|
101
|
+
throw resData;
|
102
|
+
}
|
103
|
+
|
104
|
+
return callback();
|
105
|
+
})
|
106
|
+
.catch(function(err) {
|
107
|
+
log.error("addUserToGroup", err);
|
108
|
+
return callback(err);
|
109
|
+
});
|
110
|
+
|
111
|
+
return returnPromise;
|
112
|
+
};
|
113
|
+
};
|
@@ -1,79 +1,79 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
-
return function changeAdminStatus(threadID, adminIDs, adminStatus, callback) {
|
8
|
-
if (utils.getType(threadID) !== "String") {
|
9
|
-
throw {error: "changeAdminStatus: threadID must be a string"};
|
10
|
-
}
|
11
|
-
|
12
|
-
if (utils.getType(adminIDs) === "String") {
|
13
|
-
adminIDs = [adminIDs];
|
14
|
-
}
|
15
|
-
|
16
|
-
if (utils.getType(adminIDs) !== "Array") {
|
17
|
-
throw {error: "changeAdminStatus: adminIDs must be an array or string"};
|
18
|
-
}
|
19
|
-
|
20
|
-
if (utils.getType(adminStatus) !== "Boolean") {
|
21
|
-
throw {error: "changeAdminStatus: adminStatus must be a string"};
|
22
|
-
}
|
23
|
-
|
24
|
-
var resolveFunc = function(){};
|
25
|
-
var rejectFunc = function(){};
|
26
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
27
|
-
resolveFunc = resolve;
|
28
|
-
rejectFunc = reject;
|
29
|
-
});
|
30
|
-
|
31
|
-
if (!callback) {
|
32
|
-
callback = function (err) {
|
33
|
-
if (err) {
|
34
|
-
return rejectFunc(err);
|
35
|
-
}
|
36
|
-
resolveFunc();
|
37
|
-
};
|
38
|
-
}
|
39
|
-
|
40
|
-
if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
|
41
|
-
throw {error: "changeAdminStatus: callback is not a function"};
|
42
|
-
}
|
43
|
-
|
44
|
-
let form = {
|
45
|
-
"thread_fbid": threadID,
|
46
|
-
};
|
47
|
-
|
48
|
-
let i = 0;
|
49
|
-
for (let u of adminIDs) {
|
50
|
-
form[`admin_ids[${i++}]`] = u;
|
51
|
-
}
|
52
|
-
form["add"] = adminStatus;
|
53
|
-
|
54
|
-
defaultFuncs
|
55
|
-
.post("https://www.facebook.com/messaging/save_admins/?dpr=1", ctx.jar, form)
|
56
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
57
|
-
.then(function(resData) {
|
58
|
-
if (resData.error) {
|
59
|
-
switch (resData.error) {
|
60
|
-
case 1976004:
|
61
|
-
throw { error: "Cannot alter admin status: you are not an admin.", rawResponse: resData };
|
62
|
-
case 1357031:
|
63
|
-
throw { error: "Cannot alter admin status: this thread is not a group chat.", rawResponse: resData };
|
64
|
-
default:
|
65
|
-
throw { error: "Cannot alter admin status: unknown error.", rawResponse: resData };
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
callback();
|
70
|
-
})
|
71
|
-
.catch(function(err) {
|
72
|
-
log.error("changeAdminStatus", err);
|
73
|
-
return callback(err);
|
74
|
-
});
|
75
|
-
|
76
|
-
return returnPromise;
|
77
|
-
};
|
78
|
-
};
|
79
|
-
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const utils = require("../utils");
|
4
|
+
const log = require("npmlog");
|
5
|
+
|
6
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
7
|
+
return function changeAdminStatus(threadID, adminIDs, adminStatus, callback) {
|
8
|
+
if (utils.getType(threadID) !== "String") {
|
9
|
+
throw {error: "changeAdminStatus: threadID must be a string"};
|
10
|
+
}
|
11
|
+
|
12
|
+
if (utils.getType(adminIDs) === "String") {
|
13
|
+
adminIDs = [adminIDs];
|
14
|
+
}
|
15
|
+
|
16
|
+
if (utils.getType(adminIDs) !== "Array") {
|
17
|
+
throw {error: "changeAdminStatus: adminIDs must be an array or string"};
|
18
|
+
}
|
19
|
+
|
20
|
+
if (utils.getType(adminStatus) !== "Boolean") {
|
21
|
+
throw {error: "changeAdminStatus: adminStatus must be a string"};
|
22
|
+
}
|
23
|
+
|
24
|
+
var resolveFunc = function(){};
|
25
|
+
var rejectFunc = function(){};
|
26
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
27
|
+
resolveFunc = resolve;
|
28
|
+
rejectFunc = reject;
|
29
|
+
});
|
30
|
+
|
31
|
+
if (!callback) {
|
32
|
+
callback = function (err) {
|
33
|
+
if (err) {
|
34
|
+
return rejectFunc(err);
|
35
|
+
}
|
36
|
+
resolveFunc();
|
37
|
+
};
|
38
|
+
}
|
39
|
+
|
40
|
+
if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
|
41
|
+
throw {error: "changeAdminStatus: callback is not a function"};
|
42
|
+
}
|
43
|
+
|
44
|
+
let form = {
|
45
|
+
"thread_fbid": threadID,
|
46
|
+
};
|
47
|
+
|
48
|
+
let i = 0;
|
49
|
+
for (let u of adminIDs) {
|
50
|
+
form[`admin_ids[${i++}]`] = u;
|
51
|
+
}
|
52
|
+
form["add"] = adminStatus;
|
53
|
+
|
54
|
+
defaultFuncs
|
55
|
+
.post("https://www.facebook.com/messaging/save_admins/?dpr=1", ctx.jar, form)
|
56
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
57
|
+
.then(function(resData) {
|
58
|
+
if (resData.error) {
|
59
|
+
switch (resData.error) {
|
60
|
+
case 1976004:
|
61
|
+
throw { error: "Cannot alter admin status: you are not an admin.", rawResponse: resData };
|
62
|
+
case 1357031:
|
63
|
+
throw { error: "Cannot alter admin status: this thread is not a group chat.", rawResponse: resData };
|
64
|
+
default:
|
65
|
+
throw { error: "Cannot alter admin status: unknown error.", rawResponse: resData };
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
callback();
|
70
|
+
})
|
71
|
+
.catch(function(err) {
|
72
|
+
log.error("changeAdminStatus", err);
|
73
|
+
return callback(err);
|
74
|
+
});
|
75
|
+
|
76
|
+
return returnPromise;
|
77
|
+
};
|
78
|
+
};
|
79
|
+
|
@@ -1,41 +1,55 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var utils = require("../utils");
|
4
|
-
var log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function
|
7
|
-
return function changeArchivedStatus(threadOrThreads, archive, callback) {
|
8
|
-
var resolveFunc = function
|
9
|
-
var rejectFunc = function
|
10
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function
|
17
|
-
if (err)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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 changeArchivedStatus(threadOrThreads, archive, callback) {
|
8
|
+
var resolveFunc = function(){};
|
9
|
+
var rejectFunc = function(){};
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
15
|
+
if (!callback) {
|
16
|
+
callback = function(err) {
|
17
|
+
if (err) {
|
18
|
+
return rejectFunc(err);
|
19
|
+
}
|
20
|
+
resolveFunc();
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
var form = {};
|
25
|
+
|
26
|
+
if (utils.getType(threadOrThreads) === "Array") {
|
27
|
+
for (var i = 0; i < threadOrThreads.length; i++) {
|
28
|
+
form["ids[" + threadOrThreads[i] + "]"] = archive;
|
29
|
+
}
|
30
|
+
} else {
|
31
|
+
form["ids[" + threadOrThreads + "]"] = archive;
|
32
|
+
}
|
33
|
+
|
34
|
+
defaultFuncs
|
35
|
+
.post(
|
36
|
+
"https://www.facebook.com/ajax/mercury/change_archived_status.php",
|
37
|
+
ctx.jar,
|
38
|
+
form
|
39
|
+
)
|
40
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
41
|
+
.then(function(resData) {
|
42
|
+
if (resData.error) {
|
43
|
+
throw resData;
|
44
|
+
}
|
45
|
+
|
46
|
+
return callback();
|
47
|
+
})
|
48
|
+
.catch(function(err) {
|
49
|
+
log.error("changeArchivedStatus", err);
|
50
|
+
return callback(err);
|
51
|
+
});
|
52
|
+
|
53
|
+
return returnPromise;
|
54
|
+
};
|
55
|
+
};
|
package/leiamnash/changeBio.js
CHANGED
@@ -1,65 +1,77 @@
|
|
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 changeBio(bio, publish, callback) {
|
8
|
-
var resolveFunc = function () { };
|
9
|
-
var rejectFunc = function () { };
|
10
|
-
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
if (utils.getType(publish) == "Function" || utils.getType(publish) == "AsyncFunction")
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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 changeBio(bio, publish, callback) {
|
8
|
+
var resolveFunc = function () { };
|
9
|
+
var rejectFunc = function () { };
|
10
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
11
|
+
resolveFunc = resolve;
|
12
|
+
rejectFunc = reject;
|
13
|
+
});
|
14
|
+
|
15
|
+
if (!callback) {
|
16
|
+
if (utils.getType(publish) == "Function" || utils.getType(publish) == "AsyncFunction") {
|
17
|
+
callback = publish;
|
18
|
+
} else {
|
19
|
+
callback = function (err) {
|
20
|
+
if (err) {
|
21
|
+
return rejectFunc(err);
|
22
|
+
}
|
23
|
+
resolveFunc();
|
24
|
+
};
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
if (utils.getType(publish) != "Boolean") {
|
29
|
+
publish = false;
|
30
|
+
}
|
31
|
+
|
32
|
+
if (utils.getType(bio) != "String") {
|
33
|
+
bio = "";
|
34
|
+
publish = false;
|
35
|
+
}
|
36
|
+
|
37
|
+
var form = {
|
38
|
+
fb_api_caller_class: "RelayModern",
|
39
|
+
fb_api_req_friendly_name: "ProfileCometSetBioMutation",
|
40
|
+
// This doc_is is valid as of May 23, 2020
|
41
|
+
doc_id: "2725043627607610",
|
42
|
+
variables: JSON.stringify({
|
43
|
+
input: {
|
44
|
+
bio: bio,
|
45
|
+
publish_bio_feed_story: publish,
|
46
|
+
actor_id: ctx.userID,
|
47
|
+
client_mutation_id: Math.round(Math.random() * 1024).toString()
|
48
|
+
},
|
49
|
+
hasProfileTileViewID: false,
|
50
|
+
profileTileViewID: null,
|
51
|
+
scale: 1
|
52
|
+
}),
|
53
|
+
av: ctx.userID
|
54
|
+
};
|
55
|
+
|
56
|
+
defaultFuncs
|
57
|
+
.post(
|
58
|
+
"https://www.facebook.com/api/graphql/",
|
59
|
+
ctx.jar,
|
60
|
+
form
|
61
|
+
)
|
62
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
63
|
+
.then(function (resData) {
|
64
|
+
if (resData.errors) {
|
65
|
+
throw resData;
|
66
|
+
}
|
67
|
+
|
68
|
+
return callback();
|
69
|
+
})
|
70
|
+
.catch(function (err) {
|
71
|
+
log.error("changeBio", err);
|
72
|
+
return callback(err);
|
73
|
+
});
|
74
|
+
|
75
|
+
return returnPromise;
|
76
|
+
};
|
77
|
+
};
|