rapido-fca 0.0.10 → 1.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.

Potentially problematic release.


This version of rapido-fca might be problematic. Click here for more details.

Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/index.js +4 -4
  3. package/package.json +15 -16
  4. package/readme.md +237 -39
  5. package/src/Screenshot.js +83 -0
  6. package/src/addExternalModule.js +19 -23
  7. package/src/addUserToGroup.js +99 -97
  8. package/src/changeAdminStatus.js +86 -62
  9. package/src/changeArchivedStatus.js +49 -49
  10. package/src/changeAvatar.js +118 -108
  11. package/src/changeBio.js +63 -64
  12. package/src/changeBlockedStatus.js +40 -38
  13. package/src/changeGroupImage.js +129 -126
  14. package/src/changeNickname.js +49 -49
  15. package/src/changeThreadColor.js +53 -53
  16. package/src/changeThreadEmoji.js +45 -45
  17. package/src/createNewGroup.js +74 -72
  18. package/src/createPoll.js +59 -59
  19. package/src/deleteMessage.js +50 -50
  20. package/src/deleteThread.js +50 -50
  21. package/src/editMessage.js +51 -49
  22. package/src/forwardAttachment.js +54 -54
  23. package/src/getCurrentUserID.js +3 -3
  24. package/src/getEmojiUrl.js +17 -17
  25. package/src/getFriendsList.js +67 -67
  26. package/src/getMessage.js +806 -767
  27. package/src/getThreadHistory.js +656 -642
  28. package/src/getThreadInfo.js +1 -1
  29. package/src/getThreadList.js +199 -227
  30. package/src/getThreadPictures.js +51 -71
  31. package/src/getUserID.js +53 -58
  32. package/src/getUserInfo.js +52 -60
  33. package/src/handleFriendRequest.js +41 -65
  34. package/src/handleMessageRequest.js +42 -60
  35. package/src/httpGet.js +49 -57
  36. package/src/httpPost.js +48 -57
  37. package/src/listenMqtt.js +827 -827
  38. package/src/listenMqtt.txt +827 -0
  39. package/src/logout.js +61 -61
  40. package/src/markAsDelivered.js +42 -53
  41. package/src/markAsRead.js +59 -69
  42. package/src/markAsReadAll.js +32 -42
  43. package/src/markAsSeen.js +43 -54
  44. package/src/muteThread.js +40 -47
  45. package/src/postFormData.txt +46 -0
  46. package/src/refreshFb_dtsg.js +77 -69
  47. package/src/removeUserFromGroup.js +67 -67
  48. package/src/resolvePhotoUrl.js +34 -34
  49. package/src/searchForThread.js +43 -43
  50. package/src/sendMessage.js +80 -228
  51. package/src/sendTypingIndicator.js +86 -88
  52. package/src/setPostReaction.js +90 -87
  53. package/src/setTitle.js +76 -72
  54. package/src/threadColors.js +121 -121
  55. package/src/unfriend.js +43 -43
  56. package/src/unsendMessage.js +34 -38
  57. package/src/uploadAttachment.js +80 -81
  58. package/src/httpPostFormData.js +0 -63
  59. package/src/setEmojiReaction.js +0 -59
  60. package/src/videoAttachment.js +0 -76
@@ -1,126 +1,136 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- const log = require("npmlog");
4
+ // @NethWs3Dev
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
- function handleUpload(image, callback) {
8
- const uploads = [];
7
+ function handleUpload(image, callback) {
8
+ const uploads = [];
9
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
- };
10
+ const form = {
11
+ profile_id: ctx.userID,
12
+ photo_source: 57,
13
+ av: ctx.userID,
14
+ file: image,
15
+ };
16
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
- );
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
33
 
34
- // resolve all promises
35
- Promise
36
- .all(uploads)
37
- .then(function (resData) {
38
- callback(null, resData);
39
- })
40
- .catch(function (err) {
41
- log.error("handleUpload", err);
42
- return callback(err);
43
- });
44
- }
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
+ }
45
44
 
46
- return function changeAvatar(image, caption = "", timestamp = null, callback) {
47
- let resolveFunc = function () { };
48
- let rejectFunc = function () { };
49
- const returnPromise = new Promise(function (resolve, reject) {
50
- resolveFunc = resolve;
51
- rejectFunc = reject;
52
- });
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
+ });
53
57
 
54
- if (!timestamp && utils.getType(caption) === "Number") {
55
- timestamp = caption;
56
- caption = "";
57
- }
58
+ if (!timestamp && utils.getType(caption) === "Number") {
59
+ timestamp = caption;
60
+ caption = "";
61
+ }
58
62
 
59
- if (!timestamp && !callback && (utils.getType(caption) == "Function" || utils.getType(caption) == "AsyncFunction")) {
60
- callback = caption;
61
- caption = "";
62
- timestamp = null;
63
- }
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
+ }
64
73
 
65
- if (!callback) callback = function (err, data) {
66
- if (err) {
67
- return rejectFunc(err);
68
- }
69
- resolveFunc(data);
70
- };
74
+ if (!callback)
75
+ callback = function (err, data) {
76
+ if (err) {
77
+ return rejectFunc(err);
78
+ }
79
+ resolveFunc(data);
80
+ };
71
81
 
72
- if (!utils.isReadableStream(image))
73
- return callback("Image is not a readable stream");
82
+ if (!utils.isReadableStream(image))
83
+ return callback("Image is not a readable stream");
74
84
 
75
- handleUpload(image, function (err, payload) {
76
- if (err) {
77
- return callback(err);
78
- }
85
+ handleUpload(image, function (err, payload) {
86
+ if (err) {
87
+ return callback(err);
88
+ }
79
89
 
80
- const form = {
81
- av: ctx.i_userID || ctx.userID,
82
- fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
83
- fb_api_caller_class: "RelayModern",
84
- doc_id: "5066134240065849",
85
- variables: JSON.stringify({
86
- input: {
87
- caption,
88
- existing_photo_id: payload[0].payload.fbid,
89
- expiration_time: timestamp,
90
- profile_id: ctx.i_userID || ctx.userID,
91
- profile_pic_method: "EXISTING",
92
- profile_pic_source: "TIMELINE",
93
- scaled_crop_rect: {
94
- height: 1,
95
- width: 1,
96
- x: 0,
97
- y: 0
98
- },
99
- skip_cropping: true,
100
- actor_id: ctx.i_userID || ctx.userID,
101
- client_mutation_id: Math.round(Math.random() * 19).toString()
102
- },
103
- isPage: false,
104
- isProfile: true,
105
- scale: 3
106
- })
107
- };
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
+ };
108
118
 
109
- defaultFuncs
110
- .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
111
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
112
- .then(function (resData) {
113
- if (resData.errors) {
114
- throw resData;
115
- }
116
- return callback(null, resData[0].data.profile_picture_set);
117
- })
118
- .catch(function (err) {
119
- log.error("changeAvatar", err);
120
- return callback(err);
121
- });
122
- });
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
+ });
123
133
 
124
- return returnPromise;
125
- };
134
+ return returnPromise;
135
+ };
126
136
  };
package/src/changeBio.js CHANGED
@@ -1,77 +1,76 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- const log = require("npmlog");
4
+ // @NethWs3Dev
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
- return function changeBio(bio, publish, callback) {
8
- let resolveFunc = function () { };
9
- let rejectFunc = function () { };
10
- const returnPromise = new Promise(function (resolve, reject) {
11
- resolveFunc = resolve;
12
- rejectFunc = reject;
13
- });
7
+ return function changeBio(bio, publish, callback) {
8
+ let resolveFunc = function () {};
9
+ let rejectFunc = function () {};
10
+ const returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
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
- }
15
+ if (!callback) {
16
+ if (
17
+ utils.getType(publish) == "Function" ||
18
+ utils.getType(publish) == "AsyncFunction"
19
+ ) {
20
+ callback = publish;
21
+ } else {
22
+ callback = function (err) {
23
+ if (err) {
24
+ return rejectFunc(err);
25
+ }
26
+ resolveFunc();
27
+ };
28
+ }
29
+ }
27
30
 
28
- if (utils.getType(publish) != "Boolean") {
29
- publish = false;
30
- }
31
+ if (utils.getType(publish) != "Boolean") {
32
+ publish = false;
33
+ }
31
34
 
32
- if (utils.getType(bio) != "String") {
33
- bio = "";
34
- publish = false;
35
- }
35
+ if (utils.getType(bio) != "String") {
36
+ bio = "";
37
+ publish = false;
38
+ }
36
39
 
37
- const 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.i_userID || 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.i_userID || ctx.userID
54
- };
40
+ const form = {
41
+ fb_api_caller_class: "RelayModern",
42
+ fb_api_req_friendly_name: "ProfileCometSetBioMutation",
43
+ // This doc_is is valid as of May 23, 2020
44
+ doc_id: "2725043627607610",
45
+ variables: JSON.stringify({
46
+ input: {
47
+ bio: bio,
48
+ publish_bio_feed_story: publish,
49
+ actor_id: ctx.userID,
50
+ client_mutation_id: Math.round(Math.random() * 1024).toString(),
51
+ },
52
+ hasProfileTileViewID: false,
53
+ profileTileViewID: null,
54
+ scale: 1,
55
+ }),
56
+ av: ctx.userID,
57
+ };
55
58
 
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
- }
59
+ defaultFuncs
60
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
61
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
62
+ .then(function (resData) {
63
+ if (resData.errors) {
64
+ throw resData;
65
+ }
67
66
 
68
- return callback();
69
- })
70
- .catch(function (err) {
71
- log.error("changeBio", err);
72
- return callback(err);
73
- });
67
+ return callback();
68
+ })
69
+ .catch(function (err) {
70
+ console.error("changeBio", err);
71
+ return callback(err);
72
+ });
74
73
 
75
- return returnPromise;
76
- };
74
+ return returnPromise;
75
+ };
77
76
  };
@@ -1,47 +1,49 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- const log = require("npmlog");
4
+ // @NethWs3Dev
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
- return function changeBlockedStatus(userID, block, callback) {
8
- let resolveFunc = function () { };
9
- let rejectFunc = function () { };
10
- const returnPromise = new Promise(function (resolve, reject) {
11
- resolveFunc = resolve;
12
- rejectFunc = reject;
13
- });
7
+ return function changeBlockedStatus(userID, block, callback) {
8
+ let resolveFunc = function () {};
9
+ let rejectFunc = function () {};
10
+ const returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
14
 
15
- if (!callback) {
16
- callback = function (err) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc();
21
- };
22
- }
15
+ if (!callback) {
16
+ callback = function (err) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc();
21
+ };
22
+ }
23
23
 
24
- defaultFuncs
25
- .post(
26
- `https://www.facebook.com/messaging/${block ? "" : "un"}block_messages/`,
27
- ctx.jar,
28
- {
29
- fbid: userID
30
- }
31
- )
32
- .then(utils.saveCookies(ctx.jar))
33
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
34
- .then(function (resData) {
35
- if (resData.error) {
36
- throw resData;
37
- }
24
+ defaultFuncs
25
+ .post(
26
+ `https://www.facebook.com/messaging/${
27
+ block ? "" : "un"
28
+ }block_messages/`,
29
+ ctx.jar,
30
+ {
31
+ fbid: userID,
32
+ },
33
+ )
34
+ .then(utils.saveCookies(ctx.jar))
35
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
+ .then(function (resData) {
37
+ if (resData.error) {
38
+ throw resData;
39
+ }
38
40
 
39
- return callback();
40
- })
41
- .catch(function (err) {
42
- log.error("changeBlockedStatus", err);
43
- return callback(err);
44
- });
45
- return returnPromise;
46
- };
41
+ return callback();
42
+ })
43
+ .catch(function (err) {
44
+ console.error("changeBlockedStatus", err);
45
+ return callback(err);
46
+ });
47
+ return returnPromise;
48
+ };
47
49
  };