ws-rapido 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.
Files changed (84) hide show
  1. package/index.js +477 -0
  2. package/package.json +46 -0
  3. package/src/addExternalModule.js +25 -0
  4. package/src/addUserToGroup.js +115 -0
  5. package/src/changeAdminStatus.js +103 -0
  6. package/src/changeArchivedStatus.js +55 -0
  7. package/src/changeAvatar.js +136 -0
  8. package/src/changeAvatarV2.js +86 -0
  9. package/src/changeBio.js +76 -0
  10. package/src/changeBlockedStatus.js +49 -0
  11. package/src/changeBlockedStatusMqtt.js +80 -0
  12. package/src/changeCover.js +72 -0
  13. package/src/changeGroupImage.js +135 -0
  14. package/src/changeName.js +78 -0
  15. package/src/changeNickname.js +59 -0
  16. package/src/changeThreadColor.js +65 -0
  17. package/src/changeThreadEmoji.js +55 -0
  18. package/src/changeUsername.js +58 -0
  19. package/src/createCommentPost.js +229 -0
  20. package/src/createNewGroup.js +88 -0
  21. package/src/createPoll.js +71 -0
  22. package/src/createPost.js +275 -0
  23. package/src/data/getThreadInfo.json +1 -0
  24. package/src/deleteMessage.js +56 -0
  25. package/src/deleteThread.js +56 -0
  26. package/src/editMessage.js +76 -0
  27. package/src/follow.js +74 -0
  28. package/src/forwardAttachment.js +60 -0
  29. package/src/getAccess.js +111 -0
  30. package/src/getAvatarUser.js +78 -0
  31. package/src/getBotInitialData.js +43 -0
  32. package/src/getCtx.js +5 -0
  33. package/src/getCurrentUserID.js +7 -0
  34. package/src/getEmojiUrl.js +29 -0
  35. package/src/getFriendsList.js +83 -0
  36. package/src/getMessage.js +835 -0
  37. package/src/getOptions.js +5 -0
  38. package/src/getRegion.js +7 -0
  39. package/src/getThreadHistory.js +680 -0
  40. package/src/getThreadHistoryDeprecated.js +93 -0
  41. package/src/getThreadInfo.js +227 -0
  42. package/src/getThreadInfoDeprecated.js +80 -0
  43. package/src/getThreadList.js +269 -0
  44. package/src/getThreadListDeprecated.js +75 -0
  45. package/src/getThreadPictures.js +79 -0
  46. package/src/getUID.js +122 -0
  47. package/src/getUserID.js +66 -0
  48. package/src/getUserInfo.js +82 -0
  49. package/src/handleFriendRequest.js +57 -0
  50. package/src/handleMessageRequest.js +65 -0
  51. package/src/httpGet.js +64 -0
  52. package/src/httpPost.js +64 -0
  53. package/src/httpPostFormData.js +70 -0
  54. package/src/listenMqtt.js +674 -0
  55. package/src/listenNotification.js +85 -0
  56. package/src/logout.js +75 -0
  57. package/src/markAsDelivered.js +55 -0
  58. package/src/markAsRead.js +85 -0
  59. package/src/markAsReadAll.js +50 -0
  60. package/src/markAsSeen.js +61 -0
  61. package/src/muteThread.js +52 -0
  62. package/src/pinMessage.js +59 -0
  63. package/src/refreshFb_dtsg.js +89 -0
  64. package/src/removeUserFromGroup.js +79 -0
  65. package/src/resolvePhotoUrl.js +45 -0
  66. package/src/searchForThread.js +53 -0
  67. package/src/searchStickers.js +53 -0
  68. package/src/sendMessage.js +442 -0
  69. package/src/sendMessageMqtt.js +316 -0
  70. package/src/sendTypingIndicator.js +28 -0
  71. package/src/setMessageReaction.js +122 -0
  72. package/src/setMessageReactionMqtt.js +62 -0
  73. package/src/setPostReaction.js +108 -0
  74. package/src/setProfileGuard.js +44 -0
  75. package/src/setStoryReaction.js +64 -0
  76. package/src/setTitle.js +90 -0
  77. package/src/shareContact.js +110 -0
  78. package/src/shareLink.js +59 -0
  79. package/src/stopListenMqtt.js +23 -0
  80. package/src/threadColors.js +131 -0
  81. package/src/unfriend.js +52 -0
  82. package/src/unsendMessage.js +45 -0
  83. package/src/uploadAttachment.js +94 -0
  84. package/utils.js +1441 -0
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+ // @NethWs3Dev
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function changeAdminStatus(threadID, adminIDs, adminStatus, callback) {
8
+ if (utils.getType(threadID) !== "String") {
9
+ throw new utils.CustomError({
10
+ error: "changeAdminStatus: threadID must be a string",
11
+ });
12
+ }
13
+
14
+ if (utils.getType(adminIDs) === "String") {
15
+ adminIDs = [adminIDs];
16
+ }
17
+
18
+ if (utils.getType(adminIDs) !== "Array") {
19
+ throw new utils.CustomError({
20
+ error: "changeAdminStatus: adminIDs must be an array or string",
21
+ });
22
+ }
23
+
24
+ if (utils.getType(adminStatus) !== "Boolean") {
25
+ throw new utils.CustomError({
26
+ error: "changeAdminStatus: adminStatus must be a string",
27
+ });
28
+ }
29
+
30
+ let resolveFunc = function () {};
31
+ let rejectFunc = function () {};
32
+ const returnPromise = new Promise(function (resolve, reject) {
33
+ resolveFunc = resolve;
34
+ rejectFunc = reject;
35
+ });
36
+
37
+ if (!callback) {
38
+ callback = function (err) {
39
+ if (err) {
40
+ return rejectFunc(err);
41
+ }
42
+ resolveFunc();
43
+ };
44
+ }
45
+
46
+ if (
47
+ utils.getType(callback) !== "Function" &&
48
+ utils.getType(callback) !== "AsyncFunction"
49
+ ) {
50
+ throw new utils.CustomError({
51
+ error: "changeAdminStatus: callback is not a function",
52
+ });
53
+ }
54
+
55
+ const form = {
56
+ thread_fbid: threadID,
57
+ };
58
+
59
+ let i = 0;
60
+ for (const u of adminIDs) {
61
+ form[`admin_ids[${i++}]`] = u;
62
+ }
63
+ form["add"] = adminStatus;
64
+
65
+ defaultFuncs
66
+ .post(
67
+ "https://www.facebook.com/messaging/save_admins/?dpr=1",
68
+ ctx.jar,
69
+ form,
70
+ )
71
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
72
+ .then(function (resData) {
73
+ if (resData.error) {
74
+ switch (resData.error) {
75
+ case 1976004:
76
+ throw new utils.CustomError({
77
+ error: "Cannot alter admin status: you are not an admin.",
78
+ rawResponse: resData,
79
+ });
80
+ case 1357031:
81
+ throw new utils.CustomError({
82
+ error:
83
+ "Cannot alter admin status: this thread is not a group chat.",
84
+ rawResponse: resData,
85
+ });
86
+ default:
87
+ throw new utils.CustomError({
88
+ error: "Cannot alter admin status: unknown error.",
89
+ rawResponse: resData,
90
+ });
91
+ }
92
+ }
93
+
94
+ callback();
95
+ })
96
+ .catch(function (err) {
97
+ utils.error("changeAdminStatus", err);
98
+ return callback(err);
99
+ });
100
+
101
+ return returnPromise;
102
+ };
103
+ };
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+ // @NethWs3Dev
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function changeArchivedStatus(threadOrThreads, archive, 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
+
15
+ if (!callback) {
16
+ callback = function (err) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc();
21
+ };
22
+ }
23
+
24
+ const form = {};
25
+
26
+ if (utils.getType(threadOrThreads) === "Array") {
27
+ for (let 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
+ utils.error("changeArchivedStatus", err);
50
+ return callback(err);
51
+ });
52
+
53
+ return returnPromise;
54
+ };
55
+ };
@@ -0,0 +1,136 @@
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
+ utils.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
+ utils.error("changeAvatar", err);
130
+ return callback(err);
131
+ });
132
+ });
133
+
134
+ return returnPromise;
135
+ };
136
+ };
@@ -0,0 +1,86 @@
1
+
2
+ "use strict";
3
+
4
+ var utils = require("../utils");
5
+ // @NethWs3Dev
6
+ /**
7
+ * It posts an image to a Facebook profile
8
+ * @param Api - The API object
9
+ * @param BotID - The ID of the bot you want to post the image to.
10
+ * @param form - The form data that you want to send.
11
+ * @returns The JSON.parse(Data.split("for (;;);")[1]); is returning the following:
12
+ * {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
13
+ */
14
+ async function postImage(Api, BotID, form) {
15
+ var Data = await Api.httpPostFormData(`https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`, form);
16
+ return JSON.parse(Data.split("for (;;);")[1]);
17
+ }
18
+
19
+ module.exports = function(defaultFuncs, api, ctx) {
20
+ /* Changing the profile picture of the bot. */
21
+ return function changeAvt(link, caption, callback) {
22
+ var resolveFunc = function() {};
23
+ var rejectFunc = function() {};
24
+ var returnPromise = new Promise(function(resolve, reject) {
25
+ resolveFunc = resolve;
26
+ rejectFunc = reject;
27
+ });
28
+
29
+ if (!callback) {
30
+ callback = function(err, data) {
31
+ if (err) return rejectFunc(err);
32
+ resolveFunc(data);
33
+ };
34
+ }
35
+ try {
36
+ var Fetch = require('axios')
37
+ Fetch.get(link, { responseType: "stream" }).then(data => {
38
+ postImage(api, ctx.userID, { file: data.data }).then(data => {
39
+ if (data.error) throw new Error({ error: data.error, des: data.error.errorDescription });
40
+ var form = {
41
+ av: ctx.userID,
42
+ fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
43
+ fb_api_caller_class: "RelayModern",
44
+ doc_id: "5066134240065849",
45
+ variables: JSON.stringify({
46
+ input: {
47
+ caption: (caption || ""),
48
+ existing_photo_id: data.payload.fbid,
49
+ expiration_time: null,
50
+ profile_id: ctx.userID,
51
+ profile_pic_method: "EXISTING",
52
+ profile_pic_source: "TIMELINE",
53
+ scaled_crop_rect: {
54
+ height: 1,
55
+ width: 1,
56
+ x: 0,
57
+ y: 0
58
+ },
59
+ skip_cropping: true,
60
+ actor_id: ctx.userID,
61
+ client_mutation_id: Math.round(Math.random() * 19).toString()
62
+ },
63
+ isPage: false,
64
+ isProfile: true,
65
+ scale: 3,
66
+ })
67
+ };
68
+ defaultFuncs
69
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
70
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
71
+ .then(function(resData) {
72
+ if (resData.error) throw resData;
73
+ else return callback(null,true)
74
+ })
75
+ .catch(function(err) {
76
+ return callback(err);
77
+ });
78
+ })
79
+ })
80
+ }
81
+ catch (e) {
82
+ throw e;
83
+ }
84
+ return returnPromise;
85
+ };
86
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+ // @NethWs3Dev
5
+
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
+ });
14
+
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
+ }
30
+
31
+ if (utils.getType(publish) != "Boolean") {
32
+ publish = false;
33
+ }
34
+
35
+ if (utils.getType(bio) != "String") {
36
+ bio = "";
37
+ publish = false;
38
+ }
39
+
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
+ };
58
+
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
+ }
66
+
67
+ return callback();
68
+ })
69
+ .catch(function (err) {
70
+ utils.error("changeBio", err);
71
+ return callback(err);
72
+ });
73
+
74
+ return returnPromise;
75
+ };
76
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+ // @NethWs3Dev
5
+
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
+ });
14
+
15
+ if (!callback) {
16
+ callback = function (err) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc();
21
+ };
22
+ }
23
+
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
+ }
40
+
41
+ return callback();
42
+ })
43
+ .catch(function (err) {
44
+ utils.error("changeBlockedStatus", err);
45
+ return callback(err);
46
+ });
47
+ return returnPromise;
48
+ };
49
+ };
@@ -0,0 +1,80 @@
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
+ };
@@ -0,0 +1,72 @@
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
+ utils.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
+ utils.error('changeCover', err);
66
+ return cb(err);
67
+ });
68
+ }
69
+
70
+ return rt;
71
+ }
72
+ }