fb-anya 0.0.1-security → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fb-anya might be problematic. Click here for more details.
- package/.cache/replit/__replit_disk_meta.json +1 -0
- package/.cache/replit/modules.stamp +0 -0
- package/.cache/replit/nix/env.json +1 -0
- package/.gitattributes +2 -0
- package/Extra/ExtraAddons.js +78 -0
- package/Extra/ExtraFindUID.js +60 -0
- package/Extra/ExtraGetThread.js +118 -0
- package/Extra/ExtraTranslate.js +62 -0
- package/Extra/ExtraUptimeRobot.js +59 -0
- package/Extra/Html/Classic/script.js +231 -0
- package/Extra/Html/Classic/style.css +149 -0
- package/Extra/PM2/ecosystem.config.js +23 -0
- package/Extra/Security/Index.js +174 -0
- package/Extra/Security/Step_1.js +15 -0
- package/Extra/Security/Step_2.js +23 -0
- package/Extra/Security/Step_3.js +23 -0
- package/Extra/Src/History.js +115 -0
- package/Extra/Src/Last-Run.js +65 -0
- package/Extra/Src/Premium.js +85 -0
- package/Extra/Src/SecurityCheck.js +2 -0
- package/Func/AcceptAgreement.js +33 -0
- package/Func/ClearCache.js +63 -0
- package/Func/ReportV1.js +54 -0
- package/Language/index.json +176 -0
- package/OldSecurity.js +100 -0
- package/README.md +16 -3
- package/Settings/Database.js +21 -0
- package/Settings/Location.js +60 -0
- package/Settings/Location.json +24 -0
- package/Settings/Settings.js +60 -0
- package/StateCrypt.js +98 -0
- package/broadcast.js +38 -0
- package/index.js +1451 -0
- package/logger.js +65 -0
- package/package-anya/Database-Anya/index.js +358 -0
- package/package-anya/Database-Anya/package.json +63 -0
- package/package-anya/Database-Anya/readme.md +8 -0
- package/package-anya/anya-sp/README.md +11 -0
- package/package-anya/anya-sp/desktop.ini +2 -0
- package/package-anya/anya-sp/index.js +41 -0
- package/package-anya/anya-sp/logger.js +16 -0
- package/package-anya/anya-sp/package.json +54 -0
- package/package.json +84 -4
- package/src/K2IMG.js +8 -0
- package/src/Premium.js +30 -0
- package/src/Screenshot.js +77 -0
- package/src/T2S.js +8 -0
- package/src/addExternalModule.js +16 -0
- package/src/addUserToGroup.js +79 -0
- package/src/changeAdminStatus.js +79 -0
- package/src/changeArchivedStatus.js +41 -0
- package/src/changeAvt.js +85 -0
- package/src/changeBio.js +65 -0
- package/src/changeBlockedStatus.js +36 -0
- package/src/changeGroupImage.js +106 -0
- package/src/changeNickname.js +45 -0
- package/src/changeThreadColor.js +62 -0
- package/src/changeThreadEmoji.js +42 -0
- package/src/createNewGroup.js +70 -0
- package/src/createPoll.js +60 -0
- package/src/deleteMessage.js +45 -0
- package/src/deleteThread.js +43 -0
- package/src/desktop.ini +2 -0
- package/src/forwardAttachment.js +48 -0
- package/src/getAccessToken.js +32 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +27 -0
- package/src/getFriendsList.js +73 -0
- package/src/getMessage.js +80 -0
- package/src/getThreadHistory.js +537 -0
- package/src/getThreadInfo.js +346 -0
- package/src/getThreadList.js +213 -0
- package/src/getThreadMain.js +219 -0
- package/src/getThreadPictures.js +59 -0
- package/src/getUID.js +59 -0
- package/src/getUserID.js +62 -0
- package/src/getUserInfo.js +129 -0
- package/src/getUserInfoMain.js +65 -0
- package/src/getUserInfoV2.js +35 -0
- package/src/getUserInfoV3.js +63 -0
- package/src/getUserInfoV4.js +55 -0
- package/src/getUserInfoV5.js +61 -0
- package/src/handleFriendRequest.js +46 -0
- package/src/handleMessageRequest.js +49 -0
- package/src/httpGet.js +49 -0
- package/src/httpPost.js +48 -0
- package/src/httpPostFormData.js +41 -0
- package/src/listenMqtt.js +725 -0
- package/src/logout.js +68 -0
- package/src/markAsDelivered.js +48 -0
- package/src/markAsRead.js +70 -0
- package/src/markAsReadAll.js +43 -0
- package/src/markAsSeen.js +51 -0
- package/src/muteThread.js +47 -0
- package/src/removeUserFromGroup.js +49 -0
- package/src/resolvePhotoUrl.js +37 -0
- package/src/searchForThread.js +43 -0
- package/src/sendMessage.js +334 -0
- package/src/sendTypingIndicator.js +80 -0
- package/src/setMessageReaction.js +109 -0
- package/src/setPostReaction.js +102 -0
- package/src/setTitle.js +74 -0
- package/src/threadColors.js +39 -0
- package/src/unfriend.js +43 -0
- package/src/unsendMessage.js +40 -0
- package/utils.js +1648 -0
package/package.json
CHANGED
@@ -1,6 +1,86 @@
|
|
1
1
|
{
|
2
2
|
"name": "fb-anya",
|
3
|
-
"version": "0.0
|
4
|
-
"description": "
|
5
|
-
"
|
6
|
-
|
3
|
+
"version": "6.0.0",
|
4
|
+
"description": "labyou",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "mocha",
|
8
|
+
"lint": "./node_modules/.bin/eslint **.js",
|
9
|
+
"prettier": "prettier utils.js src/* --write"
|
10
|
+
},
|
11
|
+
"author": "Avery, David, Maude, Benjamin, KanzuWakazaki",
|
12
|
+
"license": "MIT",
|
13
|
+
"bugs": {
|
14
|
+
"url": "https://github.com/ChoruTiktokers182/fb-anya/issues"
|
15
|
+
},
|
16
|
+
"homepage": "https://github.com/ChoruTiktokers182/fb-anya#readme",
|
17
|
+
"repository": {
|
18
|
+
"type": "git",
|
19
|
+
"url": "https://github.com/ChoruTiktokers182/fca-anjelo.git"
|
20
|
+
},
|
21
|
+
"dependencies": {
|
22
|
+
"aes-js": "latest",
|
23
|
+
"assert": "latest",
|
24
|
+
"bluebird": "latest",
|
25
|
+
"chalk": "4.1.2",
|
26
|
+
"cheerio": "latest",
|
27
|
+
"crypto": "latest",
|
28
|
+
"crypto-js": "latest",
|
29
|
+
"got": "^11.8.3",
|
30
|
+
"vegito-sp": "latest",
|
31
|
+
"https-proxy-agent": "latest",
|
32
|
+
"is-hexcolor": "^1.0.0",
|
33
|
+
"lodash": "",
|
34
|
+
"mqtt": "latest",
|
35
|
+
"npmlog": "latest",
|
36
|
+
"os": "latest",
|
37
|
+
"path": "latest",
|
38
|
+
"pretty-ms": "7.0.1",
|
39
|
+
"request": "latest",
|
40
|
+
"websocket-stream": "latest",
|
41
|
+
"uuid-apikey": "latest",
|
42
|
+
"express": "latest",
|
43
|
+
"readline": "latest",
|
44
|
+
"totp-generator": "latest"
|
45
|
+
},
|
46
|
+
"engines": {
|
47
|
+
"node": ">=14.x <16.x"
|
48
|
+
},
|
49
|
+
"devDependencies": {
|
50
|
+
"eslint": "latest",
|
51
|
+
"mocha": "latest",
|
52
|
+
"prettier": "latest"
|
53
|
+
},
|
54
|
+
"eslintConfig": {
|
55
|
+
"env": {
|
56
|
+
"es6": true,
|
57
|
+
"node": true
|
58
|
+
},
|
59
|
+
"extends": "eslint:recommended",
|
60
|
+
"parserOptions": {
|
61
|
+
"sourceType": "module"
|
62
|
+
},
|
63
|
+
"rules": {
|
64
|
+
"linebreak-style": [
|
65
|
+
"error",
|
66
|
+
"unix"
|
67
|
+
],
|
68
|
+
"semi": [
|
69
|
+
"error",
|
70
|
+
"always"
|
71
|
+
],
|
72
|
+
"no-unused-vars": [
|
73
|
+
1,
|
74
|
+
{
|
75
|
+
"argsIgnorePattern": "^_"
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
79
|
+
},
|
80
|
+
"keywords": [
|
81
|
+
"Fb anya",
|
82
|
+
"fb-Anya",
|
83
|
+
"anya",
|
84
|
+
"Anya"
|
85
|
+
]
|
86
|
+
}
|
package/src/K2IMG.js
ADDED
package/src/Premium.js
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var { join } = require('path')
|
4
|
+
var fs = require('fs')
|
5
|
+
|
6
|
+
|
7
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
8
|
+
return function(Name, args){
|
9
|
+
var Method = {}
|
10
|
+
fs.readdirSync(join(__dirname, "../Func")).filter((/** @type {string} */File) => File.endsWith(".js") && !File.includes('Dev_')).map((/** @type {string} */File) => Method[File.split('.').slice(0, -1).join('.')] = require(`../Func/${File}`)(defaultFuncs, api, ctx));
|
11
|
+
if (Method[Name] == undefined) {
|
12
|
+
return (`Method ${Name} not found`);
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
try {
|
16
|
+
if (process.env.HalzionVersion == 1973 && global.Fca.Data.PremText.includes("Premium")) {
|
17
|
+
return Method[Name](args).then((/** @type {string} */Data) => {
|
18
|
+
return Data;
|
19
|
+
})
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
return ("Mua Premium Đi Rồi Sài Ông Cháu Ơi !!");
|
23
|
+
}
|
24
|
+
}
|
25
|
+
catch (e) {
|
26
|
+
console.log(e);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
};
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/* eslint-disable linebreak-style */
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var { join } = require('path');
|
5
|
+
var fs = require('fs');
|
6
|
+
var utils = require("../utils");
|
7
|
+
|
8
|
+
module.exports = function (defaultFuncs, api, ctx) {
|
9
|
+
var Coookie = JSON.parse(JSON.stringify(ctx.jar.getCookies("https://www.facebook.com").concat(ctx.jar.getCookies("https://facebook.com")).concat(ctx.jar.getCookies("https://www.messenger.com"))));
|
10
|
+
for (let i of Coookie) {
|
11
|
+
i.name = i.key;
|
12
|
+
i.domain = 'www.facebook.com';
|
13
|
+
delete i.key;
|
14
|
+
}
|
15
|
+
return function(Link, callback) {
|
16
|
+
const Screenshot = require('../Extra/ExtraScreenShot');
|
17
|
+
var resolveFunc = function () { };
|
18
|
+
var rejectFunc = function () { };
|
19
|
+
var returnPromise = new Promise(function (resolve, reject) {
|
20
|
+
resolveFunc = resolve;
|
21
|
+
rejectFunc = reject;
|
22
|
+
});
|
23
|
+
|
24
|
+
if (!callback) {
|
25
|
+
callback = function (err, data) {
|
26
|
+
if (err) return rejectFunc(err);
|
27
|
+
resolveFunc(data);
|
28
|
+
};
|
29
|
+
}
|
30
|
+
if (Link.includes('facebook.com') || Link.includes('Facebook.com') || Link.includes('fb')) {
|
31
|
+
let LinkSplit = Link.split('/');
|
32
|
+
if (LinkSplit.indexOf("https:") == 0) {
|
33
|
+
if (Link.includes('messages')) {
|
34
|
+
Screenshot.buffer(Link, {
|
35
|
+
cookies: Coookie
|
36
|
+
}).then(data => {
|
37
|
+
callback(null,data);
|
38
|
+
});
|
39
|
+
}
|
40
|
+
else if (!isNaN(LinkSplit[3]) && !Link.split('=')[1] && !isNaN(Link.split('=')[1])) {
|
41
|
+
api.sendMessage('Invaild link, format link: facebook.com/Lazic.Kanzu',global.Fca.Data.event.threadID,global.Fca.Data.event.messageID);
|
42
|
+
callback('Error Link', null);
|
43
|
+
}
|
44
|
+
else if (!isNaN(Link.split('=')[1]) && Link.split('=')[1]) {
|
45
|
+
let Format = `https://www.facebook.com/profile.php?id=${Link.split('=')[1]}`;
|
46
|
+
Screenshot.buffer(Format, {
|
47
|
+
cookies: Coookie
|
48
|
+
}).then(data => {
|
49
|
+
callback(null,data);
|
50
|
+
});
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
let Format = `https://www.facebook.com/${LinkSplit[3]}`;
|
54
|
+
Screenshot.buffer(Format, {
|
55
|
+
cookies: Coookie
|
56
|
+
}).then(data => {
|
57
|
+
callback(null,data);
|
58
|
+
});
|
59
|
+
}
|
60
|
+
}
|
61
|
+
else {
|
62
|
+
let Form = `https://www.facebook.com/${LinkSplit[1]}`;
|
63
|
+
Screenshot.buffer(Form, {
|
64
|
+
cookies: Coookie
|
65
|
+
}).then(data => {
|
66
|
+
callback(null,data);
|
67
|
+
});
|
68
|
+
}
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
Screenshot.buffer(Link).then(data => {
|
72
|
+
callback(null,data);
|
73
|
+
});
|
74
|
+
}
|
75
|
+
return returnPromise;
|
76
|
+
};
|
77
|
+
};
|
package/src/T2S.js
ADDED
@@ -0,0 +1,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") api[apiName] = moduleObj[apiName](defaultFuncs, api, ctx);
|
10
|
+
else throw new Error(`Item "${apiName}" in moduleObj must be a function, not ${utils.getType(moduleObj[apiName])}!`);
|
11
|
+
|
12
|
+
}
|
13
|
+
}
|
14
|
+
else throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
|
15
|
+
};
|
16
|
+
};
|
@@ -0,0 +1,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 (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction")) throw { error: "please pass a threadID as a second argument." };
|
16
|
+
|
17
|
+
if (!callback) {
|
18
|
+
callback = function (err) {
|
19
|
+
if (err) return rejectFunc(err);
|
20
|
+
resolveFunc();
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
if (utils.getType(threadID) !== "Number" && utils.getType(threadID) !== "String") throw { error: "ThreadID should be of type Number or String and not " + utils.getType(threadID) + "." };
|
25
|
+
|
26
|
+
|
27
|
+
if (utils.getType(userID) !== "Array") userID = [userID];
|
28
|
+
|
29
|
+
var messageAndOTID = utils.generateOfflineThreadingID();
|
30
|
+
var form = {
|
31
|
+
client: "mercury",
|
32
|
+
action_type: "ma-type:log-message",
|
33
|
+
author: "fbid:" + ctx.userID,
|
34
|
+
thread_id: "",
|
35
|
+
timestamp: Date.now(),
|
36
|
+
timestamp_absolute: "Today",
|
37
|
+
timestamp_relative: utils.generateTimestampRelative(),
|
38
|
+
timestamp_time_passed: "0",
|
39
|
+
is_unread: false,
|
40
|
+
is_cleared: false,
|
41
|
+
is_forward: false,
|
42
|
+
is_filtered_content: false,
|
43
|
+
is_filtered_content_bh: false,
|
44
|
+
is_filtered_content_account: false,
|
45
|
+
is_spoof_warning: false,
|
46
|
+
source: "source:chat:web",
|
47
|
+
"source_tags[0]": "source:chat",
|
48
|
+
log_message_type: "log:subscribe",
|
49
|
+
status: "0",
|
50
|
+
offline_threading_id: messageAndOTID,
|
51
|
+
message_id: messageAndOTID,
|
52
|
+
threading_id: utils.generateThreadingID(ctx.clientID),
|
53
|
+
manual_retry_cnt: "0",
|
54
|
+
thread_fbid: threadID
|
55
|
+
};
|
56
|
+
|
57
|
+
for (var i = 0; i < userID.length; i++) {
|
58
|
+
if (utils.getType(userID[i]) !== "Number" && utils.getType(userID[i]) !== "String") throw { error: "Elements of userID should be of type Number or String and not " + utils.getType(userID[i]) + "." };
|
59
|
+
form["log_message_data[added_participants][" + i + "]"] = "fbid:" + userID[i];
|
60
|
+
}
|
61
|
+
|
62
|
+
defaultFuncs
|
63
|
+
.post("https://www.facebook.com/messaging/send/", ctx.jar, form)
|
64
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
65
|
+
.then(function (resData) {
|
66
|
+
if (!resData) throw { error: "Add to group failed." };
|
67
|
+
if (resData.error) throw resData;
|
68
|
+
|
69
|
+
|
70
|
+
return callback();
|
71
|
+
})
|
72
|
+
.catch(function (err) {
|
73
|
+
log.error("addUserToGroup", err);
|
74
|
+
return callback(err);
|
75
|
+
});
|
76
|
+
|
77
|
+
return returnPromise;
|
78
|
+
};
|
79
|
+
};
|
@@ -0,0 +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
|
+
|
@@ -0,0 +1,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) return rejectFunc(err);
|
18
|
+
resolveFunc();
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
|
+
var form = {};
|
23
|
+
|
24
|
+
if (utils.getType(threadOrThreads) === "Array") for (var i = 0; i < threadOrThreads.length; i++) form["ids[" + threadOrThreads[i] + "]"] = archive;
|
25
|
+
else form["ids[" + threadOrThreads + "]"] = archive;
|
26
|
+
|
27
|
+
defaultFuncs
|
28
|
+
.post("https://www.facebook.com/ajax/mercury/change_archived_status.php", ctx.jar, form)
|
29
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
30
|
+
.then(function (resData) {
|
31
|
+
if (resData.error) throw resData;
|
32
|
+
return callback();
|
33
|
+
})
|
34
|
+
.catch(function (err) {
|
35
|
+
log.error("changeArchivedStatus", err);
|
36
|
+
return callback(err);
|
37
|
+
});
|
38
|
+
|
39
|
+
return returnPromise;
|
40
|
+
};
|
41
|
+
};
|
package/src/changeAvt.js
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var utils = require("../utils");
|
4
|
+
var log = require("npmlog");
|
5
|
+
/**
|
6
|
+
* It posts an image to a Facebook profile
|
7
|
+
* @param Api - The API object
|
8
|
+
* @param BotID - The ID of the bot you want to post the image to.
|
9
|
+
* @param form - The form data that you want to send.
|
10
|
+
* @returns The JSON.parse(Data.split("for (;;);")[1]); is returning the following:
|
11
|
+
* {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
|
12
|
+
*/
|
13
|
+
async function postImage(Api,BotID,form) {
|
14
|
+
var Data = await Api.httpPostFormData(`https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`, form);
|
15
|
+
return JSON.parse(Data.split("for (;;);")[1]);
|
16
|
+
}
|
17
|
+
|
18
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
19
|
+
/* Changing the profile picture of the bot. */
|
20
|
+
return function changeAvt(link, caption, callback) {
|
21
|
+
var resolveFunc = function() {};
|
22
|
+
var rejectFunc = function() {};
|
23
|
+
var returnPromise = new Promise(function(resolve, reject) {
|
24
|
+
resolveFunc = resolve;
|
25
|
+
rejectFunc = reject;
|
26
|
+
});
|
27
|
+
|
28
|
+
if (!callback) {
|
29
|
+
callback = function(err, data) {
|
30
|
+
if (err) return rejectFunc(err);
|
31
|
+
resolveFunc(data);
|
32
|
+
};
|
33
|
+
}
|
34
|
+
try {
|
35
|
+
var Fetch = require('axios')
|
36
|
+
Fetch.get(link, { responseType: "stream" }).then(data => {
|
37
|
+
postImage(api, ctx.userID, { file: data.data }).then(data => {
|
38
|
+
if (data.error) throw new Error({ error: data.error, des: data.error.errorDescription });
|
39
|
+
var form = {
|
40
|
+
av: ctx.userID,
|
41
|
+
fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
|
42
|
+
fb_api_caller_class: "RelayModern",
|
43
|
+
doc_id: "5066134240065849",
|
44
|
+
variables: JSON.stringify({
|
45
|
+
input: {
|
46
|
+
caption: (caption || ""),
|
47
|
+
existing_photo_id: data.payload.fbid,
|
48
|
+
expiration_time: null,
|
49
|
+
profile_id: ctx.userID,
|
50
|
+
profile_pic_method: "EXISTING",
|
51
|
+
profile_pic_source: "TIMELINE",
|
52
|
+
scaled_crop_rect: {
|
53
|
+
height: 1,
|
54
|
+
width: 1,
|
55
|
+
x: 0,
|
56
|
+
y: 0
|
57
|
+
},
|
58
|
+
skip_cropping: true,
|
59
|
+
actor_id: ctx.userID,
|
60
|
+
client_mutation_id: Math.round(Math.random() * 19).toString()
|
61
|
+
},
|
62
|
+
isPage: false,
|
63
|
+
isProfile: true,
|
64
|
+
scale: 3,
|
65
|
+
})
|
66
|
+
};
|
67
|
+
defaultFuncs
|
68
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
69
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
70
|
+
.then(function(resData) {
|
71
|
+
if (resData.error) throw resData;
|
72
|
+
else return callback(null,true)
|
73
|
+
})
|
74
|
+
.catch(function(err) {
|
75
|
+
return callback(err);
|
76
|
+
});
|
77
|
+
})
|
78
|
+
})
|
79
|
+
}
|
80
|
+
catch (e) {
|
81
|
+
throw e;
|
82
|
+
}
|
83
|
+
return returnPromise;
|
84
|
+
};
|
85
|
+
};
|
package/src/changeBio.js
ADDED
@@ -0,0 +1,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") callback = publish;
|
17
|
+
else {
|
18
|
+
callback = function (err) {
|
19
|
+
if (err) return rejectFunc(err);
|
20
|
+
resolveFunc();
|
21
|
+
};
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
if (utils.getType(publish) != "Boolean") publish = false;
|
26
|
+
if (utils.getType(bio) != "String") {
|
27
|
+
bio = "";
|
28
|
+
publish = false;
|
29
|
+
}
|
30
|
+
|
31
|
+
var form = {
|
32
|
+
fb_api_caller_class: "RelayModern",
|
33
|
+
fb_api_req_friendly_name: "ProfileCometSetBioMutation",
|
34
|
+
// This doc_is is valid as of May 23, 2020
|
35
|
+
doc_id: "2725043627607610",
|
36
|
+
variables: JSON.stringify({
|
37
|
+
input: {
|
38
|
+
bio: bio,
|
39
|
+
publish_bio_feed_story: publish,
|
40
|
+
actor_id: ctx.userID,
|
41
|
+
client_mutation_id: Math.round(Math.random() * 1024).toString()
|
42
|
+
},
|
43
|
+
hasProfileTileViewID: false,
|
44
|
+
profileTileViewID: null,
|
45
|
+
scale: 1
|
46
|
+
}),
|
47
|
+
av: ctx.userID
|
48
|
+
};
|
49
|
+
|
50
|
+
defaultFuncs
|
51
|
+
.post("https://www.facebook.com/api/graphql/", ctx.jar, form)
|
52
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
53
|
+
.then(function (resData) {
|
54
|
+
if (resData.errors) throw resData;
|
55
|
+
|
56
|
+
return callback();
|
57
|
+
})
|
58
|
+
.catch(function (err) {
|
59
|
+
log.error("changeBio", err);
|
60
|
+
return callback(err);
|
61
|
+
});
|
62
|
+
|
63
|
+
return returnPromise;
|
64
|
+
};
|
65
|
+
};
|
@@ -0,0 +1,36 @@
|
|
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 changeBlockedStatus(userID, block, 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) return rejectFunc(err);
|
18
|
+
resolveFunc();
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
|
+
defaultFuncs
|
23
|
+
.post(`https://www.facebook.com/messaging/${block ? "" : "un"}block_messages/`, ctx.jar, { fbid: userID })
|
24
|
+
.then(utils.saveCookies(ctx.jar))
|
25
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
26
|
+
.then(function (resData) {
|
27
|
+
if (resData.error) throw resData;
|
28
|
+
return callback();
|
29
|
+
})
|
30
|
+
.catch(function (err) {
|
31
|
+
log.error("changeBlockedStatus", err);
|
32
|
+
return callback(err);
|
33
|
+
});
|
34
|
+
return returnPromise;
|
35
|
+
};
|
36
|
+
};
|