fca-arif-babu 1.0.20

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 (87) hide show
  1. package/.github/workflows/publish.yml +20 -0
  2. package/LICENSE-MIT +21 -0
  3. package/README.md +20 -0
  4. package/index.js +489 -0
  5. package/package.json +47 -0
  6. package/replit.nix +3 -0
  7. package/src/addExternalModule.js +25 -0
  8. package/src/addUserToGroup.js +115 -0
  9. package/src/changeAdminStatus.js +103 -0
  10. package/src/changeArchivedStatus.js +55 -0
  11. package/src/changeAvatar.js +136 -0
  12. package/src/changeAvatarV2.js +86 -0
  13. package/src/changeBio.js +76 -0
  14. package/src/changeBlockedStatus.js +49 -0
  15. package/src/changeBlockedStatusMqtt.js +80 -0
  16. package/src/changeCover.js +72 -0
  17. package/src/changeGroupImage.js +135 -0
  18. package/src/changeName.js +78 -0
  19. package/src/changeNickname.js +59 -0
  20. package/src/changeThreadColor.js +65 -0
  21. package/src/changeThreadEmoji.js +55 -0
  22. package/src/changeUsername.js +58 -0
  23. package/src/createCommentPost.js +229 -0
  24. package/src/createNewGroup.js +88 -0
  25. package/src/createPoll.js +71 -0
  26. package/src/createPost.js +275 -0
  27. package/src/data/getThreadInfo.json +1 -0
  28. package/src/deleteMessage.js +56 -0
  29. package/src/deleteThread.js +56 -0
  30. package/src/editMessage.js +59 -0
  31. package/src/editMessageOld.js +67 -0
  32. package/src/follow.js +74 -0
  33. package/src/forwardAttachment.js +60 -0
  34. package/src/getAccess.js +112 -0
  35. package/src/getAvatarUser.js +78 -0
  36. package/src/getBotInitialData.js +42 -0
  37. package/src/getCurrentUserID.js +7 -0
  38. package/src/getEmojiUrl.js +29 -0
  39. package/src/getFriendsList.js +83 -0
  40. package/src/getMessage.js +835 -0
  41. package/src/getRegion.js +7 -0
  42. package/src/getThreadHistory.js +680 -0
  43. package/src/getThreadHistoryDeprecated.js +93 -0
  44. package/src/getThreadInfo.js +227 -0
  45. package/src/getThreadInfoDeprecated.js +80 -0
  46. package/src/getThreadList.js +270 -0
  47. package/src/getThreadListDeprecated.js +75 -0
  48. package/src/getThreadPictures.js +79 -0
  49. package/src/getUID.js +122 -0
  50. package/src/getUserID.js +66 -0
  51. package/src/getUserInfo.js +71 -0
  52. package/src/handleFriendRequest.js +57 -0
  53. package/src/handleMessageRequest.js +65 -0
  54. package/src/httpGet.js +64 -0
  55. package/src/httpPost.js +64 -0
  56. package/src/httpPostFormData.js +70 -0
  57. package/src/listenMqtt.js +703 -0
  58. package/src/listenNotification.js +85 -0
  59. package/src/logout.js +75 -0
  60. package/src/markAsDelivered.js +55 -0
  61. package/src/markAsRead.js +85 -0
  62. package/src/markAsReadAll.js +50 -0
  63. package/src/markAsSeen.js +61 -0
  64. package/src/muteThread.js +52 -0
  65. package/src/pinMessage.js +59 -0
  66. package/src/refreshFb_dtsg.js +89 -0
  67. package/src/removeUserFromGroup.js +79 -0
  68. package/src/resolvePhotoUrl.js +45 -0
  69. package/src/searchForThread.js +53 -0
  70. package/src/searchStickers.js +53 -0
  71. package/src/sendMessage.js +442 -0
  72. package/src/sendMessageMqtt.js +316 -0
  73. package/src/sendTypingIndicator.js +28 -0
  74. package/src/setMessageReaction.js +122 -0
  75. package/src/setMessageReactionMqtt.js +62 -0
  76. package/src/setPostReaction.js +112 -0
  77. package/src/setProfileGuard.js +44 -0
  78. package/src/setStoryReaction.js +64 -0
  79. package/src/setTitle.js +90 -0
  80. package/src/shareContact.js +110 -0
  81. package/src/shareLink.js +59 -0
  82. package/src/stopListenMqtt.js +23 -0
  83. package/src/threadColors.js +131 -0
  84. package/src/unfriend.js +52 -0
  85. package/src/unsendMessage.js +45 -0
  86. package/src/uploadAttachment.js +94 -0
  87. package/utils.js +1416 -0
@@ -0,0 +1,229 @@
1
+ 'use strict';
2
+
3
+ var utils = require('../utils.js');
4
+
5
+ module.exports = function (defaultFuncs, api, ctx) {
6
+ function handleUpload(msg, form) {
7
+ var cb;
8
+ var uploads = [];
9
+ var returnPromise = new Promise(function (resolve, reject) {
10
+ cb = error => error ? reject(error) : resolve();
11
+ });
12
+
13
+ for (let item of msg.attachments) {
14
+ if (!utils.isReadableStream(item))
15
+ return cb({ error: 'image should be a readable stream and not ' + utils.getType(image) });
16
+
17
+ var httpData = defaultFuncs
18
+ .postFormData('https://www.facebook.com/ajax/ufi/upload/', ctx.jar, {
19
+ profile_id: ctx.userID,
20
+ source: 19,
21
+ target_id: ctx.userID,
22
+ file: item
23
+ })
24
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
25
+ .then(function (res) {
26
+ if (res.errors || res.error || !res.payload)
27
+ throw res;
28
+
29
+ return {
30
+ media: {
31
+ id: res.payload.fbid
32
+ }
33
+ }
34
+ })
35
+ .catch(cb);
36
+
37
+ uploads.push(httpData);
38
+ }
39
+
40
+ Promise
41
+ .all(uploads)
42
+ .then(function (main) {
43
+ main.forEach(item => form.input.attachments.push(item));
44
+
45
+ return cb();
46
+ })
47
+ .catch(cb);
48
+
49
+ return returnPromise;
50
+ }
51
+
52
+ function handleURL(msg, form) {
53
+ if (typeof msg.url == 'string') {
54
+ form.input.attachments = [
55
+ {
56
+ link: {
57
+ external: {
58
+ url: msg.url
59
+ }
60
+ }
61
+ }
62
+ ];
63
+ }
64
+ }
65
+
66
+ function handleMentions(msg, form) {
67
+ for (let item of msg.mentions) {
68
+ var { tag, id, fromIndex } = item;
69
+
70
+ if (typeof tag != 'string')
71
+ throw 'Mention tag must be string';
72
+ if (!id)
73
+ throw 'id must be string';
74
+ var offset = msg.body.indexOf(tag, fromIndex || 0);
75
+ if (offset < 0)
76
+ throw 'Mention for "' + tag + '" not found in message string.';
77
+ form.input.message.ranges.push({
78
+ entity: { id },
79
+ length: tag.length,
80
+ offset
81
+ });
82
+ }
83
+ }
84
+
85
+ function handleSticker(msg, form) {
86
+ if (msg.sticker) {
87
+ form.input.attachments = [
88
+ {
89
+ media: {
90
+ id: msg.sticker
91
+ }
92
+ }
93
+ ];
94
+ }
95
+ }
96
+
97
+ function createContent(form) {
98
+ var cb;
99
+ var returnPromise = new Promise(function (resolve, reject) {
100
+ cb = (error, info) => info ? resolve(info) : reject(error);
101
+ });
102
+
103
+ defaultFuncs
104
+ .post('https://www.facebook.com/api/graphql/', ctx.jar, {
105
+ fb_api_caller_class: 'RelayModern',
106
+ fb_api_req_friendly_name: 'useCometUFICreateCommentMutation',
107
+ variables: JSON.stringify(form),
108
+ server_timestamps: !0,
109
+ doc_id: 6993516810709754
110
+ })
111
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
112
+ .then(function (res) {
113
+ if (res.errors)
114
+ throw res;
115
+
116
+ var res = res.data.comment_create;
117
+ var info = {
118
+ id: res.feedback_comment_edge.node.id,
119
+ url: res.feedback_comment_edge.node.feedback.url,
120
+ count: res.feedback.total_comment_count
121
+ }
122
+ return cb(null, info);
123
+ })
124
+ .catch(cb);
125
+
126
+ return returnPromise;
127
+ }
128
+
129
+ return function createCommentPost(msg, postID, callback, replyCommentID) {
130
+ var cb;
131
+ var returnPromise = new Promise(function (resolve, reject) {
132
+ cb = (error, info) => info ? resolve(info) : reject(error);
133
+ });
134
+
135
+ if (typeof msg == 'function') {
136
+ var error = 'Message must be a string or object!!';
137
+ console.error('createCommentPost', error);
138
+ return msg(error);
139
+ }
140
+ if (typeof postID == 'function') {
141
+ var error = 'postID must be a string!!';
142
+ console.error('createCommentPost', error);
143
+ return postID(error);
144
+ }
145
+ if (typeof callback == 'string') {
146
+ replyCommentID = callback;
147
+ callback = null;
148
+ }
149
+ if (typeof callback == 'function')
150
+ cb = calback;
151
+
152
+ var MessageType = utils.getType(msg);
153
+
154
+ if (MessageType == 'String')
155
+ msg = {
156
+ body: msg,
157
+ attachments: [],
158
+ mentions: [],
159
+ sticker: null,
160
+ url: null
161
+ }
162
+ else if (MessageType == 'Object') {
163
+ msg.mentions ? !Array.isArray(msg.mentions) ? msg.mentions = [msg.mentions] : null : msg.mentions = [];
164
+ msg.attachments ? !Array.isArray(msg.attachments) ? msg.attachments = [msg.attachments] : null : msg.attachments = [];
165
+ isNaN(msg.sticker) ? msg.sticker = null : null;
166
+ msg.body ? typeof msg.body == 'object' ? msg.body = JSON.stringify(msg.body) : null : msg.body = '';
167
+ } else {
168
+ var error = 'Message must be a string or object!!';
169
+ console.error('createCommentPost', error);
170
+ return cb(error);
171
+ }
172
+ if (typeof postID != 'string') {
173
+ var error = 'postID must be a string!!';
174
+ console.error('createCommentPost', error);
175
+ return cb(error);
176
+ }
177
+
178
+ if (typeof replyCommentID != 'string')
179
+ replyCommentID = null;
180
+
181
+ var form = {
182
+ feedLocation: 'NEWSFEED',
183
+ feedbackSource: 1,
184
+ groupID: null,
185
+ input: {
186
+ client_mutation_id: Math.round(Math.random() * 19).toString(),
187
+ actor_id: ctx.userID,
188
+ attachments: [],
189
+ feedback_id: Buffer.from('feedback:' + postID).toString('base64'),
190
+ formatting_style: null,
191
+ message: {
192
+ ranges: [],
193
+ text: msg.body
194
+ },
195
+ reply_comment_parent_fbid: replyCommentID ? isNaN(replyCommentID) ? replyCommentID : Buffer.from('comment:' + postID + '_' + replyCommentID).toString('base64') : null,
196
+ reply_target_clicked: !!replyCommentID,
197
+ attribution_id_v2:
198
+ 'CometHomeRoot.react,comet.home,via_cold_start,'
199
+ + Date.now()
200
+ + ',156248,4748854339,,',
201
+ vod_video_timestamp: null,
202
+ feedback_referrer: '/',
203
+ is_tracking_encrypted: !0,
204
+ tracking: [],
205
+ feedback_source: 'NEWS_FEED',
206
+ idempotence_token: 'client:' + utils.getGUID(),
207
+ session_id: utils.getGUID()
208
+ },
209
+ inviteShortLinkKey: null,
210
+ renderLocation: null,
211
+ scale: 1,
212
+ useDefaultActor: !1,
213
+ focusCommentID: null
214
+ }
215
+
216
+ handleUpload(msg, form)
217
+ .then(_ => handleURL(msg, form))
218
+ .then(_ => handleMentions(msg, form))
219
+ .then(_ => handleSticker(msg, form))
220
+ .then(_ => createContent(form))
221
+ .then(info => cb(null, info))
222
+ .catch(function (err) {
223
+ console.error('createCommentPost', err);
224
+ return cb(null, err);
225
+ })
226
+
227
+ return returnPromise;
228
+ }
229
+ }
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+ // @NethWs3Dev
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function createNewGroup(participantIDs, groupTitle, callback) {
8
+ if (utils.getType(groupTitle) == "Function") {
9
+ callback = groupTitle;
10
+ groupTitle = null;
11
+ }
12
+
13
+ if (utils.getType(participantIDs) !== "Array") {
14
+ throw { error: "createNewGroup: participantIDs should be an array." };//
15
+ }
16
+
17
+ if (participantIDs.length < 2) {
18
+ throw {
19
+ error: "createNewGroup: participantIDs should have at least 2 IDs.",
20
+ };
21
+ }
22
+
23
+ let resolveFunc = function () {};
24
+ let rejectFunc = function () {};
25
+ const returnPromise = new Promise(function (resolve, reject) {
26
+ resolveFunc = resolve;
27
+ rejectFunc = reject;
28
+ });
29
+
30
+ if (!callback) {
31
+ callback = function (err, threadID) {
32
+ if (err) {
33
+ return rejectFunc(err);
34
+ }
35
+ resolveFunc(threadID);
36
+ };
37
+ }
38
+
39
+ const pids = [];
40
+ for (const n in participantIDs) {
41
+ pids.push({
42
+ fbid: participantIDs[n],
43
+ });
44
+ }
45
+ pids.push({ fbid: ctx.userID });
46
+
47
+ const form = {
48
+ fb_api_caller_class: "RelayModern",
49
+ fb_api_req_friendly_name: "MessengerGroupCreateMutation",
50
+ av: ctx.userID,
51
+ //This doc_id is valid as of January 11th, 2020
52
+ doc_id: "577041672419534",
53
+ variables: JSON.stringify({
54
+ input: {
55
+ entry_point: "jewel_new_group",
56
+ actor_id: ctx.userID,
57
+ participants: pids,
58
+ client_mutation_id: Math.round(Math.random() * 1024).toString(),
59
+ thread_settings: {
60
+ name: groupTitle,
61
+ joinable_mode: "PRIVATE",
62
+ thread_image_fbid: null,
63
+ },
64
+ },
65
+ }),
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.errors) {
73
+ throw resData;
74
+ }
75
+ return callback(
76
+ null,
77
+ resData.data.messenger_group_thread_create.thread.thread_key
78
+ .thread_fbid,
79
+ );
80
+ })
81
+ .catch(function (err) {
82
+ console.error("createNewGroup", err);
83
+ return callback(err);
84
+ });
85
+
86
+ return returnPromise;
87
+ };
88
+ };
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+ // @NethWs3Dev
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function createPoll(title, threadID, options, 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 (utils.getType(options) == "Function") {
17
+ callback = options;
18
+ options = null;
19
+ } else {
20
+ callback = function (err) {
21
+ if (err) {
22
+ return rejectFunc(err);
23
+ }
24
+ resolveFunc();
25
+ };
26
+ }
27
+ }
28
+ if (!options) {
29
+ options = {}; // Initial poll options are optional
30
+ }
31
+
32
+ const form = {
33
+ target_id: threadID,
34
+ question_text: title,
35
+ };
36
+
37
+ // Set fields for options (and whether they are selected initially by the posting user)
38
+ let ind = 0;
39
+ for (const opt in options) {
40
+ // eslint-disable-next-line no-prototype-builtins
41
+ if (options.hasOwnProperty(opt)) {
42
+ form["option_text_array[" + ind + "]"] = opt;
43
+ form["option_is_selected_array[" + ind + "]"] = options[opt]
44
+ ? "1"
45
+ : "0";
46
+ ind++;
47
+ }
48
+ }
49
+
50
+ defaultFuncs
51
+ .post(
52
+ "https://www.facebook.com/messaging/group_polling/create_poll/?dpr=1",
53
+ ctx.jar,
54
+ form,
55
+ )
56
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
57
+ .then(function (resData) {
58
+ if (resData.payload.status != "success") {
59
+ throw resData;
60
+ }
61
+
62
+ return callback();
63
+ })
64
+ .catch(function (err) {
65
+ console.error("createPoll", err);
66
+ return callback(err);
67
+ });
68
+
69
+ return returnPromise;
70
+ };
71
+ };
@@ -0,0 +1,275 @@
1
+ 'use strict';
2
+
3
+ var utils = require('../utils');
4
+
5
+ module.exports = function (defaultFuncs, api, ctx) {
6
+ function handleUpload(msg, form) {
7
+ var cb;
8
+ var rt = new Promise(function (resolve, reject) {
9
+ cb = error => error ? reject(error) : resolve();
10
+ });
11
+
12
+ if (!msg.attachment) cb();
13
+ else {
14
+ msg.attachment = Array.isArray(msg.attachment) ? msg.attachment : [msg.attachment];
15
+ let uploads = [];
16
+ for (let attachment of msg.attachment) {
17
+ if (!utils.isReadableStream(attachment))
18
+ cb('Attachment should be a readable stream, not ' + utils.getType(attachment));
19
+
20
+ var vari = {
21
+ source: 8,
22
+ profile_id: ctx.userID,
23
+ waterfallxapp: 'comet',
24
+ farr: attachment,
25
+ upload_id: 'jsc_c_6'
26
+ }
27
+ var main = defaultFuncs
28
+ .postFormData('https://upload.facebook.com/ajax/react_composer/attachments/photo/upload', ctx.jar, vari)
29
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
30
+ .then(function (res) {
31
+ if (res.error || res.errors)
32
+ throw res;
33
+
34
+ return res.payload;
35
+ });
36
+
37
+ uploads.push(main);
38
+ }
39
+
40
+ Promise
41
+ .all(uploads)
42
+ .then(function (res) {
43
+ for (let payload of res) {
44
+ if (!payload) break;
45
+ form.input.attachments.push({
46
+ photo: {
47
+ id: payload.photoID
48
+ }
49
+ });
50
+ }
51
+
52
+ return cb();
53
+ })
54
+ .catch(cb);
55
+ }
56
+
57
+ return rt;
58
+ }
59
+
60
+ function handleUrl(msg, form) {
61
+ var cb;
62
+ var rt = new Promise(function (resolve, reject) {
63
+ cb = error => error ? reject(error) : resolve();
64
+ });
65
+
66
+ if (!msg.url) cb();
67
+ else {
68
+ var vari = {
69
+ feedLocation: "FEED_COMPOSER",
70
+ focusCommentID: null,
71
+ goodwillCampaignId: "",
72
+ goodwillCampaignMediaIds: [],
73
+ goodwillContentType: null,
74
+ params: {
75
+ url: msg.url
76
+ },
77
+ privacySelectorRenderLocation: "COMET_COMPOSER",
78
+ renderLocation: "composer_preview",
79
+ parentStoryID: null,
80
+ scale: 1,
81
+ useDefaultActor: false,
82
+ shouldIncludeStoryAttachment: false,
83
+ __relay_internal__pv__IsWorkUserrelayprovider: false,
84
+ __relay_internal__pv__IsMergQAPollsrelayprovider: false
85
+ }
86
+
87
+ defaultFuncs
88
+ .post('https://www.facebook.com/api/graphql/', ctx.jar, {
89
+ fb_api_req_friendly_name: 'ComposerLinkAttachmentPreviewQuery',
90
+ variables: JSON.stringify(vari),
91
+ server_timestamps: true,
92
+ doc_id: 6549975235094234
93
+ })
94
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
95
+ .then(function (res) {
96
+ var res = (res[0] || res).data.link_preview;
97
+ if (JSON.parse(res.share_scrape_data).share_type == 400)
98
+ throw { error: 'url is not accepted' }
99
+
100
+ form.input.attachments.push({
101
+ link: {
102
+ share_scrape_data: res.share_scrape_data
103
+ }
104
+ });
105
+
106
+ return cb();
107
+ })
108
+ .catch(cb);
109
+ }
110
+
111
+ return rt;
112
+ }
113
+
114
+ function handleMention(msg, form) {
115
+ if (!msg.mentions) return;
116
+
117
+ msg.mentions = Array.isArray(msg.mentions) ? msg.mentions : [msg.mentions];
118
+ for (let mention of msg.mentions) {
119
+ var { id, tag, fromIndex } = mention;
120
+
121
+ if (typeof tag != 'string')
122
+ throw 'Mention tag must be string';
123
+ if (!id)
124
+ throw 'id must be string';
125
+ var offset = msg.body.indexOf(tag, fromIndex || 0);
126
+ if (offset < 0)
127
+ throw 'Mention for "' + tag + '" not found in message string.';
128
+ form.input.message.ranges.push({
129
+ entity: { id },
130
+ length: tag.length,
131
+ offset
132
+ });
133
+ }
134
+ }
135
+
136
+ function createContent(vari) {
137
+ var cb;
138
+ var rt = new Promise(function (resolve, reject) {
139
+ cb = (error, postData) => error ? reject(error) : resolve(postData);
140
+ });
141
+
142
+ var form = {
143
+ fb_api_req_friendly_name: 'ComposerStoryCreateMutation',
144
+ variables: JSON.stringify(vari),
145
+ server_timestamps: true,
146
+ doc_id: 6255089511280268
147
+ }
148
+
149
+ defaultFuncs
150
+ .post('https://www.facebook.com/api/graphql/', ctx.jar, form)
151
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
152
+ .then(res => cb(null, res))
153
+ .catch(cb);
154
+
155
+ return rt;
156
+ }
157
+
158
+ return function createPost(msg, callback) {
159
+ var cb;
160
+ var rt = new Promise(function (resolve, reject) {
161
+ cb = (error, url) => url ? resolve(url) : reject(error);
162
+ });
163
+
164
+ if (typeof msg == 'function') {
165
+ var error = 'Msg must be a string or object and not function';
166
+ console.error('createPost', error);
167
+ return msg(error);
168
+ }
169
+ if (typeof callback == 'function') cb = callback;
170
+
171
+ var typeMsg = utils.getType(msg);
172
+ if (!['Object', 'String'].includes(typeMsg)) {
173
+ var error = 'Msg must be a string or object and not ' + typeMsg;
174
+ console.error('createPost', error);
175
+ return cb(error);
176
+ } else if (typeMsg == 'String') msg = { body: msg };
177
+ msg.allowUserID = msg.allowUserID ? !Array.isArray(msg.allowUserID) ? [msg.allowUserID] : msg.allowUserID : null;
178
+
179
+ var sessionID = utils.getGUID();
180
+ var base = [
181
+ 'EVERYONE',
182
+ 'FRIENDS',
183
+ 'SELF'
184
+ ];
185
+ var form = {
186
+ input: {
187
+ composer_entry_point: !msg.groupID && msg.url ? 'share_modal' : "inline_composer",
188
+ composer_source_surface: !msg.groupID && msg.url ? 'feed_story' : msg.groupID ? "group" : "timeline",
189
+ composer_type: !msg.groupID && msg.url ? 'share' : msg.groupID ? "group" : "timeline",
190
+ idempotence_token: sessionID + "_FEED",
191
+ source: "WWW",
192
+ attachments: [],
193
+ audience: msg.groupID ? {
194
+ to_id: msg.groupID
195
+ } : {
196
+ privacy: {
197
+ allow: msg.allowUserID ? msg.allowUserID : [],
198
+ base_state: msg.allowUserID && msg.allowUserID.length > 0 ? base[2] : (base[msg.baseState - 1] || base[0]),
199
+ deny: [],
200
+ tag_expansion_state: "UNSPECIFIED"
201
+ }
202
+ },
203
+ message: {
204
+ ranges: [],
205
+ text: msg.body ? typeof msg.body == 'object' ? JSON.stringify(msg.body, null, 2) : msg.body : ''
206
+ },
207
+ with_tags_ids: [],
208
+ inline_activities: [],
209
+ explicit_place_id: 0,
210
+ text_format_preset_id: 0,
211
+ logging: {
212
+ composer_session_id: sessionID
213
+ },
214
+ navigation_data: {
215
+ attribution_id_v2: msg.groupID ? "CometGroupDiscussionRoot.react,comet.group,tap_search_bar," + Date.now() + ",909538,2361831622," : "ProfileCometTimelineListViewRoot.react,comet.profile.timeline.list,via_cold_start," + Date.now() + ",796829,190055527696468,"
216
+ },
217
+ is_tracking_encrypted: !!msg.url,
218
+ tracking: [],
219
+ event_share_metadata: {
220
+ surface: "newsfeed"
221
+ },
222
+ actor_id: ctx.globalOptions.pageID || ctx.userID,
223
+ client_mutation_id: Math.round(Math.random() * 19).toString()
224
+ },
225
+ displayCommentsFeedbackContext: null,
226
+ displayCommentsContextEnableComment: null,
227
+ displayCommentsContextIsAdPreview: null,
228
+ displayCommentsContextIsAggregatedShare: null,
229
+ displayCommentsContextIsStorySet: null,
230
+ feedLocation: msg.groupID ? "GROUP" : "TIMELINE",
231
+ feedbackSource: 0,
232
+ focusCommentID: null,
233
+ gridMediaWidth: 230,
234
+ groupID: null,
235
+ scale: 1,
236
+ privacySelectorRenderLocation: "COMET_STREAM",
237
+ renderLocation: msg.groupID ? "group" : "timeline",
238
+ useDefaultActor: false,
239
+ inviteShortLinkKey: null,
240
+ isFeed: false,
241
+ isFundraiser: false,
242
+ isFunFactPost: false,
243
+ isGroup: !!msg.groupID,
244
+ isEvent: false,
245
+ isTimeline: !msg.groupID,
246
+ isSocialLearning: false,
247
+ isPageNewsFeed: !!ctx.globalOptions.pageID,
248
+ isProfileReviews: false,
249
+ isWorkSharedDraft: false,
250
+ UFI2CommentsProvider_commentsKey: msg.groupID ? "CometGroupDiscussionRootSuccessQuery" : "ProfileCometTimelineRoute",
251
+ hashtag: null,
252
+ canUserManageOffers: false,
253
+ __relay_internal__pv__CometUFIIsRTAEnabledrelayprovider: false,
254
+ __relay_internal__pv__IsWorkUserrelayprovider: false,
255
+ __relay_internal__pv__IsMergQAPollsrelayprovider: false,
256
+ __relay_internal__pv__StoriesArmadilloReplyEnabledrelayprovider: false,
257
+ __relay_internal__pv__StoriesRingrelayprovider: false
258
+ }
259
+
260
+ handleUpload(msg, form)
261
+ .then(_ => handleUrl(msg, form))
262
+ .then(_ => handleMention(msg, form))
263
+ .then(_ => createContent(form))
264
+ .then((res) => {
265
+ if (res.error || res.errors) throw res;
266
+ return cb(null, (res[0] || res).data.story_create.story.url);
267
+ })
268
+ .catch((err) => {
269
+ //console.error('createPost', err);
270
+ return cb(err);
271
+ });
272
+
273
+ return rt;
274
+ }
275
+ }
@@ -0,0 +1 @@
1
+ []