fca-smart-shankar 13.0.0 → 16.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 (169) hide show
  1. package/.cache/replit/env/latest +56 -0
  2. package/.cache/replit/env/latest.json +1 -0
  3. package/.cache/replit/modules/nodejs-14.res +1 -0
  4. package/.cache/replit/modules/replit.res +1 -0
  5. package/.cache/replit/modules/web.res +1 -0
  6. package/.cache/replit/modules.stamp +0 -0
  7. package/.cache/typescript/5.5/package.json +1 -0
  8. package/.config/configstore/update-notifier-npm.json +4 -0
  9. package/.gitattributes +2 -0
  10. package/.replit +3 -12
  11. package/.upm/store.json +1 -1
  12. package/Extra/Balancer.js +49 -0
  13. package/Extra/Bypass/956/index.js +234 -0
  14. package/Extra/Bypass/test/aaaa.json +170 -0
  15. package/Extra/Bypass/test/index.js +188 -0
  16. package/Extra/Database/index.js +469 -0
  17. package/Extra/ExtraAddons.js +82 -0
  18. package/Extra/ExtraFindUID.js +62 -0
  19. package/Extra/ExtraGetThread.js +365 -0
  20. package/Extra/ExtraScreenShot.js +430 -0
  21. package/Extra/ExtraUptimeRobot.js +38 -0
  22. package/Extra/Html/Classic/script.js +119 -0
  23. package/Extra/Html/Classic/style.css +8 -0
  24. package/Extra/Security/AES_256_GCM/index.js +0 -0
  25. package/Extra/Security/Base/Step_1.js +6 -0
  26. package/Extra/Security/Base/Step_2.js +22 -0
  27. package/Extra/Security/Base/Step_3.js +22 -0
  28. package/Extra/Security/Base/index.js +191 -0
  29. package/Extra/Security/Index.js +5 -0
  30. package/Extra/Security/Step_1.js +6 -0
  31. package/Extra/Security/Step_2.js +22 -0
  32. package/Extra/Security/Step_3.js +22 -0
  33. package/Extra/Src/Change_Environment.js +24 -0
  34. package/Extra/Src/Check_Update.js +67 -0
  35. package/Extra/Src/History.js +115 -0
  36. package/Extra/Src/Instant_Update.js +65 -0
  37. package/Extra/Src/Last-Run.js +65 -0
  38. package/Extra/Src/Premium.js +81 -0
  39. package/Extra/Src/Release_Memory.js +160 -0
  40. package/Extra/Src/Websocket.js +213 -0
  41. package/Extra/Src/image/checkmate.jpg +0 -0
  42. package/Extra/Src/test.js +28 -0
  43. package/Extra/Src/uuid.js +137 -0
  44. package/Func/AcceptAgreement.js +31 -0
  45. package/Func/ClearCache.js +64 -0
  46. package/Func/ReportV1.js +54 -0
  47. package/LICENSE +678 -0
  48. package/Language/index.json +228 -0
  49. package/Main.js +1444 -0
  50. package/README.md +30 -175
  51. package/SECURITY.md +18 -0
  52. package/broadcast.js +44 -0
  53. package/index.js +414 -511
  54. package/logger.js +66 -0
  55. package/package.json +85 -370
  56. package/src/Dev_Horizon_Data.js +125 -0
  57. package/src/Dev_getThreadInfoOLD.js +422 -0
  58. package/src/Dev_shareTest2.js +68 -0
  59. package/src/Dev_shareTest3.js +71 -0
  60. package/src/Premium.js +25 -0
  61. package/src/Screenshot.js +83 -0
  62. package/src/addExternalModule.js +5 -14
  63. package/src/addUserToGroup.js +20 -56
  64. package/src/changeAdminStatus.js +20 -44
  65. package/src/changeArchivedStatus.js +11 -25
  66. package/src/{changeAvatarV2.js → changeAvt.js} +2 -3
  67. package/src/changeBio.js +15 -26
  68. package/src/changeBlockedStatus.js +8 -21
  69. package/src/changeGroupImage.js +24 -53
  70. package/src/changeNickname.js +13 -27
  71. package/src/changeThreadColor.js +19 -22
  72. package/src/changeThreadEmoji.js +11 -24
  73. package/src/createNewGroup.js +20 -38
  74. package/src/createPoll.js +16 -27
  75. package/src/deleteMessage.js +13 -24
  76. package/src/deleteThread.js +12 -25
  77. package/src/editMessage.js +53 -71
  78. package/src/forwardAttachment.js +15 -27
  79. package/src/getAccessToken.js +28 -0
  80. package/src/getCurrentUserID.js +1 -1
  81. package/src/getEmojiUrl.js +8 -10
  82. package/src/getFriendsList.js +15 -25
  83. package/src/getMessage.js +81 -813
  84. package/src/getThreadHistory.js +98 -241
  85. package/src/getThreadInfo.js +287 -90
  86. package/src/getThreadInfoOLD.js +422 -0
  87. package/src/getThreadList.js +157 -214
  88. package/src/getThreadMain.js +220 -0
  89. package/src/getThreadPictures.js +19 -39
  90. package/src/getUID.js +50 -113
  91. package/src/getUserID.js +14 -18
  92. package/src/getUserInfo.js +71 -65
  93. package/src/getUserInfoMain.js +65 -0
  94. package/src/getUserInfoV2.js +32 -0
  95. package/src/getUserInfoV3.js +63 -0
  96. package/src/getUserInfoV4.js +55 -0
  97. package/src/getUserInfoV5.js +61 -0
  98. package/src/handleFriendRequest.js +13 -24
  99. package/src/handleMessageRequest.js +20 -36
  100. package/src/httpGet.js +18 -34
  101. package/src/httpPost.js +18 -35
  102. package/src/httpPostFormData.js +24 -53
  103. package/src/listenMqtt.js +944 -680
  104. package/src/listenMqttV1.js +846 -0
  105. package/src/logout.js +15 -22
  106. package/src/markAsDelivered.js +15 -25
  107. package/src/markAsRead.js +27 -45
  108. package/src/markAsReadAll.js +14 -21
  109. package/src/markAsSeen.js +18 -28
  110. package/src/muteThread.js +12 -17
  111. package/src/removeUserFromGroup.js +17 -47
  112. package/src/resolvePhotoUrl.js +13 -21
  113. package/src/searchForThread.js +13 -23
  114. package/src/sendMessage.js +117 -178
  115. package/src/sendMqttMessage.js +71 -0
  116. package/src/sendTypingIndicator.js +16 -46
  117. package/src/setMessageReaction.js +20 -33
  118. package/src/setPostReaction.js +95 -105
  119. package/src/setTitle.js +18 -34
  120. package/src/shareContact.js +37 -92
  121. package/src/shareLink.js +4 -5
  122. package/src/threadColors.js +18 -110
  123. package/src/unfriend.js +9 -18
  124. package/src/unsendMessage.js +34 -31
  125. package/src/unsendMqttMessage.js +66 -0
  126. package/test/Database_Test.js +4 -0
  127. package/test/Db2.js +530 -0
  128. package/test/Shankar_Database/A_README.md +1 -0
  129. package/test/Shankar_Database/Database.db +0 -0
  130. package/test/data/shareAttach.js +1 -1
  131. package/test/env/.env +0 -0
  132. package/test/example-db.db +0 -0
  133. package/test/memoryleak.js +18 -0
  134. package/test/test.js +1 -1
  135. package/test/testname.js +1342 -0
  136. package/test/testv2.js +3 -0
  137. package/utils.js +2918 -1393
  138. package/CHANGELOG.md +0 -2
  139. package/LICENSE-MIT +0 -21
  140. package/generated-icon.png +0 -0
  141. package/replit.nix +0 -5
  142. package/shankar-fca.json +0 -4
  143. package/src/changeAvatar.js +0 -136
  144. package/src/changeBlockedStatusMqtt.js +0 -80
  145. package/src/changeCover.js +0 -73
  146. package/src/changeName.js +0 -79
  147. package/src/changeUsername.js +0 -59
  148. package/src/createCommentPost.js +0 -230
  149. package/src/createPost.js +0 -277
  150. package/src/data/getThreadInfo.json +0 -1
  151. package/src/editMessageOld.js +0 -67
  152. package/src/follow.js +0 -74
  153. package/src/getAccess.js +0 -112
  154. package/src/getAvatarUser.js +0 -78
  155. package/src/getRegion.js +0 -7
  156. package/src/getThreadHistoryDeprecated.js +0 -93
  157. package/src/getThreadInfoDeprecated.js +0 -80
  158. package/src/getThreadListDeprecated.js +0 -75
  159. package/src/listenNotification.js +0 -85
  160. package/src/pinMessage.js +0 -59
  161. package/src/refreshFb_dtsg.js +0 -89
  162. package/src/searchStickers.js +0 -53
  163. package/src/sendMessageMqtt.js +0 -322
  164. package/src/sendTypingIndicatorV2.js +0 -28
  165. package/src/setMessageReactionMqtt.js +0 -62
  166. package/src/setProfileGuard.js +0 -45
  167. package/src/setStoryReaction.js +0 -64
  168. package/src/stopListenMqtt.js +0 -26
  169. package/src/uploadAttachment.js +0 -94
@@ -1,322 +0,0 @@
1
- var utils = require("../utils");
2
- var log = require("npmlog");
3
- var bluebird = require("bluebird");
4
-
5
- module.exports = function (defaultFuncs, api, ctx) {
6
- function uploadAttachment(attachments, callback) {
7
- callback = callback || function () {};
8
- var uploads = [];
9
-
10
- // create an array of promises
11
- for (var i = 0; i < attachments.length; i++) {
12
- if (!utils.isReadableStream(attachments[i])) {
13
- throw {
14
- error:
15
- "Attachment should be a readable stream and not " +
16
- utils.getType(attachments[i]) +
17
- ".",
18
- };
19
- }
20
-
21
- var form = {
22
- upload_1024: attachments[i],
23
- voice_clip: "true",
24
- };
25
-
26
- uploads.push(
27
- defaultFuncs
28
- .postFormData(
29
- "https://upload.facebook.com/ajax/mercury/upload.php",
30
- ctx.jar,
31
- form,
32
- {},
33
- )
34
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
- .then(function (resData) {
36
- if (resData.error) {
37
- throw resData;
38
- }
39
-
40
- // We have to return the data unformatted unless we want to change it
41
- // back in sendMessage.
42
- return resData.payload.metadata[0];
43
- }),
44
- );
45
- }
46
-
47
- // resolve all promises
48
- bluebird
49
- .all(uploads)
50
- .then(function (resData) {
51
- callback(null, resData);
52
- })
53
- .catch(function (err) {
54
- log.error("uploadAttachment", err);
55
- return callback(err);
56
- });
57
- }
58
-
59
- let variance = 0;
60
- const epoch_id = () =>
61
- Math.floor(Date.now() * (4194304 + (variance = (variance + 0.1) % 5)));
62
- const emojiSizes = {
63
- small: 1,
64
- medium: 2,
65
- large: 3,
66
- };
67
-
68
- function handleEmoji(msg, form, callback, cb) {
69
- if (msg.emojiSize != null && msg.emoji == null) {
70
- return callback({ error: "emoji property is empty" });
71
- }
72
- if (msg.emoji) {
73
- if (!msg.emojiSize) {
74
- msg.emojiSize = "small";
75
- }
76
- if (
77
- msg.emojiSize !== "small" &&
78
- msg.emojiSize !== "medium" &&
79
- msg.emojiSize !== "large" &&
80
- (isNaN(msg.emojiSize) || msg.emojiSize < 1 || msg.emojiSize > 3)
81
- ) {
82
- return callback({ error: "emojiSize property is invalid" });
83
- }
84
-
85
- form.payload.tasks[0].payload.send_type = 1;
86
- form.payload.tasks[0].payload.text = msg.emoji;
87
- form.payload.tasks[0].payload.hot_emoji_size = !isNaN(msg.emojiSize)
88
- ? msg.emojiSize
89
- : emojiSizes[msg.emojiSize];
90
- }
91
- cb();
92
- }
93
-
94
- function handleSticker(msg, form, callback, cb) {
95
- if (msg.sticker) {
96
- form.payload.tasks[0].payload.send_type = 2;
97
- form.payload.tasks[0].payload.sticker_id = msg.sticker;
98
- }
99
- cb();
100
- }
101
-
102
- function handleAttachment(msg, form, callback, cb) {
103
- if (msg.attachment) {
104
- form.payload.tasks[0].payload.send_type = 3;
105
- form.payload.tasks[0].payload.attachment_fbids = [];
106
- if (form.payload.tasks[0].payload.text == "")
107
- form.payload.tasks[0].payload.text = null;
108
- if (utils.getType(msg.attachment) !== "Array") {
109
- msg.attachment = [msg.attachment];
110
- }
111
-
112
- uploadAttachment(msg.attachment, function (err, files) {
113
- if (err) {
114
- return callback(err);
115
- }
116
-
117
- files.forEach(function (file) {
118
- var key = Object.keys(file);
119
- var type = key[0]; // image_id, file_id, etc
120
- form.payload.tasks[0].payload.attachment_fbids.push(file[type]); // push the id
121
- });
122
- cb();
123
- });
124
- } else {
125
- cb();
126
- }
127
- }
128
-
129
- function handleMention(msg, form, callback, cb) {
130
- if (msg.mentions) {
131
- form.payload.tasks[0].payload.send_type = 1;
132
-
133
- const arrayIds = [];
134
- const arrayOffsets = [];
135
- const arrayLengths = [];
136
- const mention_types = [];
137
-
138
- for (let i = 0; i < msg.mentions.length; i++) {
139
- const mention = msg.mentions[i];
140
-
141
- const tag = mention.tag;
142
- if (typeof tag !== "string") {
143
- return callback({ error: "Mention tags must be strings." });
144
- }
145
-
146
- const offset = msg.body.indexOf(tag, mention.fromIndex || 0);
147
-
148
- if (offset < 0) {
149
- log.warn(
150
- "handleMention",
151
- 'Mention for "' + tag + '" not found in message string.',
152
- );
153
- }
154
-
155
- if (mention.id == null) {
156
- log.warn("handleMention", "Mention id should be non-null.");
157
- }
158
-
159
- const id = mention.id || 0;
160
- arrayIds.push(id);
161
- arrayOffsets.push(offset);
162
- arrayLengths.push(tag.length);
163
- mention_types.push("p");
164
- }
165
-
166
- form.payload.tasks[0].payload.mention_data = {
167
- mention_ids: arrayIds.join(","),
168
- mention_offsets: arrayOffsets.join(","),
169
- mention_lengths: arrayLengths.join(","),
170
- mention_types: mention_types.join(","),
171
- };
172
- }
173
- cb();
174
- }
175
-
176
- function handleLocation(msg, form, callback, cb) {
177
- // this is not working yet
178
- if (msg.location) {
179
- if (msg.location.latitude == null || msg.location.longitude == null) {
180
- return callback({
181
- error: "location property needs both latitude and longitude",
182
- });
183
- }
184
-
185
- form.payload.tasks[0].payload.send_type = 1;
186
- form.payload.tasks[0].payload.location_data = {
187
- coordinates: {
188
- latitude: msg.location.latitude,
189
- longitude: msg.location.longitude,
190
- },
191
- is_current_location: !!msg.location.current,
192
- is_live_location: !!msg.location.live,
193
- };
194
- }
195
-
196
- cb();
197
- }
198
-
199
- function send(form, threadID, callback, replyToMessage) {
200
- if (replyToMessage) {
201
- form.payload.tasks[0].payload.reply_metadata = {
202
- reply_source_id: replyToMessage,
203
- reply_source_type: 1,
204
- reply_type: 0,
205
- };
206
- }
207
- const mqttClient = ctx.mqttClient;
208
- form.payload.tasks.forEach((task) => {
209
- task.payload = JSON.stringify(task.payload);
210
- });
211
- form.payload = JSON.stringify(form.payload);
212
- console.log(global.jsonStringifyColor(form, null, 2));
213
-
214
- return mqttClient.publish(
215
- "/ls_req",
216
- JSON.stringify(form),
217
- function (err, data) {
218
- if (err) {
219
- console.error("Error publishing message: ", err);
220
- callback(err);
221
- } else {
222
- console.log("Message published successfully with data: ", data);
223
- callback(null, data);
224
- }
225
- },
226
- );
227
- }
228
-
229
- return function sendMessageMqtt(msg, threadID, callback, replyToMessage) {
230
- if (
231
- !callback &&
232
- (utils.getType(threadID) === "Function" ||
233
- utils.getType(threadID) === "AsyncFunction")
234
- ) {
235
- return threadID({ error: "Pass a threadID as a second argument." });
236
- }
237
- if (!replyToMessage && utils.getType(callback) === "String") {
238
- replyToMessage = callback;
239
- callback = function () {};
240
- }
241
-
242
- if (!callback) {
243
- callback = function (err, friendList) {};
244
- }
245
-
246
- var msgType = utils.getType(msg);
247
- var threadIDType = utils.getType(threadID);
248
- var messageIDType = utils.getType(replyToMessage);
249
-
250
- if (msgType !== "String" && msgType !== "Object") {
251
- return callback({
252
- error:
253
- "Message should be of type string or object and not " + msgType + ".",
254
- });
255
- }
256
-
257
- if (msgType === "String") {
258
- msg = { body: msg };
259
- }
260
-
261
- const timestamp = Date.now();
262
- // get full date time
263
- const epoch = timestamp << 22;
264
- //const otid = epoch + 0; // TODO replace with randomInt(0, 2**22)
265
- const otid = epoch + Math.floor(Math.random() * 4194304);
266
-
267
- const form = {
268
- app_id: "2220391788200892",
269
- payload: {
270
- tasks: [
271
- {
272
- label: "46",
273
- payload: {
274
- thread_id: threadID.toString(),
275
- otid: otid.toString(),
276
- source: 0,
277
- send_type: 1,
278
- sync_group: 1,
279
- text:
280
- msg.body != null && msg.body != undefined
281
- ? msg.body.toString()
282
- : "",
283
- initiating_source: 1,
284
- skip_url_preview_gen: 0,
285
- },
286
- queue_name: threadID.toString(),
287
- task_id: 0,
288
- failure_count: null,
289
- },
290
- {
291
- label: "21",
292
- payload: {
293
- thread_id: threadID.toString(),
294
- last_read_watermark_ts: Date.now(),
295
- sync_group: 1,
296
- },
297
- queue_name: threadID.toString(),
298
- task_id: 1,
299
- failure_count: null,
300
- },
301
- ],
302
- epoch_id: epoch_id(),
303
- version_id: "6120284488008082",
304
- data_trace_id: null,
305
- },
306
- request_id: 1,
307
- type: 3,
308
- };
309
-
310
- handleEmoji(msg, form, callback, function () {
311
- handleLocation(msg, form, callback, function () {
312
- handleMention(msg, form, callback, function () {
313
- handleSticker(msg, form, callback, function () {
314
- handleAttachment(msg, form, callback, function () {
315
- send(form, threadID, callback, replyToMessage);
316
- });
317
- });
318
- });
319
- });
320
- });
321
- };
322
- };
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
-
4
-
5
- var utils = require("../utils");
6
- var log = require("npmlog");
7
-
8
- module.exports = function (defaultFuncs, api, ctx) {
9
- return async function sendTypingIndicatorV2(sendTyping,threadID, callback) {
10
- let count_req = 0
11
- var wsContent = {
12
- app_id: 2220391788200892,
13
- payload: JSON.stringify({
14
- label: 3,
15
- payload: JSON.stringify({
16
- thread_key: threadID.toString(),
17
- is_group_thread: +(threadID.toString().length >= 16),
18
- is_typing: +sendTyping,
19
- attribution: 0
20
- }),
21
- version: 5849951561777440
22
- }),
23
- request_id: ++count_req,
24
- type: 4
25
- };
26
- await new Promise((resolve, reject) => mqttClient.publish('/ls_req', JSON.stringify(wsContent), {}, (err, _packet) => err ? reject(err) : resolve()));
27
- };
28
- };
@@ -1,62 +0,0 @@
1
-
2
- 'use strict';
3
-
4
- const { generateOfflineThreadingID } = require('../utils');
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 setMessageReactionMqtt(reaction, messageID, threadID, callback) {
17
- if (!ctx.mqttClient) {
18
- throw new Error('Not connected to MQTT');
19
- }
20
-
21
-
22
- ctx.wsReqNumber += 1;
23
- ctx.wsTaskNumber += 1;
24
-
25
- const taskPayload = {
26
- thread_key: threadID,
27
- timestamp_ms: Date.now(),
28
- message_id: messageID,
29
- reaction: reaction,
30
- actor_id: ctx.userID,
31
- reaction_style: null,
32
- sync_group: 1,
33
- send_attribution: Math.random() < 0.5 ? 65537 : 524289
34
- };
35
-
36
- const task = {
37
- failure_count: null,
38
- label: '29',
39
- payload: JSON.stringify(taskPayload),
40
- queue_name: JSON.stringify(['reaction', messageID]),
41
- task_id: ctx.wsTaskNumber,
42
- };
43
-
44
- const content = {
45
- app_id: '2220391788200892',
46
- payload: JSON.stringify({
47
- data_trace_id: null,
48
- epoch_id: parseInt(generateOfflineThreadingID()),
49
- tasks: [task],
50
- version_id: '7158486590867448',
51
- }),
52
- request_id: ctx.wsReqNumber,
53
- type: 3,
54
- };
55
-
56
- if (isCallable(callback)) {
57
- ctx.reqCallbacks[ctx.wsReqNumber] = callback;
58
- }
59
-
60
- ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
61
- };
62
- };
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
-
5
- // @NethWs3Dev
6
- module.exports = (defaultFuncs, api, ctx) => {
7
- return (guard, callback = () => {}) => {
8
- if (utils.getType(guard) !== "Boolean") {
9
- throw {
10
- error: "Please pass a boolean as a second argument.",
11
- };
12
- }
13
- const uid = ctx.userID || ctx.i_userID;
14
- const form = {
15
- av: uid,
16
- variables: JSON.stringify({
17
- input: {
18
- is_shielded: guard ? true : false,
19
- actor_id: uid,
20
- client_mutation_id: "1"
21
- },
22
- scale: 1
23
- }),
24
- doc_id: "1477043292367183",
25
- fb_api_req_friendly_name: "IsShieldedSetMutation",
26
- fb_api_caller_class: "IsShieldedSetMutation"
27
- }
28
-
29
- return defaultFuncs
30
- .post("https://www.facebook.com/api/graphql", ctx.jar, form)
31
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
32
- .then((resData) => {
33
- if (resData.err) {
34
- throw {
35
- err: resData.err
36
- };
37
- }
38
- return callback();
39
- })
40
- .catch(err => {
41
- console.error("setProfileGuard", err);
42
- return callback(err);
43
- });;
44
- };
45
- };
@@ -1,64 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('../utils.js');
4
- var log = require('npmlog');
5
-
6
- module.exports = function(defaultFuncs, api, ctx) {
7
- return function setStoryReaction(storyID, react, callback) {
8
- var cb;
9
- var returnPromise = new Promise(function(resolve, reject) {
10
- cb = error => error ? reject(error) : resolve();
11
- });
12
-
13
- if (typeof react == 'function') {
14
- callback = react;
15
- react = 1;
16
- }
17
- if (typeof callback == 'function') cb = callback;
18
- if (typeof Number(react) != 'number') react = 1;
19
-
20
- var map = {
21
- 1: '👍',
22
- 2: '❤️',
23
- 3: '🤗',
24
- 4: '😆',
25
- 5: '😮',
26
- 6: '😢',
27
- 7: '😡'
28
- }
29
- var form = {
30
- fb_api_req_friendly_name: 'useStoriesSendReplyMutation',
31
- variables: JSON.stringify({
32
- input: {
33
- attribution_id_v2: `StoriesCometSuspenseRoot.react,comet.stories.viewer,unexpected,${Date.now()},538296,,;CometHomeRoot.react,comet.home,via_cold_start,${Date.now()},850302,4748854339,`,
34
- lightweight_reaction_actions: {
35
- offsets: [0],
36
- reaction: map[react] || map[1]
37
- },
38
- message: map[react] || map[1],
39
- story_id: storyID,
40
- story_reply_type: "LIGHT_WEIGHT",
41
- actor_id: ctx.userID,
42
- client_mutation_id: String(parseInt(Math.random() * 16))
43
- }
44
- }),
45
- doc_id: '4826141330837571'
46
- }
47
-
48
- defaultFuncs
49
- .post('https://www.facebook.com/api/graphql/', ctx.jar, form)
50
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
51
- .then(function(res) {
52
- if (res.errors) throw res;
53
- return cb();
54
- })
55
- .catch(function(err) {
56
- log.error('setPostReaction', err);
57
- return cb(err);
58
- });
59
-
60
- return returnPromise;
61
- }
62
- }
63
-
64
- //new update version 1.0.9
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- /*
4
- @NethWs3Dev
5
- */
6
-
7
- // @NethWs3Dev
8
-
9
- var log = require("npmlog");
10
-
11
- module.exports = function (defaultFuncs, api, ctx){
12
- return function stopListenMqtt() {
13
- if (!ctx.mqttClient) {
14
- throw new Error("Not connected to MQTT");
15
- }
16
- log.warn("stopListenMqtt", "Stopping...");
17
- ctx.mqttClient.unsubscribe("/webrtc");
18
- ctx.mqttClient.unsubscribe("/rtc_multi");
19
- ctx.mqttClient.unsubscribe("/onevc");
20
- ctx.mqttClient.publish("/browser_close", "{}");
21
- ctx.mqttClient.end(false, (...data) => {
22
- log.info("stopListenMqtt", "Stopped");
23
- ctx.mqttClient = null;
24
- });
25
- }
26
- };
@@ -1,94 +0,0 @@
1
- const utils = require("../utils");
2
- const log = require("npmlog");
3
-
4
- module.exports = function (defaultFuncs, api, ctx) {
5
- function upload(attachments, callback) {
6
- callback = callback || function () {};
7
- const uploads = [];
8
-
9
- // create an array of promises
10
- for (let i = 0; i < attachments.length; i++) {
11
- if (!utils.isReadableStream(attachments[i])) {
12
- throw {
13
- error:
14
- "Attachment should be a readable stream and not " +
15
- utils.getType(attachments[i]) +
16
- ".",
17
- };
18
- }
19
-
20
- const form = {
21
- upload_1024: attachments[i],
22
- voice_clip: "true",
23
- };
24
-
25
- uploads.push(
26
- defaultFuncs
27
- .postFormData(
28
- "https://upload.facebook.com/ajax/mercury/upload.php",
29
- ctx.jar,
30
- form,
31
- {},
32
- )
33
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
34
- .then(function (resData) {
35
- if (resData.error) {
36
- throw resData;
37
- }
38
-
39
- // We have to return the data unformatted unless we want to change it
40
- // back in sendMessage.
41
- return resData.payload.metadata[0];
42
- }),
43
- );
44
- }
45
-
46
- // resolve all promises
47
- Promise.all(uploads)
48
- .then(function (resData) {
49
- callback(null, resData);
50
- })
51
- .catch(function (err) {
52
- log.error("uploadAttachment", err);
53
- return callback(err);
54
- });
55
- }
56
-
57
- return function uploadAttachment(attachments, callback) {
58
- if (
59
- !attachments &&
60
- !utils.isReadableStream(attachments) &&
61
- !utils.getType(attachments) === "Array" &&
62
- utils.getType(attachments) === "Array" &&
63
- !attachments.length
64
- )
65
- throw { error: "Please pass an attachment or an array of attachments." };
66
-
67
- let resolveFunc = function () {};
68
- let rejectFunc = function () {};
69
- const returnPromise = new Promise(function (resolve, reject) {
70
- resolveFunc = resolve;
71
- rejectFunc = reject;
72
- });
73
-
74
- if (!callback) {
75
- callback = function (err, info) {
76
- if (err) {
77
- return rejectFunc(err);
78
- }
79
- resolveFunc(info);
80
- };
81
- }
82
-
83
- if (utils.getType(attachments) !== "Array") attachments = [attachments];
84
-
85
- upload(attachments, (err, info) => {
86
- if (err) {
87
- return callback(err);
88
- }
89
- callback(null, info);
90
- });
91
-
92
- return returnPromise;
93
- };
94
- };