fca-smart-shankar 10.9.1 → 12.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 (363) hide show
  1. package/.cache/nix/binary-cache-v6.sqlite +0 -0
  2. package/.cache/replit/env/latest +117 -48
  3. package/.cache/replit/env/latest.json +1 -1
  4. package/.cache/replit/modules/nix.res +1 -0
  5. package/.cache/replit/modules/nodejs-20.res +1 -0
  6. package/.cache/replit/nix/env.json +1 -0
  7. package/.cache/typescript/5.6/node_modules/.package-lock.json +171 -0
  8. package/.cache/typescript/5.6/node_modules/@types/bluebird/LICENSE +21 -0
  9. package/.cache/typescript/5.6/node_modules/@types/bluebird/README.md +15 -0
  10. package/.cache/typescript/5.6/node_modules/@types/bluebird/index.d.ts +1365 -0
  11. package/.cache/typescript/5.6/node_modules/@types/bluebird/package.json +25 -0
  12. package/.cache/typescript/5.6/node_modules/@types/caseless/LICENSE +21 -0
  13. package/.cache/typescript/5.6/node_modules/@types/caseless/README.md +48 -0
  14. package/.cache/typescript/5.6/node_modules/@types/caseless/index.d.ts +29 -0
  15. package/.cache/typescript/5.6/node_modules/@types/caseless/package.json +35 -0
  16. package/.cache/typescript/5.6/node_modules/@types/cheerio/LICENSE +21 -0
  17. package/.cache/typescript/5.6/node_modules/@types/cheerio/README.md +15 -0
  18. package/.cache/typescript/5.6/node_modules/@types/cheerio/index.d.ts +318 -0
  19. package/.cache/typescript/5.6/node_modules/@types/cheerio/package.json +71 -0
  20. package/.cache/typescript/5.6/node_modules/@types/mocha/LICENSE +21 -0
  21. package/.cache/typescript/5.6/node_modules/@types/mocha/README.md +15 -0
  22. package/.cache/typescript/5.6/node_modules/@types/mocha/index.d.ts +2929 -0
  23. package/.cache/typescript/5.6/node_modules/@types/mocha/package.json +56 -0
  24. package/.cache/typescript/5.6/node_modules/@types/node/LICENSE +21 -0
  25. package/.cache/typescript/5.6/node_modules/@types/node/README.md +15 -0
  26. package/.cache/typescript/5.6/node_modules/@types/node/assert/strict.d.ts +8 -0
  27. package/.cache/typescript/5.6/node_modules/@types/node/assert.d.ts +1040 -0
  28. package/.cache/typescript/5.6/node_modules/@types/node/async_hooks.d.ts +541 -0
  29. package/.cache/typescript/5.6/node_modules/@types/node/buffer.buffer.d.ts +385 -0
  30. package/.cache/typescript/5.6/node_modules/@types/node/buffer.d.ts +1933 -0
  31. package/.cache/typescript/5.6/node_modules/@types/node/child_process.d.ts +1549 -0
  32. package/.cache/typescript/5.6/node_modules/@types/node/cluster.d.ts +579 -0
  33. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
  34. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/index.d.ts +9 -0
  35. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
  36. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  37. package/.cache/typescript/5.6/node_modules/@types/node/console.d.ts +452 -0
  38. package/.cache/typescript/5.6/node_modules/@types/node/constants.d.ts +19 -0
  39. package/.cache/typescript/5.6/node_modules/@types/node/crypto.d.ts +4475 -0
  40. package/.cache/typescript/5.6/node_modules/@types/node/dgram.d.ts +596 -0
  41. package/.cache/typescript/5.6/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  42. package/.cache/typescript/5.6/node_modules/@types/node/dns/promises.d.ts +476 -0
  43. package/.cache/typescript/5.6/node_modules/@types/node/dns.d.ts +865 -0
  44. package/.cache/typescript/5.6/node_modules/@types/node/dom-events.d.ts +124 -0
  45. package/.cache/typescript/5.6/node_modules/@types/node/domain.d.ts +170 -0
  46. package/.cache/typescript/5.6/node_modules/@types/node/events.d.ts +931 -0
  47. package/.cache/typescript/5.6/node_modules/@types/node/fs/promises.d.ts +1275 -0
  48. package/.cache/typescript/5.6/node_modules/@types/node/fs.d.ts +4396 -0
  49. package/.cache/typescript/5.6/node_modules/@types/node/globals.d.ts +566 -0
  50. package/.cache/typescript/5.6/node_modules/@types/node/globals.typedarray.d.ts +21 -0
  51. package/.cache/typescript/5.6/node_modules/@types/node/http.d.ts +1958 -0
  52. package/.cache/typescript/5.6/node_modules/@types/node/http2.d.ts +2558 -0
  53. package/.cache/typescript/5.6/node_modules/@types/node/https.d.ts +543 -0
  54. package/.cache/typescript/5.6/node_modules/@types/node/index.d.ts +92 -0
  55. package/.cache/typescript/5.6/node_modules/@types/node/inspector.d.ts +3966 -0
  56. package/.cache/typescript/5.6/node_modules/@types/node/module.d.ts +402 -0
  57. package/.cache/typescript/5.6/node_modules/@types/node/net.d.ts +1001 -0
  58. package/.cache/typescript/5.6/node_modules/@types/node/os.d.ts +495 -0
  59. package/.cache/typescript/5.6/node_modules/@types/node/package.json +220 -0
  60. package/.cache/typescript/5.6/node_modules/@types/node/path.d.ts +200 -0
  61. package/.cache/typescript/5.6/node_modules/@types/node/perf_hooks.d.ts +965 -0
  62. package/.cache/typescript/5.6/node_modules/@types/node/process.d.ts +1963 -0
  63. package/.cache/typescript/5.6/node_modules/@types/node/punycode.d.ts +117 -0
  64. package/.cache/typescript/5.6/node_modules/@types/node/querystring.d.ts +153 -0
  65. package/.cache/typescript/5.6/node_modules/@types/node/readline/promises.d.ts +162 -0
  66. package/.cache/typescript/5.6/node_modules/@types/node/readline.d.ts +589 -0
  67. package/.cache/typescript/5.6/node_modules/@types/node/repl.d.ts +430 -0
  68. package/.cache/typescript/5.6/node_modules/@types/node/sea.d.ts +153 -0
  69. package/.cache/typescript/5.6/node_modules/@types/node/sqlite.d.ts +213 -0
  70. package/.cache/typescript/5.6/node_modules/@types/node/stream/consumers.d.ts +12 -0
  71. package/.cache/typescript/5.6/node_modules/@types/node/stream/promises.d.ts +90 -0
  72. package/.cache/typescript/5.6/node_modules/@types/node/stream/web.d.ts +609 -0
  73. package/.cache/typescript/5.6/node_modules/@types/node/stream.d.ts +1726 -0
  74. package/.cache/typescript/5.6/node_modules/@types/node/string_decoder.d.ts +67 -0
  75. package/.cache/typescript/5.6/node_modules/@types/node/test.d.ts +2248 -0
  76. package/.cache/typescript/5.6/node_modules/@types/node/timers/promises.d.ts +97 -0
  77. package/.cache/typescript/5.6/node_modules/@types/node/timers.d.ts +240 -0
  78. package/.cache/typescript/5.6/node_modules/@types/node/tls.d.ts +1226 -0
  79. package/.cache/typescript/5.6/node_modules/@types/node/trace_events.d.ts +197 -0
  80. package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
  81. package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
  82. package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/index.d.ts +92 -0
  83. package/.cache/typescript/5.6/node_modules/@types/node/tty.d.ts +208 -0
  84. package/.cache/typescript/5.6/node_modules/@types/node/url.d.ts +972 -0
  85. package/.cache/typescript/5.6/node_modules/@types/node/util.d.ts +2371 -0
  86. package/.cache/typescript/5.6/node_modules/@types/node/v8.d.ts +808 -0
  87. package/.cache/typescript/5.6/node_modules/@types/node/vm.d.ts +976 -0
  88. package/.cache/typescript/5.6/node_modules/@types/node/wasi.d.ts +181 -0
  89. package/.cache/typescript/5.6/node_modules/@types/node/worker_threads.d.ts +745 -0
  90. package/.cache/typescript/5.6/node_modules/@types/node/zlib.d.ts +539 -0
  91. package/.cache/typescript/5.6/node_modules/@types/request/LICENSE +21 -0
  92. package/.cache/typescript/5.6/node_modules/@types/request/README.md +15 -0
  93. package/.cache/typescript/5.6/node_modules/@types/request/index.d.ts +395 -0
  94. package/.cache/typescript/5.6/node_modules/@types/request/package.json +70 -0
  95. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/LICENSE +21 -0
  96. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/README.md +15 -0
  97. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/index.d.ts +321 -0
  98. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/package.json +35 -0
  99. package/.cache/typescript/5.6/node_modules/asynckit/LICENSE +21 -0
  100. package/.cache/typescript/5.6/node_modules/asynckit/README.md +233 -0
  101. package/.cache/typescript/5.6/node_modules/asynckit/bench.js +76 -0
  102. package/.cache/typescript/5.6/node_modules/asynckit/index.js +6 -0
  103. package/.cache/typescript/5.6/node_modules/asynckit/lib/abort.js +29 -0
  104. package/.cache/typescript/5.6/node_modules/asynckit/lib/async.js +34 -0
  105. package/.cache/typescript/5.6/node_modules/asynckit/lib/defer.js +26 -0
  106. package/.cache/typescript/5.6/node_modules/asynckit/lib/iterate.js +75 -0
  107. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  108. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_parallel.js +25 -0
  109. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial.js +25 -0
  110. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  111. package/.cache/typescript/5.6/node_modules/asynckit/lib/state.js +37 -0
  112. package/.cache/typescript/5.6/node_modules/asynckit/lib/streamify.js +141 -0
  113. package/.cache/typescript/5.6/node_modules/asynckit/lib/terminator.js +29 -0
  114. package/.cache/typescript/5.6/node_modules/asynckit/package.json +63 -0
  115. package/.cache/typescript/5.6/node_modules/asynckit/parallel.js +43 -0
  116. package/.cache/typescript/5.6/node_modules/asynckit/serial.js +17 -0
  117. package/.cache/typescript/5.6/node_modules/asynckit/serialOrdered.js +75 -0
  118. package/.cache/typescript/5.6/node_modules/asynckit/stream.js +21 -0
  119. package/.cache/typescript/5.6/node_modules/combined-stream/License +19 -0
  120. package/.cache/typescript/5.6/node_modules/combined-stream/Readme.md +138 -0
  121. package/.cache/typescript/5.6/node_modules/combined-stream/lib/combined_stream.js +208 -0
  122. package/.cache/typescript/5.6/node_modules/combined-stream/package.json +25 -0
  123. package/.cache/typescript/5.6/node_modules/combined-stream/yarn.lock +17 -0
  124. package/.cache/typescript/5.6/node_modules/delayed-stream/License +19 -0
  125. package/.cache/typescript/5.6/node_modules/delayed-stream/Makefile +7 -0
  126. package/.cache/typescript/5.6/node_modules/delayed-stream/Readme.md +141 -0
  127. package/.cache/typescript/5.6/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  128. package/.cache/typescript/5.6/node_modules/delayed-stream/package.json +27 -0
  129. package/.cache/typescript/5.6/node_modules/form-data/License +19 -0
  130. package/.cache/typescript/5.6/node_modules/form-data/Readme.md +350 -0
  131. package/.cache/typescript/5.6/node_modules/form-data/index.d.ts +51 -0
  132. package/.cache/typescript/5.6/node_modules/form-data/lib/browser.js +2 -0
  133. package/.cache/typescript/5.6/node_modules/form-data/lib/form_data.js +484 -0
  134. package/.cache/typescript/5.6/node_modules/form-data/lib/populate.js +10 -0
  135. package/.cache/typescript/5.6/node_modules/form-data/package.json +72 -0
  136. package/.cache/typescript/5.6/node_modules/mime-db/HISTORY.md +507 -0
  137. package/.cache/typescript/5.6/node_modules/mime-db/LICENSE +23 -0
  138. package/.cache/typescript/5.6/node_modules/mime-db/README.md +100 -0
  139. package/.cache/typescript/5.6/node_modules/mime-db/db.json +8519 -0
  140. package/.cache/typescript/5.6/node_modules/mime-db/index.js +12 -0
  141. package/.cache/typescript/5.6/node_modules/mime-db/package.json +60 -0
  142. package/.cache/typescript/5.6/node_modules/mime-types/HISTORY.md +397 -0
  143. package/.cache/typescript/5.6/node_modules/mime-types/LICENSE +23 -0
  144. package/.cache/typescript/5.6/node_modules/mime-types/README.md +113 -0
  145. package/.cache/typescript/5.6/node_modules/mime-types/index.js +188 -0
  146. package/.cache/typescript/5.6/node_modules/mime-types/package.json +44 -0
  147. package/.cache/typescript/5.6/node_modules/safe-buffer/LICENSE +21 -0
  148. package/.cache/typescript/5.6/node_modules/safe-buffer/README.md +584 -0
  149. package/.cache/typescript/5.6/node_modules/safe-buffer/index.d.ts +187 -0
  150. package/.cache/typescript/5.6/node_modules/safe-buffer/index.js +65 -0
  151. package/.cache/typescript/5.6/node_modules/safe-buffer/package.json +51 -0
  152. package/.cache/typescript/5.6/node_modules/types-registry/README.md +2 -0
  153. package/.cache/typescript/5.6/node_modules/types-registry/index.json +1 -0
  154. package/.cache/typescript/5.6/node_modules/types-registry/package.json +20 -0
  155. package/.cache/typescript/5.6/node_modules/undici-types/LICENSE +21 -0
  156. package/.cache/typescript/5.6/node_modules/undici-types/README.md +6 -0
  157. package/.cache/typescript/5.6/node_modules/undici-types/agent.d.ts +31 -0
  158. package/.cache/typescript/5.6/node_modules/undici-types/api.d.ts +43 -0
  159. package/.cache/typescript/5.6/node_modules/undici-types/balanced-pool.d.ts +29 -0
  160. package/.cache/typescript/5.6/node_modules/undici-types/cache.d.ts +36 -0
  161. package/.cache/typescript/5.6/node_modules/undici-types/client.d.ts +108 -0
  162. package/.cache/typescript/5.6/node_modules/undici-types/connector.d.ts +34 -0
  163. package/.cache/typescript/5.6/node_modules/undici-types/content-type.d.ts +21 -0
  164. package/.cache/typescript/5.6/node_modules/undici-types/cookies.d.ts +28 -0
  165. package/.cache/typescript/5.6/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  166. package/.cache/typescript/5.6/node_modules/undici-types/dispatcher.d.ts +255 -0
  167. package/.cache/typescript/5.6/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  168. package/.cache/typescript/5.6/node_modules/undici-types/errors.d.ts +149 -0
  169. package/.cache/typescript/5.6/node_modules/undici-types/eventsource.d.ts +61 -0
  170. package/.cache/typescript/5.6/node_modules/undici-types/fetch.d.ts +209 -0
  171. package/.cache/typescript/5.6/node_modules/undici-types/file.d.ts +39 -0
  172. package/.cache/typescript/5.6/node_modules/undici-types/filereader.d.ts +54 -0
  173. package/.cache/typescript/5.6/node_modules/undici-types/formdata.d.ts +108 -0
  174. package/.cache/typescript/5.6/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  175. package/.cache/typescript/5.6/node_modules/undici-types/global-origin.d.ts +7 -0
  176. package/.cache/typescript/5.6/node_modules/undici-types/handlers.d.ts +15 -0
  177. package/.cache/typescript/5.6/node_modules/undici-types/header.d.ts +4 -0
  178. package/.cache/typescript/5.6/node_modules/undici-types/index.d.ts +71 -0
  179. package/.cache/typescript/5.6/node_modules/undici-types/interceptors.d.ts +17 -0
  180. package/.cache/typescript/5.6/node_modules/undici-types/mock-agent.d.ts +50 -0
  181. package/.cache/typescript/5.6/node_modules/undici-types/mock-client.d.ts +25 -0
  182. package/.cache/typescript/5.6/node_modules/undici-types/mock-errors.d.ts +12 -0
  183. package/.cache/typescript/5.6/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  184. package/.cache/typescript/5.6/node_modules/undici-types/mock-pool.d.ts +25 -0
  185. package/.cache/typescript/5.6/node_modules/undici-types/package.json +55 -0
  186. package/.cache/typescript/5.6/node_modules/undici-types/patch.d.ts +33 -0
  187. package/.cache/typescript/5.6/node_modules/undici-types/pool-stats.d.ts +19 -0
  188. package/.cache/typescript/5.6/node_modules/undici-types/pool.d.ts +39 -0
  189. package/.cache/typescript/5.6/node_modules/undici-types/proxy-agent.d.ts +28 -0
  190. package/.cache/typescript/5.6/node_modules/undici-types/readable.d.ts +60 -0
  191. package/.cache/typescript/5.6/node_modules/undici-types/retry-agent.d.ts +8 -0
  192. package/.cache/typescript/5.6/node_modules/undici-types/retry-handler.d.ts +116 -0
  193. package/.cache/typescript/5.6/node_modules/undici-types/util.d.ts +18 -0
  194. package/.cache/typescript/5.6/node_modules/undici-types/webidl.d.ts +222 -0
  195. package/.cache/typescript/5.6/node_modules/undici-types/websocket.d.ts +150 -0
  196. package/.cache/typescript/5.6/package-lock.json +183 -0
  197. package/.cache/typescript/5.6/package.json +1 -0
  198. package/.replit +3 -3
  199. package/LICENSE-MIT +21 -0
  200. package/README.md +176 -30
  201. package/index.js +452 -425
  202. package/package.json +39 -90
  203. package/replit.nix +3 -0
  204. package/src/addExternalModule.js +14 -5
  205. package/src/addUserToGroup.js +57 -21
  206. package/src/changeAdminStatus.js +46 -22
  207. package/src/changeArchivedStatus.js +26 -12
  208. package/src/changeAvatar.js +136 -0
  209. package/src/{changeAvt.js → changeAvatarV2.js} +4 -3
  210. package/src/changeBio.js +26 -15
  211. package/src/changeBlockedStatus.js +22 -9
  212. package/src/changeBlockedStatusMqtt.js +80 -0
  213. package/src/changeCover.js +73 -0
  214. package/src/changeGroupImage.js +55 -26
  215. package/src/changeName.js +79 -0
  216. package/src/changeNickname.js +28 -14
  217. package/src/changeThreadColor.js +22 -19
  218. package/src/changeThreadEmoji.js +25 -12
  219. package/src/changeUsername.js +59 -0
  220. package/src/createCommentPost.js +230 -0
  221. package/src/createNewGroup.js +36 -18
  222. package/src/createPoll.js +28 -17
  223. package/src/createPost.js +276 -0
  224. package/src/data/getThreadInfo.json +1 -0
  225. package/src/deleteMessage.js +25 -14
  226. package/src/deleteThread.js +26 -13
  227. package/src/editMessage.js +56 -50
  228. package/src/editMessageOld.js +67 -0
  229. package/src/follow.js +74 -0
  230. package/src/forwardAttachment.js +28 -16
  231. package/src/getAccess.js +112 -0
  232. package/src/getAvatarUser.js +78 -0
  233. package/src/getCurrentUserID.js +3 -3
  234. package/src/getEmojiUrl.js +10 -8
  235. package/src/getFriendsList.js +25 -15
  236. package/src/getMessage.js +813 -81
  237. package/src/getRegion.js +7 -0
  238. package/src/getThreadHistory.js +241 -98
  239. package/src/getThreadHistoryDeprecated.js +93 -0
  240. package/src/getThreadInfo.js +90 -287
  241. package/src/getThreadInfoDeprecated.js +80 -0
  242. package/src/getThreadList.js +215 -158
  243. package/src/getThreadListDeprecated.js +75 -0
  244. package/src/getThreadPictures.js +40 -20
  245. package/src/getUID.js +113 -50
  246. package/src/getUserID.js +18 -14
  247. package/src/getUserInfo.js +35 -75
  248. package/src/handleFriendRequest.js +25 -14
  249. package/src/handleMessageRequest.js +37 -21
  250. package/src/httpGet.js +36 -20
  251. package/src/httpPost.js +37 -20
  252. package/src/httpPostFormData.js +53 -24
  253. package/src/listenMqtt.js +413 -666
  254. package/src/listenNotification.js +85 -0
  255. package/src/logout.js +24 -17
  256. package/src/markAsDelivered.js +23 -16
  257. package/src/markAsRead.js +43 -28
  258. package/src/markAsReadAll.js +22 -15
  259. package/src/markAsSeen.js +29 -19
  260. package/src/muteThread.js +18 -13
  261. package/src/pinMessage.js +59 -0
  262. package/src/refreshFb_dtsg.js +89 -0
  263. package/src/removeUserFromGroup.js +48 -18
  264. package/src/resolvePhotoUrl.js +22 -14
  265. package/src/searchForThread.js +23 -13
  266. package/src/searchStickers.js +53 -0
  267. package/src/sendMessage.js +180 -122
  268. package/src/sendMessageMqtt.js +322 -0
  269. package/src/sendTypingIndicator.js +42 -21
  270. package/src/sendTypingIndicatorV2.js +28 -0
  271. package/src/setMessageReaction.js +33 -20
  272. package/src/setMessageReactionMqtt.js +62 -0
  273. package/src/setPostReaction.js +105 -95
  274. package/src/setProfileGuard.js +45 -0
  275. package/src/setStoryReaction.js +64 -0
  276. package/src/setTitle.js +35 -19
  277. package/src/shareContact.js +92 -37
  278. package/src/shareLink.js +6 -5
  279. package/src/stopListenMqtt.js +23 -0
  280. package/src/threadColors.js +110 -18
  281. package/src/unfriend.js +20 -11
  282. package/src/unsendMessage.js +31 -34
  283. package/src/uploadAttachment.js +94 -0
  284. package/test/test-page.js +1 -1
  285. package/test/test.js +1 -1
  286. package/utils.js +1237 -2935
  287. package/.cache/replit/modules/nodejs-14.res +0 -1
  288. package/.cache/replit/modules/web.res +0 -1
  289. package/.cache/typescript/5.5/package.json +0 -1
  290. package/.config/configstore/update-notifier-npm.json +0 -4
  291. package/.gitattributes +0 -2
  292. package/.upm/store.json +0 -1
  293. package/Extra/Balancer.js +0 -49
  294. package/Extra/Bypass/956/index.js +0 -234
  295. package/Extra/Bypass/test/aaaa.json +0 -170
  296. package/Extra/Bypass/test/index.js +0 -188
  297. package/Extra/Database/index.js +0 -469
  298. package/Extra/ExtraAddons.js +0 -82
  299. package/Extra/ExtraFindUID.js +0 -62
  300. package/Extra/ExtraGetThread.js +0 -365
  301. package/Extra/ExtraScreenShot.js +0 -430
  302. package/Extra/ExtraUptimeRobot.js +0 -38
  303. package/Extra/Html/Classic/script.js +0 -119
  304. package/Extra/Html/Classic/style.css +0 -8
  305. package/Extra/Security/Base/Step_1.js +0 -6
  306. package/Extra/Security/Base/Step_2.js +0 -22
  307. package/Extra/Security/Base/Step_3.js +0 -22
  308. package/Extra/Security/Base/index.js +0 -191
  309. package/Extra/Security/Index.js +0 -5
  310. package/Extra/Security/Step_1.js +0 -6
  311. package/Extra/Security/Step_2.js +0 -22
  312. package/Extra/Security/Step_3.js +0 -22
  313. package/Extra/Src/Change_Environment.js +0 -24
  314. package/Extra/Src/Check_Update.js +0 -67
  315. package/Extra/Src/History.js +0 -115
  316. package/Extra/Src/Instant_Update.js +0 -65
  317. package/Extra/Src/Last-Run.js +0 -65
  318. package/Extra/Src/Premium.js +0 -81
  319. package/Extra/Src/Release_Memory.js +0 -160
  320. package/Extra/Src/Websocket.js +0 -213
  321. package/Extra/Src/image/checkmate.jpg +0 -0
  322. package/Extra/Src/test.js +0 -28
  323. package/Extra/Src/uuid.js +0 -137
  324. package/Func/AcceptAgreement.js +0 -31
  325. package/Func/ClearCache.js +0 -64
  326. package/Func/ReportV1.js +0 -54
  327. package/LICENSE +0 -678
  328. package/Language/index.json +0 -228
  329. package/Main.js +0 -1444
  330. package/SECURITY.md +0 -18
  331. package/broadcast.js +0 -44
  332. package/logger.js +0 -66
  333. package/src/Dev_Horizon_Data.js +0 -125
  334. package/src/Dev_getThreadInfoOLD.js +0 -422
  335. package/src/Dev_shareTest2.js +0 -68
  336. package/src/Dev_shareTest3.js +0 -71
  337. package/src/Premium.js +0 -25
  338. package/src/Screenshot.js +0 -83
  339. package/src/getAccessToken.js +0 -28
  340. package/src/getThreadInfoOLD.js +0 -422
  341. package/src/getThreadMain.js +0 -220
  342. package/src/getUserInfoMain.js +0 -65
  343. package/src/getUserInfoV2.js +0 -32
  344. package/src/getUserInfoV3.js +0 -63
  345. package/src/getUserInfoV4.js +0 -55
  346. package/src/getUserInfoV5.js +0 -61
  347. package/src/listenMqttV1.js +0 -846
  348. package/src/sendMqttMessage.js +0 -71
  349. package/src/unsendMqttMessage.js +0 -66
  350. package/test/Database_Test.js +0 -4
  351. package/test/Db2.js +0 -530
  352. package/test/Shankar_Database/A_README.md +0 -1
  353. package/test/Shankar_Database/Database.db +0 -0
  354. package/test/data/shareAttach.js +0 -146
  355. package/test/data/something.mov +0 -0
  356. package/test/data/test.png +0 -0
  357. package/test/data/test.txt +0 -7
  358. package/test/env/.env +0 -0
  359. package/test/example-db.db +0 -0
  360. package/test/memoryleak.js +0 -18
  361. package/test/testname.js +0 -1342
  362. package/test/testv2.js +0 -3
  363. /package/{Extra/Security/AES_256_GCM/index.js → .cache/nix/binary-cache-v6.sqlite-journal} +0 -0
@@ -1,846 +0,0 @@
1
- /* eslint-disable no-redeclare */
2
- "use strict";
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
- const mqtt = require('mqtt');
6
- const Websocket = require('ws');
7
- const HttpsProxyAgent = require('https-proxy-agent');
8
- const EventEmitter = require('events');
9
- const Duplexify = require('duplexify');
10
- const Transform = require('readable-stream').Transform;
11
- var identity = function () { };
12
- var form = {};
13
- var getSeqID = function () { };
14
-
15
-
16
- var topics = ["/ls_req","/ls_resp","/legacy_web","/webrtc","/rtc_multi","/onevc","/br_sr","/sr_res","/t_ms","/thread_typing","/orca_typing_notifications","/notify_disconnect","/orca_presence","/inbox","/mercury", "/messaging_events", "/orca_message_notifications", "/pp","/webrtc_response"];
17
-
18
- /* [ Noti ? ]
19
- ! "/br_sr", //Notification
20
- * => Need to publish /br_sr right after this
21
-
22
- ! "/notify_disconnect",
23
- * => Need to publish /messenger_sync_create_queue right after this
24
-
25
- ! "/orca_presence",
26
- * => Will receive /sr_res right here.
27
- */
28
-
29
- var WebSocket_Global;
30
-
31
- function buildProxy() {
32
- var Proxy = new Transform({
33
- objectMode: false
34
- });
35
-
36
- Proxy._write = function socketWriteNode(chunk, enc, next) {
37
- if (WebSocket_Global.readyState !== WebSocket_Global.OPEN) {
38
- return next();
39
- }
40
-
41
- if (typeof chunk === 'string') {
42
- chunk = new Buffer.from(chunk, 'utf8');
43
- }
44
- WebSocket_Global.send(chunk, next);
45
- };
46
-
47
- Proxy._flush = function(done) {
48
- WebSocket_Global.close();
49
- done();
50
- };
51
-
52
- Proxy._writev = function(chunks, cb) {
53
- var buffers = new Array(chunks.length);
54
- for (var i = 0; i < chunks.length; i++) {
55
- if (typeof chunks[i].chunk === 'string') {
56
- buffers[i] = new Buffer.from(chunks[i], 'utf8');
57
- } else {
58
- buffers[i] = chunks[i].chunk;
59
- }
60
- }
61
- this._write(new Buffer.concat(buffers), 'binary', cb);
62
- };
63
-
64
- return Proxy;
65
- }
66
-
67
- function buildStream(options, WebSocket, Proxy) {
68
- const Stream = Duplexify(undefined, undefined, options);
69
- Stream.socket = WebSocket;
70
-
71
- WebSocket
72
- .onclose = function() {
73
- Stream.end();
74
- Stream.destroy();
75
- };
76
- WebSocket
77
- .onerror = function(err) {
78
- Stream.destroy(err);
79
- };
80
- WebSocket
81
- .onmessage = function(event) {
82
- var data = event.data;
83
- if (data instanceof ArrayBuffer) data = new Buffer.from(data);
84
- else data = new Buffer.from(data, 'utf8');
85
- Stream.push(data);
86
- };
87
- WebSocket
88
- .onopen = function() {
89
- Stream.setReadable(Proxy);
90
- Stream.setWritable(Proxy);
91
- Stream.emit('connect');
92
- };
93
- WebSocket_Global = WebSocket;
94
- Proxy.on('close', function() { WebSocket.close(); });
95
- return Stream;
96
- }
97
-
98
-
99
- function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
100
- //Don't really know what this does but I think it's for the act`ive state?
101
- //TODO: Move to ctx when implemented
102
- var chatOn = ctx.globalOptions.online;
103
- var foreground = false;
104
-
105
- var sessionID = Math.floor((Math.random() * Number.MAX_SAFE_INTEGER)+1);
106
- var username = {u: ctx.userID,s: sessionID,chat_on: chatOn,fg: foreground,d: utils.getGUID(),ct: "websocket",aid: "219994525426954", mqtt_sid: "",cp: 3,ecp: 10,st: [],pm: [],dc: "",no_auto_fg: true,gas: null,pack: []};
107
- var cookies = ctx.jar.getCookies('https://www.facebook.com').join("; ");
108
-
109
- var host;
110
- if (ctx.mqttEndpoint) host = `${ctx.mqttEndpoint}&sid=${sessionID}`;
111
- else if (ctx.region) host = `wss://edge-chat.facebook.com/chat?region=${ctx.region.toLocaleLowerCase()}&sid=${sessionID}`;
112
- else host = `wss://edge-chat.facebook.com/chat?sid=${sessionID}`;
113
-
114
- var options = {
115
- clientId: "mqttwsclient",
116
- protocolId: 'MQIsdp',
117
- protocolVersion: 3,
118
- username: JSON.stringify(username),
119
- clean: true,
120
- wsOptions: {
121
- headers: {
122
- 'Cookie': cookies,
123
- 'Origin': 'https://www.facebook.com',
124
- 'User-Agent': (ctx.globalOptions.userAgent || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36'),
125
- 'Referer': 'https://www.facebook.com/',
126
- 'Host': new URL(host).hostname //'edge-chat.facebook.com'
127
- },
128
- origin: 'https://www.facebook.com',
129
- protocolVersion: 13,
130
- binaryType: 'arraybuffer',
131
- },
132
- keepalive: 60,
133
- reschedulePings: true,
134
- reconnectPeriod: 3
135
- };
136
-
137
- if (typeof ctx.globalOptions.proxy != "undefined") {
138
- var agent = new HttpsProxyAgent(ctx.globalOptions.proxy);
139
- options.wsOptions.agent = agent;
140
- }
141
- ctx.mqttClient = new mqtt.Client(_ => buildStream(options, new Websocket(host, options.wsOptions), buildProxy()), options);
142
- global.mqttClient = ctx.mqttClient;
143
-
144
- global.mqttClient.on('error', function (err) {
145
- log.error("listenMqtt", err);
146
- global.mqttClient.end();
147
-
148
- if (ctx.globalOptions.autoReconnect) getSeqID();
149
- else {
150
- globalCallback({ type: "stop_listen", error: "Server Đã Sập - Auto Restart" }, null);
151
- return process.exit(1);
152
- }
153
- });
154
-
155
- global.mqttClient.on('connect', function () {
156
- if (!global.Fca.Data.Setup || global.Fca.Data.Setup == undefined) {
157
- if (global.Fca.Require.FastConfig.RestartMQTT_Minutes != 0 && global.Fca.Data.StopListening != true) {
158
- global.Fca.Data.Setup = true;
159
- setTimeout(() => {
160
- global.Fca.Require.logger.Warning("Closing MQTT Client...");
161
- ctx.mqttClient.end();
162
- global.Fca.Require.logger.Warning("Reconnecting MQTT Client...");
163
- global.Fca.Data.Setup = false;
164
- getSeqID();
165
- }, Number(global.Fca.Require.FastConfig.RestartMQTT_Minutes) * 60 * 1000);
166
- }
167
- }
168
- if (process.env.OnStatus == undefined) {
169
- global.Fca.Require.logger.Normal("Bạn Đang Sài Phiên Bản: Premium Access");
170
- if (Number(global.Fca.Require.FastConfig.AutoRestartMinutes) == 0) {
171
- // something
172
- }
173
- else if (Number(global.Fca.Require.FastConfig.AutoRestartMinutes < 10)) {
174
- log.warn("AutoRestartMinutes","The number of minutes to automatically restart must be more than 10 minutes");
175
- }
176
- else if (Number(global.Fca.Require.FastConfig.AutoRestartMinutes) < 0) {
177
- log.warn("AutoRestartMinutes","Invalid auto-restart minutes!");
178
- }
179
- else {
180
- global.Fca.Require.logger.Normal(global.Fca.getText(global.Fca.Require.Language.Src.AutoRestart,global.Fca.Require.FastConfig.AutoRestartMinutes));
181
- global.Fca.Require.logger.Normal("Auto Restart MQTT Client After: " + global.Fca.Require.FastConfig.RestartMQTT_Minutes + " Minutes");
182
- setInterval(() => {
183
- global.Fca.Require.logger.Normal(global.Fca.Require.Language.Src.OnRestart);
184
- process.exit(1);
185
- }, Number(global.Fca.Require.FastConfig.AutoRestartMinutes) * 60000);
186
- }
187
- require('../broadcast').startBroadcasting();
188
- const MemoryManager = require('../Extra/Src/Release_Memory');
189
- const path = require('path');
190
-
191
- const memoryManager = new MemoryManager({
192
- warningThreshold: 0.6,
193
- releaseThreshold: 0.7,
194
- maxThreshold: 0.8,
195
- interval: 30 * 1000,
196
- logLevel: 'warn',
197
- logFile: path.join(__dirname, 'memory.log'),
198
- smartReleaseEnabled: true,
199
- });
200
-
201
-
202
- memoryManager.autoStart(60 * 60 * 1000);
203
-
204
- process.env.OnStatus = true;
205
- }
206
-
207
- topics.forEach(topicsub => global.mqttClient.subscribe(topicsub));
208
-
209
- var topic;
210
- var queue = {
211
- sync_api_version: 11,
212
- max_deltas_able_to_process: 100,
213
- delta_batch_size: 500,
214
- encoding: "JSON",
215
- entity_fbid: ctx.userID,
216
- };
217
-
218
- topic = "/messenger_sync_create_queue";
219
- queue.initial_titan_sequence_id = ctx.lastSeqId;
220
- queue.device_params = null;
221
-
222
- global.mqttClient.publish(topic, JSON.stringify(queue), { qos: 1, retain: false });
223
-
224
- var rTimeout = setTimeout(function () {
225
- global.mqttClient.end();
226
- getSeqID();
227
- }, 3000);
228
-
229
- ctx.tmsWait = function () {
230
- clearTimeout(rTimeout);
231
- ctx.globalOptions.emitReady ? globalCallback({type: "ready",error: null}) : '';
232
- delete ctx.tmsWait;
233
- };
234
- });
235
-
236
- global.mqttClient.on('message', function (topic, message, _packet) {
237
- const jsonMessage = JSON.parse(message.toString());
238
- console.log(message.toString())
239
- if (topic === "/t_ms") {
240
- if (ctx.tmsWait && typeof ctx.tmsWait == "function") ctx.tmsWait();
241
-
242
- if (jsonMessage.firstDeltaSeqId && jsonMessage.syncToken) {
243
- ctx.lastSeqId = jsonMessage.firstDeltaSeqId;
244
- ctx.syncToken = jsonMessage.syncToken;
245
- }
246
-
247
- if (jsonMessage.lastIssuedSeqId) ctx.lastSeqId = parseInt(jsonMessage.lastIssuedSeqId);
248
- //If it contains more than 1 delta
249
- for (var i in jsonMessage.deltas) {
250
- var delta = jsonMessage.deltas[i];
251
- parseDelta(defaultFuncs, api, ctx, globalCallback, { "delta": delta });
252
- }
253
- }
254
- else if (topic === "/ls_resp") {
255
- console.log((jsonMessage.payload));
256
- const payload = JSON.parse(jsonMessage.payload); //'{"name":null,"step":[1,[1,[4,0,1,[5,"taskExists",[19,"415"]]],[23,[2,0],[1,[5,"replaceOptimsiticMessage","7192532113093667880","mid.$gABfX5li9LA6VdUymnWPRAdlkiawo"]]]],[1,[4,0,1,[5,"taskExists",[19,"415"]]],[23,[2,0],[1,[5,"mailboxTaskCompletionApiOnTaskCompletion",[19,"415"],true]]]],[1,[4,0,1,[5,"taskExists",[19,"415"]]],[23,[2,0],[1,[5,"removeTask",[19,"415"],[9]]]]]]}'
257
- const request_ID = jsonMessage.request_id;
258
- if (ctx.callback_Task[request_ID] != undefined) {
259
- const { callback, type } = ctx.callback_Task[request_ID];
260
- const Data = new getRespData(type, payload);
261
-
262
- if (!Data) {
263
- callback("Something went wrong 🐳", null);
264
- }
265
- else {
266
- callback(null, Data);
267
- }
268
- }
269
- }
270
- else if (topic === "/thread_typing" || topic === "/orca_typing_notifications") {
271
- var typ = {
272
- type: "typ",
273
- isTyping: !!jsonMessage.state,
274
- from: jsonMessage.sender_fbid.toString(),
275
- threadID: utils.formatID((jsonMessage.thread || jsonMessage.sender_fbid).toString())
276
- };
277
- (function () { globalCallback(null, typ); })();
278
- } else if (topic === "/orca_presence") {
279
- if (!ctx.globalOptions.updatePresence) {
280
- for (var i in jsonMessage.list) {
281
- var data = jsonMessage.list[i];
282
- var userID = data["u"];
283
-
284
- var presence = {
285
- type: "presence",
286
- userID: userID.toString(),
287
- //Convert to ms
288
- timestamp: data["l"] * 1000,
289
- statuses: data["p"]
290
- };
291
- (function () { globalCallback(null, presence); })();
292
- }
293
- }
294
- }
295
-
296
- });
297
-
298
- process.on('SIGINT', function () {
299
- LogUptime();
300
- process.kill(process.pid);
301
- });
302
-
303
- process.on('exit', () => {
304
- LogUptime();
305
- });
306
-
307
- }
308
-
309
- function getRespData(Type, payload) {
310
- try {
311
- switch (Type) {
312
- case "sendMqttMessage": {
313
- return {
314
- type: Type,
315
- threadID: payload.step[1][2][2][1][2], //this is sick bro
316
- messageID: payload.step[1][2][2][1][3],
317
- payload: payload.step[1][2]
318
- };
319
- }
320
- default: { //!very LAZY :> cook yourself
321
- return {
322
- Data: payload.step[1][2][2][1],
323
- type: Type,
324
- payload: payload.step[1][2]
325
- };
326
- }
327
- }
328
- }
329
- catch (e) {
330
- return null;
331
- }
332
- }
333
-
334
- function LogUptime() {
335
- var uptime = process.uptime();
336
- var { join } = require('path');
337
- if (global.Fca.Require.fs.existsSync(join(__dirname, '../CountTime.json'))) {
338
- var Time1 = (Number(global.Fca.Require.fs.readFileSync(join(__dirname, '../CountTime.json'), 'utf8')) || 0);
339
- global.Fca.Require.fs.writeFileSync(join(__dirname, '../CountTime.json'), String(Number(uptime) + Time1), 'utf8');
340
- }
341
- else {
342
- var Time1 = 0;
343
- global.Fca.Require.fs.writeFileSync(join(__dirname, '../CountTime.json'), String(Number(uptime) + Time1), 'utf8');
344
- }
345
- }
346
- function parseDelta(defaultFuncs, api, ctx, globalCallback, v) {
347
- if (v.delta.class == "NewMessage") {
348
- //Not tested for pages
349
- if (ctx.globalOptions.pageID && ctx.globalOptions.pageID != v.queue) return;
350
-
351
- (function resolveAttachmentUrl(i) {
352
- if (v.delta.attachments && (i == v.delta.attachments.length) || utils.getType(v.delta.attachments) !== "Array") {
353
- var fmtMsg;
354
- try {
355
- fmtMsg = utils.formatDeltaMessage(v);
356
- } catch (err) {
357
- return log.error("Lỗi Nhẹ", err);
358
- }
359
- global.Fca.Data.event = fmtMsg;
360
- try {
361
- var { updateMessageCount,getData,hasData } = require('../Extra/ExtraGetThread');
362
- if (hasData(fmtMsg.threadID)) {
363
- var x = getData(fmtMsg.threadID);
364
- x.messageCount+=1;
365
- updateMessageCount(fmtMsg.threadID,x);
366
- }
367
- }
368
- catch (e) {
369
- //temp
370
- }
371
- if (fmtMsg)
372
- if (ctx.globalOptions.autoMarkDelivery) markDelivery(ctx, api, fmtMsg.threadID, fmtMsg.messageID);
373
-
374
- return !ctx.globalOptions.selfListen && fmtMsg.senderID === ctx.userID ? undefined : (function () { globalCallback(null, fmtMsg); })();
375
- } else {
376
- if (v.delta.attachments && (v.delta.attachments[i].mercury.attach_type == "photo")) {
377
- api.resolvePhotoUrl(v.delta.attachments[i].fbid, (err, url) => {
378
- if (!err) v.delta.attachments[i].mercury.metadata.url = url;
379
- return resolveAttachmentUrl(i + 1);
380
- });
381
- } else return resolveAttachmentUrl(i + 1);
382
- }
383
- })(0);
384
- }
385
-
386
- if (v.delta.class == "ClientPayload") {
387
- var clientPayload = utils.decodeClientPayload(v.delta.payload);
388
- if (clientPayload && clientPayload.deltas) {
389
- for (var i in clientPayload.deltas) {
390
- var delta = clientPayload.deltas[i];
391
- if (delta.deltaMessageReaction && !!ctx.globalOptions.listenEvents) {
392
- (function () {
393
- globalCallback(null, {
394
- type: "message_reaction",
395
- threadID: (delta.deltaMessageReaction.threadKey.threadFbId ? delta.deltaMessageReaction.threadKey.threadFbId : delta.deltaMessageReaction.threadKey.otherUserFbId).toString(),
396
- messageID: delta.deltaMessageReaction.messageId,
397
- reaction: delta.deltaMessageReaction.reaction,
398
- senderID: delta.deltaMessageReaction.senderId.toString(),
399
- userID: delta.deltaMessageReaction.userId.toString()
400
- });
401
- })();
402
- } else if (delta.deltaRecallMessageData && !!ctx.globalOptions.listenEvents) {
403
- (function () {
404
- globalCallback(null, {
405
- type: "message_unsend",
406
- threadID: (delta.deltaRecallMessageData.threadKey.threadFbId ? delta.deltaRecallMessageData.threadKey.threadFbId : delta.deltaRecallMessageData.threadKey.otherUserFbId).toString(),
407
- messageID: delta.deltaRecallMessageData.messageID,
408
- senderID: delta.deltaRecallMessageData.senderID.toString(),
409
- deletionTimestamp: delta.deltaRecallMessageData.deletionTimestamp,
410
- timestamp: delta.deltaRecallMessageData.timestamp
411
- });
412
- })();
413
- } else if (delta.deltaMessageReply) {
414
- //Mention block - #1
415
- var mdata =
416
- delta.deltaMessageReply.message === undefined ? [] :
417
- delta.deltaMessageReply.message.data === undefined ? [] :
418
- delta.deltaMessageReply.message.data.prng === undefined ? [] :
419
- JSON.parse(delta.deltaMessageReply.message.data.prng);
420
- var m_id = mdata.map(u => u.i);
421
- var m_offset = mdata.map(u => u.o);
422
- var m_length = mdata.map(u => u.l);
423
-
424
- var mentions = {};
425
-
426
- for (var i = 0; i < m_id.length; i++) mentions[m_id[i]] = (delta.deltaMessageReply.message.body || "").substring(m_offset[i], m_offset[i] + m_length[i]);
427
- //Mention block - 1#
428
- var callbackToReturn = {
429
- type: "message_reply",
430
- threadID: (delta.deltaMessageReply.message.messageMetadata.threadKey.threadFbId ? delta.deltaMessageReply.message.messageMetadata.threadKey.threadFbId : delta.deltaMessageReply.message.messageMetadata.threadKey.otherUserFbId).toString(),
431
- messageID: delta.deltaMessageReply.message.messageMetadata.messageId,
432
- senderID: delta.deltaMessageReply.message.messageMetadata.actorFbId.toString(),
433
- attachments: delta.deltaMessageReply.message.attachments.map(function (att) {
434
- var mercury = JSON.parse(att.mercuryJSON);
435
- Object.assign(att, mercury);
436
- return att;
437
- }).map(att => {
438
- var x;
439
- try {
440
- x = utils._formatAttachment(att);
441
- } catch (ex) {
442
- x = att;
443
- x.error = ex;
444
- x.type = "unknown";
445
- }
446
- return x;
447
- }),
448
- args: (delta.deltaMessageReply.message.body || "").trim().split(/\s+/),
449
- body: (delta.deltaMessageReply.message.body || ""),
450
- isGroup: !!delta.deltaMessageReply.message.messageMetadata.threadKey.threadFbId,
451
- mentions: mentions,
452
- timestamp: delta.deltaMessageReply.message.messageMetadata.timestamp,
453
- participantIDs: (delta.deltaMessageReply.message.participants || []).map(e => e.toString())
454
- };
455
-
456
- if (delta.deltaMessageReply.repliedToMessage) {
457
- //Mention block - #2
458
- mdata =
459
- delta.deltaMessageReply.repliedToMessage === undefined ? [] :
460
- delta.deltaMessageReply.repliedToMessage.data === undefined ? [] :
461
- delta.deltaMessageReply.repliedToMessage.data.prng === undefined ? [] :
462
- JSON.parse(delta.deltaMessageReply.repliedToMessage.data.prng);
463
- m_id = mdata.map(u => u.i);
464
- m_offset = mdata.map(u => u.o);
465
- m_length = mdata.map(u => u.l);
466
-
467
- var rmentions = {};
468
-
469
- for (var i = 0; i < m_id.length; i++) rmentions[m_id[i]] = (delta.deltaMessageReply.repliedToMessage.body || "").substring(m_offset[i], m_offset[i] + m_length[i]);
470
- //Mention block - 2#
471
- callbackToReturn.messageReply = {
472
- threadID: (delta.deltaMessageReply.repliedToMessage.messageMetadata.threadKey.threadFbId ? delta.deltaMessageReply.repliedToMessage.messageMetadata.threadKey.threadFbId : delta.deltaMessageReply.repliedToMessage.messageMetadata.threadKey.otherUserFbId).toString(),
473
- messageID: delta.deltaMessageReply.repliedToMessage.messageMetadata.messageId,
474
- senderID: delta.deltaMessageReply.repliedToMessage.messageMetadata.actorFbId.toString(),
475
- attachments: delta.deltaMessageReply.repliedToMessage.attachments.map(function (att) {
476
- var mercury = JSON.parse(att.mercuryJSON);
477
- Object.assign(att, mercury);
478
- return att;
479
- }).map(att => {
480
- var x;
481
- try {
482
- x = utils._formatAttachment(att);
483
- } catch (ex) {
484
- x = att;
485
- x.error = ex;
486
- x.type = "unknown";
487
- }
488
- return x;
489
- }),
490
- args: (delta.deltaMessageReply.repliedToMessage.body || "").trim().split(/\s+/),
491
- body: delta.deltaMessageReply.repliedToMessage.body || "",
492
- isGroup: !!delta.deltaMessageReply.repliedToMessage.messageMetadata.threadKey.threadFbId,
493
- mentions: rmentions,
494
- timestamp: delta.deltaMessageReply.repliedToMessage.messageMetadata.timestamp,
495
- participantIDs: (delta.deltaMessageReply.repliedToMessage.participants || []).map(e => e.toString())
496
- };
497
- } else if (delta.deltaMessageReply.replyToMessageId) {
498
- return defaultFuncs
499
- .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, {
500
- "av": ctx.globalOptions.pageID,
501
- "queries": JSON.stringify({
502
- "o0": {
503
- //Using the same doc_id as forcedFetch
504
- "doc_id": "2848441488556444",
505
- "query_params": {
506
- "thread_and_message_id": {
507
- "thread_id": callbackToReturn.threadID,
508
- "message_id": delta.deltaMessageReply.replyToMessageId.id,
509
- }
510
- }
511
- }
512
- })
513
- })
514
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
515
- .then((resData) => {
516
- if (resData[resData.length - 1].error_results > 0) throw resData[0].o0.errors;
517
- if (resData[resData.length - 1].successful_results === 0) throw { error: "forcedFetch: there was no successful_results", res: resData };
518
- var fetchData = resData[0].o0.data.message;
519
- var mobj = {};
520
- for (var n in fetchData.message.ranges) mobj[fetchData.message.ranges[n].entity.id] = (fetchData.message.text || "").substr(fetchData.message.ranges[n].offset, fetchData.message.ranges[n].length);
521
-
522
- callbackToReturn.messageReply = {
523
- type: "Message",
524
- threadID: callbackToReturn.threadID,
525
- messageID: fetchData.message_id,
526
- senderID: fetchData.message_sender.id.toString(),
527
- attachments: fetchData.message.blob_attachment.map(att => {
528
- var x;
529
- try {
530
- x = utils._formatAttachment({ blob_attachment: att });
531
- } catch (ex) {
532
- x = att;
533
- x.error = ex;
534
- x.type = "unknown";
535
- }
536
- return x;
537
- }),
538
- args: (fetchData.message.text || "").trim().split(/\s+/) || [],
539
- body: fetchData.message.text || "",
540
- isGroup: callbackToReturn.isGroup,
541
- mentions: mobj,
542
- timestamp: parseInt(fetchData.timestamp_precise)
543
- };
544
- })
545
- .catch(err => log.error("forcedFetch", err))
546
- .finally(function () {
547
- if (ctx.globalOptions.autoMarkDelivery) markDelivery(ctx, api, callbackToReturn.threadID, callbackToReturn.messageID);
548
- !ctx.globalOptions.selfListen && callbackToReturn.senderID === ctx.userID ? undefined : (function () { globalCallback(null, callbackToReturn); })();
549
- });
550
- } else callbackToReturn.delta = delta;
551
-
552
- if (ctx.globalOptions.autoMarkDelivery) markDelivery(ctx, api, callbackToReturn.threadID, callbackToReturn.messageID);
553
-
554
- return !ctx.globalOptions.selfListen && callbackToReturn.senderID === ctx.userID ? undefined : (function () { globalCallback(null, callbackToReturn); })();
555
- }
556
- }
557
- return;
558
- }
559
- }
560
- switch (v.delta.class) {
561
- case "ReadReceipt": {
562
- var fmtMsg;
563
- try {
564
- fmtMsg = utils.formatDeltaReadReceipt(v.delta);
565
- } catch (err) {
566
- return log.error("Lỗi Nhẹ", err);
567
- }
568
- return (function () { globalCallback(null, fmtMsg); })();
569
- }
570
- case "AdminTextMessage": {
571
- switch (v.delta.type) {
572
- case "joinable_group_link_mode_change":
573
- case "magic_words":
574
- case "pin_messages_v2":
575
- case "change_thread_theme":
576
- case "change_thread_icon":
577
- case "change_thread_nickname":
578
- case "change_thread_admins":
579
- case "change_thread_approval_mode":
580
- case "group_poll":
581
- case "messenger_call_log":
582
- case "participant_joined_group_call":
583
- var fmtMsg;
584
- try {
585
- fmtMsg = utils.formatDeltaEvent(v.delta);
586
- } catch (err) {
587
- console.log(v.delta);
588
- return log.error("Lỗi Nhẹ", err);
589
- }
590
- return (function () { globalCallback(null, fmtMsg); })();
591
- }
592
- break;
593
- }
594
- //For group images
595
- case "ForcedFetch": {
596
- if (!v.delta.threadKey) return;
597
- var mid = v.delta.messageId;
598
- var tid = v.delta.threadKey.threadFbId;
599
- if (mid && tid) {
600
- const form = {
601
- "av": ctx.globalOptions.pageID,
602
- "queries": JSON.stringify({
603
- "o0": {
604
- //This doc_id is valid as of March 25, 2020
605
- "doc_id": "2848441488556444",
606
- "query_params": {
607
- "thread_and_message_id": {
608
- "thread_id": tid.toString(),
609
- "message_id": mid,
610
- }
611
- }
612
- }
613
- })
614
- };
615
-
616
- defaultFuncs
617
- .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
618
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
619
- .then((resData) => {
620
- if (resData[resData.length - 1].error_results > 0) throw resData[0].o0.errors;
621
-
622
- if (resData[resData.length - 1].successful_results === 0) throw { error: "forcedFetch: there was no successful_results", res: resData };
623
-
624
- var fetchData = resData[0].o0.data.message;
625
-
626
- if (utils.getType(fetchData) == "Object") {
627
- log.info("forcedFetch", fetchData);
628
- switch (fetchData.__typename) {
629
- case "ThreadImageMessage":
630
- (!ctx.globalOptions.selfListen &&
631
- fetchData.message_sender.id.toString() === ctx.userID) ||
632
- !ctx.loggedIn ?
633
- undefined :
634
- (function () {
635
- globalCallback(null, {
636
- type: "change_thread_image",
637
- threadID: utils.formatID(tid.toString()),
638
- snippet: fetchData.snippet,
639
- timestamp: fetchData.timestamp_precise,
640
- author: fetchData.message_sender.id,
641
- image: {
642
- attachmentID: fetchData.image_with_metadata && fetchData.image_with_metadata.legacy_attachment_id,
643
- width: fetchData.image_with_metadata && fetchData.image_with_metadata.original_dimensions.x,
644
- height: fetchData.image_with_metadata && fetchData.image_with_metadata.original_dimensions.y,
645
- url: fetchData.image_with_metadata && fetchData.image_with_metadata.preview.uri
646
- }
647
- });
648
- })();
649
- break;
650
- case "UserMessage":
651
- log.info("ff-Return", {
652
- type: "message",
653
- senderID: utils.formatID(fetchData.message_sender.id),
654
- body: fetchData.message.text || "",
655
- threadID: utils.formatID(tid.toString()),
656
- messageID: fetchData.message_id,
657
- attachments: [{
658
- type: "share",
659
- ID: fetchData.extensible_attachment.legacy_attachment_id,
660
- url: fetchData.extensible_attachment.story_attachment.url,
661
-
662
- title: fetchData.extensible_attachment.story_attachment.title_with_entities.text,
663
- description: fetchData.extensible_attachment.story_attachment.description.text,
664
- source: fetchData.extensible_attachment.story_attachment.source,
665
-
666
- image: ((fetchData.extensible_attachment.story_attachment.media || {}).image || {}).uri,
667
- width: ((fetchData.extensible_attachment.story_attachment.media || {}).image || {}).width,
668
- height: ((fetchData.extensible_attachment.story_attachment.media || {}).image || {}).height,
669
- playable: (fetchData.extensible_attachment.story_attachment.media || {}).is_playable || false,
670
- duration: (fetchData.extensible_attachment.story_attachment.media || {}).playable_duration_in_ms || 0,
671
-
672
- subattachments: fetchData.extensible_attachment.subattachments,
673
- properties: fetchData.extensible_attachment.story_attachment.properties,
674
- }],
675
- mentions: {},
676
- timestamp: parseInt(fetchData.timestamp_precise),
677
- isGroup: (fetchData.message_sender.id != tid.toString())
678
- });
679
- globalCallback(null, {
680
- type: "message",
681
- senderID: utils.formatID(fetchData.message_sender.id),
682
- body: fetchData.message.text || "",
683
- threadID: utils.formatID(tid.toString()),
684
- messageID: fetchData.message_id,
685
- attachments: [{
686
- type: "share",
687
- ID: fetchData.extensible_attachment.legacy_attachment_id,
688
- url: fetchData.extensible_attachment.story_attachment.url,
689
-
690
- title: fetchData.extensible_attachment.story_attachment.title_with_entities.text,
691
- description: fetchData.extensible_attachment.story_attachment.description.text,
692
- source: fetchData.extensible_attachment.story_attachment.source,
693
-
694
- image: ((fetchData.extensible_attachment.story_attachment.media || {}).image || {}).uri,
695
- width: ((fetchData.extensible_attachment.story_attachment.media || {}).image || {}).width,
696
- height: ((fetchData.extensible_attachment.story_attachment.media || {}).image || {}).height,
697
- playable: (fetchData.extensible_attachment.story_attachment.media || {}).is_playable || false,
698
- duration: (fetchData.extensible_attachment.story_attachment.media || {}).playable_duration_in_ms || 0,
699
-
700
- subattachments: fetchData.extensible_attachment.subattachments,
701
- properties: fetchData.extensible_attachment.story_attachment.properties,
702
- }],
703
- mentions: {},
704
- timestamp: parseInt(fetchData.timestamp_precise),
705
- isGroup: (fetchData.message_sender.id != tid.toString())
706
- });
707
- }
708
- } else log.error("forcedFetch", fetchData);
709
- })
710
- .catch((err) => log.error("forcedFetch", err));
711
- }
712
- }
713
- break;
714
- case "ThreadName":
715
- case "ParticipantsAddedToGroupThread":
716
- case "ParticipantLeftGroupThread": {
717
- var formattedEvent;
718
- try {
719
- formattedEvent = utils.formatDeltaEvent(v.delta);
720
- } catch (err) {
721
- console.log(err);
722
- return log.error("Lỗi Nhẹ", err);
723
- }
724
- return (!ctx.globalOptions.selfListen && formattedEvent.author.toString() === ctx.userID) || !ctx.loggedIn ? undefined : (function () { globalCallback(null, formattedEvent); })();
725
- }
726
- case "NewMessage": {
727
- if (v.delta.attachments != undefined && v.delta.attachments.length == 1 && v.delta.attachments[0].mercury.extensible_attachment != undefined && v.delta.attachments[0].mercury.extensible_attachment.story_attachment.style_list.includes("message_live_location")) {
728
- v.delta.class = "UserLocation";
729
- var fmtMsg;
730
- try {
731
- fmtMsg = utils.formatDeltaEvent(v.delta);
732
- } catch (err) {
733
- console.log(v.delta);
734
- return log.error("Lỗi Nhẹ", err);
735
- }
736
- return (function () { globalCallback(null, fmtMsg); })();
737
- }
738
- }
739
- break;
740
- }
741
- }
742
-
743
-
744
- function markDelivery(ctx, api, threadID, messageID) {
745
- if (threadID && messageID) {
746
- api.markAsDelivered(threadID, messageID, (err) => {
747
- if (err) log.error("markAsDelivered", err);
748
- else {
749
- if (ctx.globalOptions.autoMarkRead) {
750
- api.markAsRead(threadID, (err) => {
751
- if (err) log.error("markAsDelivered", err);
752
- });
753
- }
754
- }
755
- });
756
- }
757
- }
758
-
759
- module.exports = function (defaultFuncs, api, ctx) {
760
- var globalCallback = identity;
761
- getSeqID = function getSeqID() {
762
- ctx.t_mqttCalled = false;
763
- defaultFuncs
764
- .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
765
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
766
- .then((resData) => {
767
- if (utils.getType(resData) != "Array") {
768
- if (global.Fca.Require.FastConfig.AutoLogin) {
769
- return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
770
- return global.Fca.Action('AutoLogin');
771
- });
772
- }
773
- else if (!global.Fca.Require.FastConfig.AutoLogin) {
774
- return global.Fca.Require.logger.Error(global.Fca.Require.Language.Index.ErrAppState);
775
- }
776
- return;
777
- }
778
- else {
779
- if (resData && resData[resData.length - 1].error_results > 0) throw resData[0].o0.errors;
780
- if (resData[resData.length - 1].successful_results === 0) throw { error: "getSeqId: there was no successful_results", res: resData };
781
- if (resData[0].o0.data.viewer.message_threads.sync_sequence_id) {
782
- ctx.lastSeqId = resData[0].o0.data.viewer.message_threads.sync_sequence_id;
783
- listenMqtt(defaultFuncs, api, ctx, globalCallback);
784
- }
785
- else throw { error: "getSeqId: no sync_sequence_id found.", res: resData };
786
- }
787
- })
788
- .catch((err) => {
789
- log.error("getSeqId", err);
790
- if (utils.getType(err) == "Object" && err.error === global.Fca.Require.Language.Index.ErrAppState) ctx.loggedIn = false;
791
- return globalCallback(err);
792
- });
793
- };
794
-
795
- return function (callback) {
796
- class MessageEmitter extends EventEmitter {
797
- stopListening(callback) {
798
- callback = callback || (() => { });
799
- globalCallback = identity;
800
- if (ctx.mqttClient) {
801
- ctx.mqttClient.unsubscribe("/webrtc");
802
- ctx.mqttClient.unsubscribe("/rtc_multi");
803
- ctx.mqttClient.unsubscribe("/onevc");
804
- ctx.mqttClient.publish("/browser_close", "{}");
805
- ctx.mqttClient.end(false, function (...data) {
806
- ctx.mqttClient = undefined;
807
- });
808
- }
809
- global.Fca.Data.StopListening = true;
810
- }
811
- }
812
-
813
- var msgEmitter = new MessageEmitter();
814
- globalCallback = (callback || function (error, message) {
815
- if (error) return msgEmitter.emit("error", error);
816
- msgEmitter.emit("message", message);
817
- });
818
-
819
- //Reset some stuff
820
- if (!ctx.firstListen) ctx.lastSeqId = null;
821
- ctx.syncToken = undefined;
822
- ctx.t_mqttCalled = false;
823
-
824
- //Same request as getThreadList
825
- form = {
826
- "av": ctx.globalOptions.pageID,
827
- "queries": JSON.stringify({
828
- "o0": {
829
- "doc_id": "3336396659757871",
830
- "query_params": {
831
- "limit": 1,
832
- "before": null,
833
- "tags": ["INBOX"],
834
- "includeDeliveryReceipts": false,
835
- "includeSeqID": true
836
- }
837
- }
838
- })
839
- };
840
-
841
- if (!ctx.firstListen || !ctx.lastSeqId) getSeqID();
842
- else listenMqtt(defaultFuncs, api, ctx, globalCallback);
843
- ctx.firstListen = false;
844
- return msgEmitter;
845
- };
846
- };