fca-zoebakaaa 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. package/.eslintrc.js +35 -0
  2. package/CHANGELOG.md +2 -0
  3. package/Controllers/Remote.js +4 -0
  4. package/DOCS.md +1738 -0
  5. package/Extra/ExtraAddons.js +80 -0
  6. package/Extra/ExtraFindUID.js +62 -0
  7. package/Extra/ExtraGetThread.js +118 -0
  8. package/Extra/ExtraTranslate.js +62 -0
  9. package/Extra/ExtraUptimeRobot.js +62 -0
  10. package/Extra/Html/Classic/script.js +233 -0
  11. package/Extra/Html/Classic/style.css +8 -0
  12. package/Extra/PM2/ecosystem.config.js +23 -0
  13. package/Extra/Security/Index.js +174 -0
  14. package/Extra/Security/Step_1.js +15 -0
  15. package/Extra/Security/Step_2.js +23 -0
  16. package/Extra/Security/Step_3.js +23 -0
  17. package/Extra/Src/History.js +117 -0
  18. package/Extra/Src/Last-Run.js +65 -0
  19. package/Extra/Src/Premium.js +88 -0
  20. package/Extra/Src/SecurityCheck.js +7 -0
  21. package/Extra/database/SyntheticDatabase.sqlite +0 -0
  22. package/Extra/database/index.js +360 -0
  23. package/Extra/logger.js +74 -0
  24. package/Func/AcceptAgreement.js +36 -0
  25. package/Func/ClearCache.js +68 -0
  26. package/Func/ReportV1.js +55 -0
  27. package/README.md +112 -0
  28. package/Settings/Database.js +21 -0
  29. package/Settings/Location.js +59 -0
  30. package/broadcast.js +40 -0
  31. package/index.js +1353 -0
  32. package/logger.js +75 -0
  33. package/package.json +56 -0
  34. package/src/Premium.js +39 -0
  35. package/src/addExternalModule.js +23 -0
  36. package/src/addUserToGroup.js +101 -0
  37. package/src/appstate.json +0 -0
  38. package/src/changeAdminStatus.js +95 -0
  39. package/src/changeArchivedStatus.js +47 -0
  40. package/src/changeAvt.js +95 -0
  41. package/src/changeBio.js +66 -0
  42. package/src/changeBlockedStatus.js +42 -0
  43. package/src/changeGroupImage.js +124 -0
  44. package/src/changeNickname.js +54 -0
  45. package/src/changeThreadColor.js +67 -0
  46. package/src/changeThreadEmoji.js +50 -0
  47. package/src/createNewGroup.js +78 -0
  48. package/src/createPoll.js +66 -0
  49. package/src/deleteMessage.js +51 -0
  50. package/src/deleteThread.js +49 -0
  51. package/src/forwardAttachment.js +53 -0
  52. package/src/getAccessToken.js +36 -0
  53. package/src/getCurrentUserID.js +8 -0
  54. package/src/getEmojiUrl.js +29 -0
  55. package/src/getFriendsList.js +81 -0
  56. package/src/getMessage.js +85 -0
  57. package/src/getThreadHistory.js +633 -0
  58. package/src/getThreadInfo.js +248 -0
  59. package/src/getThreadList.js +276 -0
  60. package/src/getThreadPictures.js +71 -0
  61. package/src/getUID.js +61 -0
  62. package/src/getUserID.js +62 -0
  63. package/src/getUserInfo.js +68 -0
  64. package/src/getUserInfoV2.js +32 -0
  65. package/src/getUserInfoV3.js +72 -0
  66. package/src/getUserInfoV4.js +57 -0
  67. package/src/getUserInfoV5.js +68 -0
  68. package/src/handleFriendRequest.js +47 -0
  69. package/src/handleMessageRequest.js +63 -0
  70. package/src/httpGet.js +54 -0
  71. package/src/httpPost.js +53 -0
  72. package/src/httpPostFormData.js +46 -0
  73. package/src/listenMqtt.js +1056 -0
  74. package/src/logout.js +73 -0
  75. package/src/markAsDelivered.js +54 -0
  76. package/src/markAsRead.js +82 -0
  77. package/src/markAsReadAll.js +47 -0
  78. package/src/markAsSeen.js +58 -0
  79. package/src/muteThread.js +51 -0
  80. package/src/removeUserFromGroup.js +72 -0
  81. package/src/resolvePhotoUrl.js +39 -0
  82. package/src/searchForThread.js +48 -0
  83. package/src/sendMessage.js +429 -0
  84. package/src/sendTypingIndicator.js +83 -0
  85. package/src/setMessageReaction.js +114 -0
  86. package/src/setPostReaction.js +103 -0
  87. package/src/setTitle.js +86 -0
  88. package/src/threadColors.js +40 -0
  89. package/src/toolspincoinmaster +89 -0
  90. package/src/unfriend.js +48 -0
  91. package/src/unsendMessage.js +40 -0
  92. package/utils.js +2244 -0
  93. package/zoebaka.code-workspace +8 -0
package/src/logout.js ADDED
@@ -0,0 +1,73 @@
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 logout(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, friendList) {
17
+ if (err) return rejectFunc(err);
18
+
19
+ resolveFunc(friendList);
20
+ };
21
+ }
22
+
23
+ var form = {
24
+ pmid: "0",
25
+ };
26
+
27
+ defaultFuncs
28
+ .post(
29
+ "https://www.facebook.com/bluebar/modern_settings_menu/?help_type=364455653583099&show_contextual_help=1",
30
+ ctx.jar,
31
+ form,
32
+ )
33
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
34
+ .then(function (resData) {
35
+ var elem = resData.jsmods.instances[0][2][0].filter(function (v) {
36
+ return v.value === "logout";
37
+ })[0];
38
+
39
+ var html = resData.jsmods.markup.filter(function (v) {
40
+ return v[0] === elem.markup.__m;
41
+ })[0][1].__html;
42
+
43
+ var form = {
44
+ fb_dtsg: utils.getFrom(html, '"fb_dtsg" value="', '"'),
45
+ ref: utils.getFrom(html, '"ref" value="', '"'),
46
+ h: utils.getFrom(html, '"h" value="', '"'),
47
+ };
48
+
49
+ return defaultFuncs
50
+ .post("https://www.facebook.com/logout.php", ctx.jar, form)
51
+ .then(utils.saveCookies(ctx.jar));
52
+ })
53
+ .then(function (res) {
54
+ if (!res.headers)
55
+ throw { error: "An error occurred when logging out." };
56
+
57
+ return defaultFuncs
58
+ .get(res.headers.location, ctx.jar)
59
+ .then(utils.saveCookies(ctx.jar));
60
+ })
61
+ .then(function () {
62
+ ctx.loggedIn = false;
63
+ log.info("logout", "Logged out successfully.");
64
+ callback();
65
+ })
66
+ .catch(function (err) {
67
+ log.error("logout", err);
68
+ return callback(err);
69
+ });
70
+
71
+ return returnPromise;
72
+ };
73
+ };
@@ -0,0 +1,54 @@
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 markAsDelivered(threadID, messageID, 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, data) {
17
+ if (err) return rejectFunc(err);
18
+
19
+ resolveFunc(data);
20
+ };
21
+ }
22
+
23
+ if (!threadID || !messageID)
24
+ return callback("Error: messageID or threadID is not defined");
25
+
26
+ var form = {};
27
+
28
+ form["message_ids[0]"] = messageID;
29
+ form["thread_ids[" + threadID + "][0]"] = messageID;
30
+
31
+ defaultFuncs
32
+ .post(
33
+ "https://www.facebook.com/ajax/mercury/delivery_receipts.php",
34
+ ctx.jar,
35
+ form,
36
+ )
37
+ .then(utils.saveCookies(ctx.jar))
38
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
39
+ .then(function (resData) {
40
+ if (resData.error) throw resData;
41
+
42
+ return callback();
43
+ })
44
+ .catch(function (err) {
45
+ log.error("markAsDelivered", err);
46
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.")
47
+ ctx.loggedIn = false;
48
+
49
+ return callback(err);
50
+ });
51
+
52
+ return returnPromise;
53
+ };
54
+ };
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return async function markAsRead(threadID, read, callback) {
8
+ if (
9
+ utils.getType(read) === "Function" ||
10
+ utils.getType(read) === "AsyncFunction"
11
+ ) {
12
+ callback = read;
13
+ read = true;
14
+ }
15
+ if (read == undefined) read = true;
16
+
17
+ if (!callback) callback = () => {};
18
+
19
+ var form = {};
20
+
21
+ if (typeof ctx.globalOptions.pageID !== "undefined") {
22
+ form["source"] = "PagesManagerMessagesInterface";
23
+ form["request_user_id"] = ctx.globalOptions.pageID;
24
+ form["ids[" + threadID + "]"] = read;
25
+ form["watermarkTimestamp"] = new Date().getTime();
26
+ form["shouldSendReadReceipt"] = true;
27
+ form["commerce_last_message_type"] = "";
28
+ //form["titanOriginatedThreadId"] = utils.generateThreadingID(ctx.clientID);
29
+
30
+ let resData;
31
+ try {
32
+ resData = await defaultFuncs
33
+ .post(
34
+ "https://www.facebook.com/ajax/mercury/change_read_status.php",
35
+ ctx.jar,
36
+ form,
37
+ )
38
+ .then(utils.saveCookies(ctx.jar))
39
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs));
40
+ } catch (e) {
41
+ callback(e);
42
+ return e;
43
+ }
44
+
45
+ if (resData.error) {
46
+ let err = resData.error;
47
+ log.error("markAsRead", err);
48
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.")
49
+ ctx.loggedIn = false;
50
+ callback(err);
51
+ return err;
52
+ }
53
+
54
+ callback();
55
+ return null;
56
+ } else {
57
+ try {
58
+ if (ctx.mqttClient) {
59
+ let err = await new Promise((r) =>
60
+ ctx.mqttClient.publish(
61
+ "/mark_thread",
62
+ JSON.stringify({
63
+ threadID,
64
+ mark: "read",
65
+ state: read,
66
+ }),
67
+ { qos: 1, retain: false },
68
+ r,
69
+ ),
70
+ );
71
+ if (err) throw err;
72
+ } else
73
+ throw {
74
+ error: "You can only use this function after you start listening.",
75
+ };
76
+ } catch (e) {
77
+ callback(e);
78
+ return e;
79
+ }
80
+ }
81
+ };
82
+ };
@@ -0,0 +1,47 @@
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 markAsReadAll(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, data) {
17
+ if (err) return rejectFunc(err);
18
+
19
+ resolveFunc(data);
20
+ };
21
+ }
22
+
23
+ var form = {
24
+ folder: "inbox",
25
+ };
26
+
27
+ defaultFuncs
28
+ .post(
29
+ "https://www.facebook.com/ajax/mercury/mark_folder_as_read.php",
30
+ ctx.jar,
31
+ form,
32
+ )
33
+ .then(utils.saveCookies(ctx.jar))
34
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
+ .then(function (resData) {
36
+ if (resData.error) throw resData;
37
+
38
+ return callback();
39
+ })
40
+ .catch(function (err) {
41
+ log.error("markAsReadAll", err);
42
+ return callback(err);
43
+ });
44
+
45
+ return returnPromise;
46
+ };
47
+ };
@@ -0,0 +1,58 @@
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 markAsSeen(seen_timestamp, callback) {
8
+ if (
9
+ utils.getType(seen_timestamp) == "Function" ||
10
+ utils.getType(seen_timestamp) == "AsyncFunction"
11
+ ) {
12
+ callback = seen_timestamp;
13
+ seen_timestamp = Date.now();
14
+ }
15
+
16
+ var resolveFunc = function () {};
17
+ var rejectFunc = function () {};
18
+ var returnPromise = new Promise(function (resolve, reject) {
19
+ resolveFunc = resolve;
20
+ rejectFunc = reject;
21
+ });
22
+
23
+ if (!callback) {
24
+ callback = function (err, data) {
25
+ if (err) return rejectFunc(err);
26
+
27
+ resolveFunc(data);
28
+ };
29
+ }
30
+
31
+ var form = {
32
+ seen_timestamp: seen_timestamp,
33
+ };
34
+
35
+ defaultFuncs
36
+ .post(
37
+ "https://www.facebook.com/ajax/mercury/mark_seen.php",
38
+ ctx.jar,
39
+ form,
40
+ )
41
+ .then(utils.saveCookies(ctx.jar))
42
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
43
+ .then(function (resData) {
44
+ if (resData.error) throw resData;
45
+
46
+ return callback();
47
+ })
48
+ .catch(function (err) {
49
+ log.error("markAsSeen", err);
50
+ if (utils.getType(err) == "Object" && err.error === "Not logged in.")
51
+ ctx.loggedIn = false;
52
+
53
+ return callback(err);
54
+ });
55
+
56
+ return returnPromise;
57
+ };
58
+ };
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ // muteSecond: -1=permanent mute, 0=unmute, 60=one minute, 3600=one hour, etc.
8
+ return function muteThread(threadID, muteSeconds, callback) {
9
+ var resolveFunc = function () {};
10
+ var rejectFunc = function () {};
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
16
+ if (!callback) {
17
+ callback = function (err, data) {
18
+ if (err) return rejectFunc(err);
19
+
20
+ resolveFunc(data);
21
+ };
22
+ }
23
+
24
+ var form = {
25
+ thread_fbid: threadID,
26
+ mute_settings: muteSeconds,
27
+ };
28
+
29
+ defaultFuncs
30
+ .post(
31
+ "https://www.facebook.com/ajax/mercury/change_mute_thread.php",
32
+ ctx.jar,
33
+ form,
34
+ )
35
+ .then(utils.saveCookies(ctx.jar))
36
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
37
+ .then(function (resData) {
38
+ if (resData.error) {
39
+ throw resData;
40
+ }
41
+
42
+ return callback();
43
+ })
44
+ .catch(function (err) {
45
+ log.error("muteThread", err);
46
+ return callback(err);
47
+ });
48
+
49
+ return returnPromise;
50
+ };
51
+ };
@@ -0,0 +1,72 @@
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 removeUserFromGroup(userID, threadID, callback) {
8
+ if (
9
+ !callback &&
10
+ (utils.getType(threadID) === "Function" ||
11
+ utils.getType(threadID) === "AsyncFunction")
12
+ )
13
+ throw { error: "please pass a threadID as a second argument." };
14
+ if (
15
+ utils.getType(threadID) !== "Number" &&
16
+ utils.getType(threadID) !== "String"
17
+ )
18
+ throw {
19
+ error:
20
+ "threadID should be of type Number or String and not " +
21
+ utils.getType(threadID) +
22
+ ".",
23
+ };
24
+ if (
25
+ utils.getType(userID) !== "Number" &&
26
+ utils.getType(userID) !== "String"
27
+ )
28
+ throw {
29
+ error:
30
+ "userID should be of type Number or String and not " +
31
+ utils.getType(userID) +
32
+ ".",
33
+ };
34
+
35
+ var resolveFunc = function () {};
36
+ var rejectFunc = function () {};
37
+ var returnPromise = new Promise(function (resolve, reject) {
38
+ resolveFunc = resolve;
39
+ rejectFunc = reject;
40
+ });
41
+
42
+ if (!callback) {
43
+ callback = function (err, data) {
44
+ if (err) return rejectFunc(err);
45
+
46
+ resolveFunc(data);
47
+ };
48
+ }
49
+
50
+ var form = {
51
+ uid: userID,
52
+ tid: threadID,
53
+ };
54
+
55
+ defaultFuncs
56
+ .post("https://www.facebook.com/chat/remove_participants", ctx.jar, form)
57
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
58
+ .then(function (resData) {
59
+ if (!resData) throw { error: "Remove from group failed." };
60
+
61
+ if (resData.error) throw resData;
62
+
63
+ return callback();
64
+ })
65
+ .catch(function (err) {
66
+ log.error("removeUserFromGroup", err);
67
+ return callback(err);
68
+ });
69
+
70
+ return returnPromise;
71
+ };
72
+ };
@@ -0,0 +1,39 @@
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 resolvePhotoUrl(photoID, 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, data) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc(data);
19
+ };
20
+ }
21
+
22
+ defaultFuncs
23
+ .get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, {
24
+ photo_id: photoID,
25
+ })
26
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
27
+ .then((resData) => {
28
+ if (resData.error) throw resData;
29
+ var photoUrl = resData.jsmods.require[0][3][0];
30
+ return callback(null, photoUrl);
31
+ })
32
+ .catch((err) => {
33
+ log.error("resolvePhotoUrl", err);
34
+ return callback(err);
35
+ });
36
+
37
+ return returnPromise;
38
+ };
39
+ };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+
5
+ module.exports = function (defaultFuncs, api, ctx) {
6
+ return function searchForThread(name, callback) {
7
+ var resolveFunc = function () {};
8
+ var rejectFunc = function () {};
9
+ var returnPromise = new Promise(function (resolve, reject) {
10
+ resolveFunc = resolve;
11
+ rejectFunc = reject;
12
+ });
13
+
14
+ if (!callback) {
15
+ callback = function (err, data) {
16
+ if (err) return rejectFunc(err);
17
+ resolveFunc(data);
18
+ };
19
+ }
20
+
21
+ var tmpForm = {
22
+ client: "web_messenger",
23
+ query: name,
24
+ offset: 0,
25
+ limit: 21,
26
+ index: "fbid",
27
+ };
28
+
29
+ defaultFuncs
30
+ .post(
31
+ "https://www.facebook.com/ajax/mercury/search_threads.php",
32
+ ctx.jar,
33
+ tmpForm,
34
+ )
35
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
+ .then(function (resData) {
37
+ if (resData.error) throw resData;
38
+ if (!resData.payload.mercury_payload.threads)
39
+ return callback({ error: "Could not find thread `" + name + "`." });
40
+ return callback(
41
+ null,
42
+ resData.payload.mercury_payload.threads.map(utils.formatThread),
43
+ );
44
+ });
45
+
46
+ return returnPromise;
47
+ };
48
+ };