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
package/Main.js DELETED
@@ -1,1444 +0,0 @@
1
- 'use strict';
2
-
3
- //-[ Require config and use ]-!/
4
-
5
- if (global.Fca.Require.FastConfig.Config != 'default') {
6
- //do ssth
7
- }
8
-
9
- const Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == global.Fca.Require.FastConfig.Language).Folder.Index;
10
-
11
- //-[ Require All Package Need Use ]-!/
12
-
13
- var utils = global.Fca.Require.utils,
14
- logger = global.Fca.Require.logger,
15
- fs = global.Fca.Require.fs,
16
- getText = global.Fca.getText,
17
- log = global.Fca.Require.log,
18
- express = require("express")(),
19
- { join } = require('path'),
20
- cheerio = require("cheerio"),
21
- { readFileSync, writeFileSync } = require('fs-extra'),
22
- Database = require("./Extra/Database"),
23
- readline = require("readline"),
24
- chalk = require("chalk"),
25
- figlet = require("figlet"),
26
- os = require("os"),
27
- deasync = require('deasync'),
28
- Security = require("./Extra/Security/Base"),
29
- { getAll, deleteAll } = require('./Extra/ExtraGetThread'),
30
- ws = require('ws'),
31
- Websocket = require('./Extra/Src/Websocket'),
32
- Convert = require('ansi-to-html');
33
-
34
- //-[ Set Variable For Process ]-!/
35
-
36
- log.maxRecordSize = 100;
37
- var checkVerified = null;
38
- const Boolean_Option = ['online','selfListen','listenEvents','updatePresence','forceLogin','autoMarkDelivery','autoMarkRead','listenTyping','autoReconnect','emitReady'];
39
-
40
- //-[ Set And Check Template HTML ]-!/
41
-
42
- const css = readFileSync(join(__dirname, 'Extra', 'Html', 'Classic', 'style.css'));
43
- const js = readFileSync(join(__dirname, 'Extra', 'Html', 'Classic', 'script.js'));
44
-
45
- //-[ Function Generate HTML Template ]-!/
46
-
47
- /**
48
- * It returns a string of HTML code.
49
- * @param UserName - The username of the user
50
- * @param Type - The type of user, either "Free" or "Premium"
51
- * @param link - The link to the music you want to play
52
- * @returns A HTML file
53
- */
54
-
55
- function ClassicHTML(UserName,Type,link) {
56
- return `<!DOCTYPE html>
57
- <html lang="en" >
58
- <head>
59
- <meta charset="UTF-8">
60
- <title>Horizon</title>
61
- <link rel="stylesheet" href="./style.css">
62
- </head>
63
- <body>
64
- <center>
65
- <marquee><b>waiting for u :d</b></marquee>
66
- <h2>Horizon User Infomation</h2>
67
- <h3>UserName: ${UserName} | Type: ${Type}</h3>
68
- <canvas id="myCanvas"></canvas>
69
- <script src="./script.js"></script>
70
- <footer class="footer">
71
- <div id="music">
72
- <audio autoplay="false" controls="true" loop="true" src="${link}" __idm_id__="5070849">Your browser does not support the audio element.</audio>
73
- <br><b>Session ID:</b> ${global.Fca.Require.Security.create().uuid}<br>
74
- <br>Thanks For Using <b>Fca-Horizon-Remastered</b> - From <b>Kanzu</b> <3<br>
75
- </div>
76
- </footer>
77
- </div>
78
- </center>
79
- </html>
80
- </body>`
81
- //lazy to change
82
- }
83
-
84
-
85
-
86
- //-[ Stating Http Infomation ]-!/
87
-
88
- express.set('DFP', (process.env.PORT || process.env.port || 80));
89
-
90
- express.use(function(req, res, next) {
91
- switch (req.url.split('?')[0]) {
92
- case '/script.js': {
93
- res.writeHead(200, { 'Content-Type': 'text/javascript' });
94
- res.write(js);
95
- break;
96
- }
97
- case '/style.css': {
98
- res.writeHead(200, { 'Content-Type': 'text/css' });
99
- res.write(css);
100
- break;
101
- }
102
- default: {
103
- res.writeHead(200, "OK", { "Content-Type": "text/html" });
104
- res.write(ClassicHTML(global.Fca.Require.FastConfig.HTML.UserName, "Premium Access", global.Fca.Require.FastConfig.HTML.MusicLink));
105
- }
106
- }
107
- res.end();
108
- })
109
- var Server;
110
- if (global.Fca.Require.FastConfig.HTML.HTML) Server= express.listen(express.get('DFP'));
111
-
112
- /*
113
- function escapeHTML(input) {
114
- const entityMap = {'&': '&','<': '<','>': '>','"': '"',"'": '\''};
115
- return String(input).replace(/[&<>"'`=\/]/g, function(s) {
116
- return entityMap[s];
117
- });
118
- }
119
- //avoid html injection
120
-
121
- if (global.Fca.Require.FastConfig.Websocket_Extension.Status) {
122
- var convert = new Convert();
123
- if (Server != undefined) {
124
- const WebSocket = new ws.Server({ noServer: true });
125
- const { Client, WSS } = Websocket.connect(WebSocket);
126
- Server.on('upgrade', (req, socket, head) => {
127
- const escapedReq = escapeHTML(req);
128
- const escapedSocket = escapeHTML(socket);
129
- const escapedHead = escapeHTML(head);
130
- WSS.handleUpgrade(escapedReq, escapedSocket, escapedHead, (wss) => {
131
- const escapedWss = escapeHTML(wss);
132
- const escapedReq = escapeHTML(req);
133
-
134
- escapedWss.emit('connection', escapedWss, escapedReq);
135
- });
136
- });
137
- console._log = console.__log
138
- console.log = function(data) {
139
- const All = Object.keys(Client)
140
- console._log.apply(data,arguments)
141
- try {
142
- const log = (convert.toHtml(data) || data || "Nothing to show")
143
- console.history.push(log)
144
- if (console.history.length > 80) {
145
- console.history.shift();
146
- }
147
- for (let i of All) {
148
- if (Client[i].Status) {
149
- Client[i].Websocket.send(JSON.stringify({ Type: "Console", Data: log }));
150
- }
151
- else continue;
152
- }
153
- }
154
- catch (e) {
155
- return;
156
- }
157
- }
158
- }
159
- else {
160
- const WebSocket = new ws.Server({ port: 80 });
161
- const { Client } = Websocket.connect(WebSocket);
162
- console._log = console.__log
163
- console.log = function(data) {
164
- const All = Object.keys(Client)
165
- console._log.apply(data,arguments)
166
- try {
167
- const log = convert.toHtml(data)
168
- console.history.push(log)
169
- if (console.history.length > 80) {
170
- console.history.shift();
171
- }
172
- for (let i of All) {
173
- if (Client[i].Status) {
174
- Client[i].Websocket.send(JSON.stringify({ Type: "Console", Data: log }));
175
- }
176
- else continue;
177
- }
178
- }
179
- catch (e) {
180
- return
181
- }
182
- }
183
- }
184
-
185
- }
186
- **/
187
- //-[ Function setOptions ]-!/
188
-
189
- /**
190
- * @param {{ [x: string]: boolean; selfListen?: boolean; listenEvents?: boolean; listenTyping?: boolean; updatePresence?: boolean; forceLogin?: boolean; autoMarkDelivery?: boolean; autoMarkRead?: boolean; autoReconnect?: boolean; logRecordSize: any; online?: boolean; emitReady?: boolean; userAgent: any; logLevel?: any; pageID?: any; proxy?: any; }} globalOptions
191
- * @param {{ [x: string]: any; logLevel?: any; forceLogin?: boolean; userAgent?: any; pauseLog?: any; logRecordSize?: any; pageID?: any; proxy?: any; }} options
192
- */
193
-
194
- function setOptions(globalOptions, options) {
195
- Object.keys(options).map(function(key) {
196
- switch (Boolean_Option.includes(key)) {
197
- case true: {
198
- globalOptions[key] = Boolean(options[key]);
199
- break;
200
- }
201
- case false: {
202
- switch (key) {
203
- case 'pauseLog': {
204
- if (options.pauseLog) log.pause();
205
- else log.resume();
206
- break;
207
- }
208
- case 'logLevel': {
209
- log.level = options.logLevel;
210
- globalOptions.logLevel = options.logLevel;
211
- break;
212
- }
213
- case 'logRecordSize': {
214
- log.maxRecordSize = options.logRecordSize;
215
- globalOptions.logRecordSize = options.logRecordSize;
216
- break;
217
- }
218
- case 'pageID': {
219
- globalOptions.pageID = options.pageID.toString();
220
- break;
221
- }
222
- case 'userAgent': {
223
- globalOptions.userAgent = (options.userAgent || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36');
224
- break;
225
- }
226
- case 'proxy': {
227
- if (typeof options.proxy != "string") {
228
- delete globalOptions.proxy;
229
- utils.setProxy();
230
- } else {
231
- globalOptions.proxy = options.proxy;
232
- utils.setProxy(globalOptions.proxy);
233
- }
234
- break;
235
- }
236
- default: {
237
- log.warn("setOptions", "Unrecognized option given to setOptions: " + key);
238
- break;
239
- }
240
- }
241
- break;
242
- }
243
- }
244
- });
245
- }
246
-
247
- function BypassAutomationNotification(resp, jar, globalOptions, appstate,ID) {
248
- global.Fca.BypassAutomationNotification = BypassAutomationNotification
249
- try {
250
- let UID;
251
- if (ID) UID = ID
252
- else {
253
- UID = (appstate.find(i => i.key == 'c_user') || appstate.find(i => i.key == 'i_user'))
254
- UID = UID.value;
255
- }
256
- if (resp !== undefined) {
257
- if (resp.request.uri && resp.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
258
- if (resp.request.uri.href.includes('601051028565049')) {
259
- const fb_dtsg = utils.getFrom(resp.body, '["DTSGInitData",[],{"token":"', '","');
260
- const jazoest = utils.getFrom(resp.body, 'jazoest=', '",');
261
- const lsd = utils.getFrom(resp.body, "[\"LSD\",[],{\"token\":\"", "\"}");
262
-
263
- const FormBypass = {
264
- av: UID,
265
- fb_dtsg, jazoest, lsd,
266
- fb_api_caller_class: "RelayModern",
267
- fb_api_req_friendly_name: "FBScrapingWarningMutation",
268
- variables: JSON.stringify({}),
269
- server_timestamps: true,
270
- doc_id: 6339492849481770
271
- }
272
- return utils.post("https://www.facebook.com/api/graphql/", jar, FormBypass, globalOptions)
273
- .then(utils.saveCookies(jar)).then(function(res) {
274
- global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.Bypass_AutoNoti);
275
- return process.exit(1);
276
- });
277
- }
278
- else {
279
- return resp;
280
- }
281
- }
282
- else {
283
- return resp
284
- }
285
- }
286
- else {
287
- return utils.get('https://www.facebook.com/', jar, null, globalOptions).then(function(res) {
288
- if (res.request.uri && res.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
289
- if (res.request.uri.href.includes('601051028565049')) return { Status: true, Body: res.body }
290
- else return { Status: false, Body: res.body }
291
- }
292
- else return { Status: false, Body: res.body }
293
- }).then(function(res) {
294
- if (res.Status === true) {
295
- const fb_dtsg = utils.getFrom(res.Body, '["DTSGInitData",[],{"token":"', '","');
296
- const jazoest = utils.getFrom(res.Body, 'jazoest=', '",');
297
- const lsd = utils.getFrom(res.Body, "[\"LSD\",[],{\"token\":\"", "\"}");
298
-
299
- const FormBypass = {
300
- av: UID,
301
- fb_dtsg, jazoest, lsd,
302
- fb_api_caller_class: "RelayModern",
303
- fb_api_req_friendly_name: "FBScrapingWarningMutation",
304
- variables: JSON.stringify({}),
305
- server_timestamps: true,
306
- doc_id: 6339492849481770
307
- }
308
- return utils.post("https://www.facebook.com/api/graphql/", jar, FormBypass, globalOptions).then(utils.saveCookies(jar))
309
- .then(res => {
310
- global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.Bypass_AutoNoti);
311
- return res
312
- })
313
- }
314
- else return res;
315
-
316
- })
317
- .then(function(res) {
318
- return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar))
319
- })
320
- .then(function(res) {
321
- return process.exit(1)
322
- })
323
- }
324
- }
325
- catch (e) {
326
- console.log(e)
327
- }
328
- }
329
-
330
- //-[ Function BuildAPI ]-!/
331
-
332
- /**
333
- * @param {any} globalOptions
334
- * @param {string} html
335
- * @param {{ getCookies: (arg0: string) => any[]; }} jar
336
- */
337
-
338
- function buildAPI(globalOptions, html, jar, bypass_region) {
339
- //new feat
340
- const fb_dtsg = utils.getFroms(html, '["DTSGInitData",[],{"token":"', '","')[0]; //nhăm nhăm nhăm nhăm
341
-
342
- //check tiktik
343
- var userID;
344
- var cookie = jar.getCookies("https://www.facebook.com");
345
- //.log(cookie)
346
- var maybeUser = cookie.filter(function(val) { return val.cookieString().split("=")[0] === "c_user"; });
347
- var maybeTiktik = cookie.filter(function(val) { return val.cookieString().split("=")[0] === "i_user"; });
348
- if (maybeUser.length === 0 && maybeTiktik.length === 0) {
349
- if (global.Fca.Require.FastConfig.AutoLogin) {
350
- return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
351
- global.Fca.Action('AutoLogin')
352
- });
353
- }
354
- else if (!global.Fca.Require.FastConfig.AutoLogin) {
355
- return global.Fca.Require.logger.Error(global.Fca.Require.Language.Index.ErrAppState);
356
- }
357
- }
358
- else {
359
- if (html.indexOf("/checkpoint/block/?next") > -1) log.warn("login", Language.CheckPointLevelI);
360
-
361
- if (maybeTiktik[0] && maybeTiktik[0].cookieString().includes('i_user')) {
362
- userID = maybeTiktik[0].cookieString().split("=")[1].toString();
363
-
364
- }
365
- else userID = maybeUser[0].cookieString().split("=")[1].toString();
366
- process.env['UID'] = logger.Normal(getText(Language.UID,userID), userID);
367
-
368
- try {
369
- clearInterval(checkVerified);
370
- } catch (e) {
371
- console.log(e);
372
- }
373
-
374
- var clientID = (Math.random() * 2147483648 | 0).toString(16);
375
-
376
- var CHECK_MQTT = {
377
- oldFBMQTTMatch: html.match(/irisSeqID:"(.+?)",appID:219994525426954,endpoint:"(.+?)"/),
378
- newFBMQTTMatch: html.match(/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/),
379
- legacyFBMQTTMatch: html.match(/\["MqttWebConfig",\[\],{"fbid":"(.*?)","appID":219994525426954,"endpoint":"(.*?)","pollingEndpoint":"(.*?)"/)
380
- }
381
-
382
- // tổng hợp danh sách region never die của Kanzu =))
383
- /**
384
- * PRN = Pacific Northwest Region (Khu vực Tây Bắc Thái Bình Dương)
385
- * VLL = Valley Region
386
- * ASH = Ashburn Region
387
- * DFW = Dallas/Fort Worth Region
388
- * LLA = Los Angeles Region
389
- * FRA = Frankfurt
390
- * SIN = Singapore
391
- * NRT = Tokyo (Japan)
392
- * HKG = Hong Kong
393
- * SYD = Sydney
394
- */
395
-
396
- let Slot = Object.keys(CHECK_MQTT);
397
- var mqttEndpoint,region,irisSeqID;
398
- Object.keys(CHECK_MQTT).map(function(MQTT) {
399
- if (CHECK_MQTT[MQTT] && !region) {
400
- switch (Slot.indexOf(MQTT)) {
401
- case 0: {
402
- irisSeqID = CHECK_MQTT[MQTT][1];
403
- mqttEndpoint = CHECK_MQTT[MQTT][2].replace(/\\\//g, "/");
404
- region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
405
- return;
406
- }
407
- case 1: {
408
- irisSeqID = CHECK_MQTT[MQTT][2];
409
- mqttEndpoint = CHECK_MQTT[MQTT][1].replace(/\\\//g, "/");
410
- region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
411
- return;
412
- }
413
- case 2: {
414
- mqttEndpoint = CHECK_MQTT[MQTT][2].replace(/\\\//g, "/"); //is important lmao f?
415
- region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
416
- return;
417
- }
418
- }
419
- return;
420
- }
421
- });
422
-
423
- const regions = [
424
- {
425
- code: "PRN",
426
- name: "Pacific Northwest Region",
427
- location: "Pacific Northwest"
428
- },
429
- {
430
- code: "VLL",
431
- name: "Valley Region",
432
- location: "Valley"
433
- },
434
- {
435
- code: "ASH",
436
- name: "Ashburn Region",
437
- location: "Ashburn"
438
- },
439
- {
440
- code: "DFW",
441
- name: "Dallas/Fort Worth Region",
442
- location: "Dallas/Fort Worth"
443
- },
444
- {
445
- code: "LLA",
446
- name: "Los Angeles Region",
447
- location: "Los Angeles"
448
- },
449
- {
450
- code: "FRA",
451
- name: "Frankfurt",
452
- location: "Frankfurt"
453
- },
454
- {
455
- code: "SIN",
456
- name: "Singapore",
457
- location: "Singapore"
458
- },
459
- {
460
- code: "NRT",
461
- name: "Tokyo",
462
- location: "Japan"
463
- },
464
- {
465
- code: "HKG",
466
- name: "Hong Kong",
467
- location: "Hong Kong"
468
- },
469
- {
470
- code: "SYD",
471
- name: "Sydney",
472
- location: "Sydney"
473
- },
474
- {
475
- code: "PNB",
476
- name: "Pacific Northwest - Beta",
477
- location: "Pacific Northwest "
478
- }
479
- ];
480
-
481
- if (!region) {
482
- region = ['prn',"pnb","vll","hkg","sin"][Math.random()*5|0];
483
-
484
- }
485
- if (!mqttEndpoint) {
486
- mqttEndpoint = "wss://edge-chat.facebook.com/chat?region=" + region;
487
- }
488
-
489
- const Location = regions.find(r => r.code === region.toUpperCase());
490
- logger.Normal(getText(Language.Area,(Location == undefined ? region.toUpperCase() : Location.name)));
491
-
492
- var ctx = {
493
- userID: userID,
494
- jar: jar,
495
- clientID: clientID,
496
- globalOptions: globalOptions,
497
- loggedIn: true,
498
- access_token: 'NONE',
499
- clientMutationId: 0,
500
- mqttClient: undefined,
501
- lastSeqId: irisSeqID,
502
- syncToken: undefined,
503
- mqttEndpoint: mqttEndpoint,
504
- region: region,
505
- firstListen: true,
506
- req_ID: 0,
507
- callback_Task: {},
508
- fb_dtsg //i love u
509
- };
510
-
511
- var api = {
512
- setOptions: setOptions.bind(null, globalOptions),
513
- getAppState: function getAppState() {
514
- return utils.getAppState(jar);
515
- }
516
- };
517
- if (region && mqttEndpoint) {
518
- //do sth
519
- }
520
- else {
521
- if (bypass_region) {
522
- logger.Normal(Language.NoAreaDataBypass);
523
- }
524
- else {
525
- log.warn("login", getText(Language.NoAreaData));
526
- api["htmlData"] = html;
527
- }
528
- }
529
-
530
- var defaultFuncs = utils.makeDefaults(html, userID, ctx);
531
-
532
- fs.readdirSync(__dirname + "/src").filter((/** @type {string} */File) => File.endsWith(".js") && !File.includes('Dev_')).map((/** @type {string} */File) => {
533
- if (File == 'getThreadInfo.js' && global.Fca.Require.FastConfig.AntiGetInfo.AntiGetThreadInfo != true || File == 'getUserInfo.js' && global.Fca.Require.FastConfig.AntiGetInfo.AntiGetUserInfo != true) api[File.split('.').slice(0, -1).join('.')] = require('./src/' + (File.includes('getThreadInfo') ? 'getThreadMain.js' : 'getUserInfoMain.js'))(defaultFuncs, api, ctx)
534
- else api[File.split('.').slice(0, -1).join('.')] = require('./src/' + File)(defaultFuncs, api, ctx)
535
- });
536
-
537
- return {
538
- ctx,
539
- defaultFuncs,
540
- api
541
- };
542
- }
543
- }
544
-
545
- //-[ Function makeLogin ]-!/
546
-
547
- /**
548
- * @param {{ setCookie: (arg0: any, arg1: string) => void; }} jar
549
- * @param {any} email
550
- * @param {any} password
551
- * @param {{ forceLogin: any; }} loginOptions
552
- * @param {(err: any, api: any) => any} callback
553
- * @param {any} prCallback
554
- */
555
-
556
- function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
557
- return function(res) {
558
- var html = res.body,$ = cheerio.load(html),arr = [];
559
-
560
- $("#login_form input").map((i, v) => arr.push({ val: $(v).val(), name: $(v).attr("name") }));
561
-
562
- arr = arr.filter(function(v) {
563
- return v.val && v.val.length;
564
- });
565
- var form = utils.arrToForm(arr);
566
- form.lsd = utils.getFrom(html, "[\"LSD\",[],{\"token\":\"", "\"}");
567
- form.lgndim = Buffer.from("{\"w\":1440,\"h\":900,\"aw\":1440,\"ah\":834,\"c\":24}").toString('base64');
568
- form.email = email;
569
- form.pass = password;
570
- form.default_persistent = '0';
571
- form.locale = 'en_US';
572
- form.timezone = '240';
573
- form.lgnjs = ~~(Date.now() / 1000);
574
-
575
- html.split("\"_js_").slice(1).map((val) => {
576
- jar.setCookie(utils.formatCookie(JSON.parse("[\"" + utils.getFrom(val, "", "]") + "]"), "facebook"),"https://www.facebook.com")
577
- });
578
-
579
- logger.Normal(Language.OnLogin);
580
- return utils
581
- .post("https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110", jar, form, loginOptions)
582
- .then(utils.saveCookies(jar))
583
- .then(function(/** @type {{ headers: any; }} */res) {
584
- var headers = res.headers;
585
- if (!headers.location) throw { error: Language.InvaildAccount };
586
-
587
- // This means the account has login approvals turned on.
588
- if (headers.location.indexOf('https://www.facebook.com/checkpoint/') > -1) {
589
- logger.Warning(Language.TwoAuth);
590
- var nextURL = 'https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php';
591
-
592
- return utils
593
- .get(headers.location, jar, null, loginOptions)
594
- .then(utils.saveCookies(jar))
595
- .then(function(res) {
596
- if (!Database().get('ThroughAcc')) {
597
- Database().set('ThroughAcc', email);
598
- }
599
- else {
600
- if (String((Database().get('ThroughAcc'))).replace(RegExp('"','g'), '') != String(email).replace(RegExp('"','g'), '')) {
601
- Database().set('ThroughAcc', email);
602
- if (Database().get('Through2Fa')) {
603
- Database().delete('Through2Fa');
604
- }
605
- }
606
- }
607
- var html = res.body,$ = cheerio.load(html), arr = [];
608
- $("form input").map((i, v) => arr.push({ val: $(v).val(), name: $(v).attr("name") }));
609
- arr = arr.filter(v => { return v.val && v.val.length });
610
- var form = utils.arrToForm(arr);
611
- if (html.indexOf("checkpoint/?next") > -1) {
612
- setTimeout(() => {
613
- checkVerified = setInterval((_form) => {}, 5000, {
614
- fb_dtsg: form.fb_dtsg,
615
- jazoest: form.jazoest,
616
- dpr: 1
617
- });
618
- }, 2500);
619
- switch (global.Fca.Require.FastConfig.Login2Fa) {
620
- case true: {
621
- const question = question => {
622
- const rl = readline.createInterface({
623
- input: process.stdin,
624
- output: process.stdout
625
- });
626
- var done,answ;
627
- rl.question(question, answer => {
628
- rl.close();
629
- answ = answer;
630
- done = true
631
- })
632
- deasync.loopWhile(function(){
633
- return !done;
634
- });
635
- return answ;
636
- };
637
- try {
638
- const Old_Cookie = Database().get('Through2Fa');
639
- if (Old_Cookie) {
640
- Old_Cookie.map(function(/** @type {{ key: string; value: string; expires: string; domain: string; path: string; }} */c) {
641
- let str = c.key + "=" + c.value + "; expires=" + c.expires + "; domain=" + c.domain + "; path=" + c.path + ";";
642
- jar.setCookie(str, "http://" + c.domain);
643
- });
644
- let Form = utils.arrToForm(arr);
645
- Form.lsd = utils.getFrom(html, "[\"LSD\",[],{\"token\":\"", "\"}");
646
- Form.lgndim = Buffer.from("{\"w\":1440,\"h\":900,\"aw\":1440,\"ah\":834,\"c\":24}").toString('base64');
647
- Form.email = email;
648
- Form.pass = password;
649
- Form.default_persistent = '0';
650
- Form.locale = 'en_US';
651
- Form.timezone = '240';
652
- Form.lgnjs = ~~(Date.now() / 1000);
653
- return utils
654
- .post("https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110", jar, Form, loginOptions)
655
- .then(utils.saveCookies(jar))
656
- .then(function(res) {
657
- let headers = res.headers
658
- if (!headers['set-cookie'][0].includes('deleted')) {
659
- logger.Warning(Language.ErrThroughCookies, function() {
660
- Database().delete('Through2Fa');
661
- });
662
- process.exit(1);
663
- }
664
- if (headers.location && headers.location.indexOf('https://www.facebook.com/checkpoint/') > -1) {
665
- return utils
666
- .get(headers.location, jar, null, loginOptions)
667
- .then(utils.saveCookies(jar))
668
- .then(function(res) {
669
- var html = res.body,$ = cheerio.load(html), arr = [];
670
- $("form input").map((i, v) => arr.push({ val: $(v).val(), name: $(v).attr("name") }));
671
- arr = arr.filter(v => { return v.val && v.val.length });
672
- var Form = utils.arrToForm(arr);
673
-
674
- if (html.indexOf("checkpoint/?next") > -1) {
675
- setTimeout(() => {
676
- checkVerified = setInterval((_form) => {}, 5000, {
677
- fb_dtsg: Form.fb_dtsg,
678
- jazoest: Form.jazoest,
679
- dpr: 1
680
- });
681
- }, 2500);
682
-
683
- if (!res.headers.location && res.headers['set-cookie'][0].includes('checkpoint')) {
684
- try {
685
- delete Form.name_action_selected;
686
- Form['submit[Continue]'] = $("#checkpointSubmitButton").html();
687
- return utils
688
- .post(nextURL, jar, Form, loginOptions)
689
- .then(utils.saveCookies(jar))
690
- .then(function() {
691
- Form['submit[This was me]'] = "This was me";
692
- return utils.post(nextURL, jar, Form, loginOptions).then(utils.saveCookies(jar));
693
- })
694
- .then(function() {
695
- delete Form['submit[This was me]'];
696
- Form.name_action_selected = 'save_device';
697
- Form['submit[Continue]'] = $("#checkpointSubmitButton").html();
698
- return utils.post(nextURL, jar, Form, loginOptions).then(utils.saveCookies(jar));
699
- })
700
- .then(function(res) {
701
- var headers = res.headers;
702
- if (!headers.location && res.headers['set-cookie'][0].includes('checkpoint')) {
703
- Database().delete('Through2Fa');
704
- process.exit(1);
705
- }
706
- var appState = utils.getAppState(jar,false);
707
- Database().set('Through2Fa', appState);
708
- return loginHelper(appState, email, password, loginOptions, callback);
709
- })
710
- .catch((e) => callback(e));
711
- }
712
- catch (e) {
713
- console.log(e)
714
- }
715
- }
716
- }
717
- })
718
- }
719
- return utils.get('https://www.facebook.com/', jar, null, loginOptions).then(utils.saveCookies(jar));
720
- })
721
- .catch((e) => console.log(e));
722
- }
723
- }
724
- catch (e) {
725
- Database().delete('Through2Fa');
726
- }
727
- const Otp_code = require('totp-generator');
728
- const Code = global.Fca.Require.FastConfig.AuthString.includes('|') == false ? Otp_code(global.Fca.Require.FastConfig.AuthString.includes(" ") ? global.Fca.Require.FastConfig.AuthString.replace(RegExp(" ", 'g'), "") : global.Fca.Require.FastConfig.AuthString) : question(Language.EnterSecurityCode);
729
- try {
730
- const approvals = function(N_Code) {
731
- form.approvals_code = N_Code;
732
- form['submit[Continue]'] = $("#checkpointSubmitButton").html();
733
- var prResolve,prReject;
734
- var rtPromise = new Promise((resolve, reject) => { prResolve = resolve; prReject = reject; });
735
-
736
- if (typeof N_Code == "string") {
737
- utils
738
- .post(nextURL, jar, form, loginOptions)
739
- .then(utils.saveCookies(jar))
740
- .then(function(res) {
741
- var $ = cheerio.load(res.body);
742
- var error = $("#approvals_code").parent().attr("data-xui-error");
743
- if (error) {
744
- logger.Warning(Language.InvaildTwoAuthCode,function() { approvals(question(Language.EnterSecurityCode)) }); //bruh loop
745
- };
746
- })
747
- .then(function() {
748
- delete form.no_fido;delete form.approvals_code;
749
- form.name_action_selected = 'save_device'; //'save_device' || 'dont_save;
750
- return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
751
- })
752
- .then(function(res) {
753
- var headers = res.headers;
754
- if (!headers.location && res.headers['set-cookie'][0].includes('checkpoint')) {
755
- try {
756
- delete form.name_action_selected;
757
- form['submit[Continue]'] = $("#checkpointSubmitButton").html();
758
- return utils
759
- .post(nextURL, jar, form, loginOptions)
760
- .then(utils.saveCookies(jar))
761
- .then(function() {
762
- form['submit[This was me]'] = "This was me";
763
- return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
764
- })
765
- .then(function() {
766
- delete form['submit[This was me]'];
767
- form.name_action_selected = 'save_device';
768
- form['submit[Continue]'] = $("#checkpointSubmitButton").html();
769
- return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
770
- })
771
- .then(function(res) {
772
- var headers = res.headers;
773
- if (!headers.location && res.headers['set-cookie'][0].includes('checkpoint')) throw { error: "wtf ??:D" };
774
- var appState = utils.getAppState(jar,false);
775
- Database().set('Through2Fa', appState);
776
- return loginHelper(appState, email, password, loginOptions, callback);
777
- })
778
- .catch((e) => callback(e));
779
- }
780
- catch (e) {
781
- console.log(e)
782
- }
783
- }
784
- var appState = utils.getAppState(jar,false);
785
- if (callback === prCallback) {
786
- callback = function(err, api) {
787
- if (err) return prReject(err);
788
- return prResolve(api);
789
- };
790
- }
791
- Database().set('Through2Fa', appState);
792
- return loginHelper(appState, email, password, loginOptions, callback);
793
- })
794
- .catch(function(err) {
795
- if (callback === prCallback) prReject(err);
796
- else callback(err);
797
- });
798
- }
799
- else {
800
- utils
801
- .post("https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php", jar, form, loginOptions, null, { "Referer": "https://www.facebook.com/checkpoint/?next" })
802
- .then(utils.saveCookies(jar))
803
- .then(function(res) {
804
- try {
805
- JSON.parse(res.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/, ""));
806
- } catch (ex) {
807
- clearInterval(checkVerified);
808
- logger.Warning(Language.VerifiedCheck);
809
- if (callback === prCallback) {
810
- callback = function(err, api) {
811
- if (err) return prReject(err);
812
- return prResolve(api);
813
- };
814
- }
815
- let appState = utils.getAppState(jar,false);
816
- return loginHelper(appState, email, password, loginOptions, callback);
817
- }
818
- })
819
- .catch((ex) => {
820
- log.error("login", ex);
821
- if (callback === prCallback) prReject(ex);
822
- else callback(ex);
823
- });
824
- }
825
- return rtPromise;
826
- }
827
- return approvals(Code)
828
- }
829
- catch (e) {
830
- logger.Error(e)
831
- logger.Error();
832
- process.exit(0);
833
- }
834
- }
835
- case false: {
836
- throw {
837
- error: 'login-approval',
838
- continue: function submit2FA(code) {
839
- form.approvals_code = code;
840
- form['submit[Continue]'] = $("#checkpointSubmitButton").html(); //'Continue';
841
- var prResolve,prReject;
842
- var rtPromise = new Promise((resolve, reject) => { prResolve = resolve; prReject = reject; });
843
- if (typeof code == "string") {
844
- utils
845
- .post(nextURL, jar, form, loginOptions)
846
- .then(utils.saveCookies(jar))
847
- .then(function(/** @type {{ body: string | Buffer; }} */res) {
848
- var $ = cheerio.load(res.body);
849
- var error = $("#approvals_code").parent().attr("data-xui-error");
850
- if (error) {
851
- throw {
852
- error: 'login-approval',
853
- errordesc: Language.InvaildTwoAuthCode,
854
- lerror: error,
855
- continue: submit2FA
856
- };
857
- }
858
- })
859
- .then(function() {
860
- delete form.no_fido;delete form.approvals_code;
861
- form.name_action_selected = 'dont_save'; //'save_device' || 'dont_save;
862
- return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
863
- })
864
- .then(function(res) {
865
- var headers = res.headers;
866
- if (!headers.location && res.headers['set-cookie'][0].includes('checkpoint')) throw { error: Language.ApprovalsErr };
867
- var appState = utils.getAppState(jar,false);
868
- if (callback === prCallback) {
869
- callback = function(err, api) {
870
- if (err) return prReject(err);
871
- return prResolve(api);
872
- };
873
- }
874
- return loginHelper(appState, email, password, loginOptions, callback);
875
- })
876
- .catch(function(err) {
877
- if (callback === prCallback) prReject(err);
878
- else callback(err);
879
- });
880
- } else {
881
- utils
882
- .post("https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php", jar, form, loginOptions, null, { "Referer": "https://www.facebook.com/checkpoint/?next" })
883
- .then(utils.saveCookies(jar))
884
- .then((res) => {
885
- try {
886
- JSON.parse(res.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/, ""));
887
- } catch (ex) {
888
- clearInterval(checkVerified);
889
- logger.Warning(Language.VerifiedCheck);
890
- if (callback === prCallback) {
891
- callback = function(err, api) {
892
- if (err) return prReject(err);
893
- return prResolve(api);
894
- };
895
- }
896
- return loginHelper(utils.getAppState(jar,false), email, password, loginOptions, callback);
897
- }
898
- })
899
- .catch((ex) => {
900
- log.error("login", ex);
901
- if (callback === prCallback) prReject(ex);
902
- else callback(ex);
903
- });
904
- }
905
- return rtPromise;
906
- }
907
- };
908
- }
909
- }
910
- } else {
911
- if (!loginOptions.forceLogin) throw { error: Language.ForceLoginNotEnable };
912
-
913
- if (html.indexOf("Suspicious Login Attempt") > -1) form['submit[This was me]'] = "This was me";
914
- else form['submit[This Is Okay]'] = "This Is Okay";
915
-
916
- return utils
917
- .post(nextURL, jar, form, loginOptions)
918
- .then(utils.saveCookies(jar))
919
- .then(function() {
920
- form.name_action_selected = 'dont_save';
921
-
922
- return utils.post(nextURL, jar, form, loginOptions).then(utils.saveCookies(jar));
923
- })
924
- .then(function(res) {
925
- var headers = res.headers;
926
-
927
- if (!headers.location && res.body.indexOf('Review Recent Login') > -1) throw { error: "Something went wrong with review recent login." };
928
-
929
- var appState = utils.getAppState(jar,false);
930
-
931
- return loginHelper(appState, email, password, loginOptions, callback);
932
- })
933
- .catch((e) => callback(e));
934
- }
935
- });
936
- }
937
- return utils.get('https://www.facebook.com/', jar, null, loginOptions).then(utils.saveCookies(jar));
938
- });
939
- };
940
- }
941
-
942
- //-[ Function backup ]-!/
943
-
944
- /**
945
- * @param {string} data
946
- * @param {any} globalOptions
947
- * @param {any} callback
948
- * @param {any} prCallback
949
- */
950
-
951
- function backup(data,globalOptions, callback, prCallback) {
952
- try {
953
- var appstate;
954
- try {
955
- appstate = JSON.parse(data)
956
- }
957
- catch(e) {
958
- appstate = data;
959
- }
960
- logger.Warning(Language.BackupNoti);
961
- try {
962
- loginHelper(appstate,null,null,globalOptions, callback, prCallback)
963
- }
964
- catch (e) {
965
- logger.Error(Language.ErrBackup);
966
- process.exit(0);
967
- }
968
- }
969
- catch (e) {
970
- return logger.Error();
971
- }
972
- }
973
-
974
- //-[ function loginHelper ]-!/
975
-
976
- /**
977
- * @param {string | any[]} appState
978
- * @param {any} email
979
- * @param {any} password
980
- * @param {{ selfListen?: boolean; listenEvents?: boolean; listenTyping?: boolean; updatePresence?: boolean; forceLogin?: boolean; autoMarkDelivery?: boolean; autoMarkRead?: boolean; autoReconnect?: boolean; logRecordSize?: number; online?: boolean; emitReady?: boolean; userAgent?: string; pageID?: any; }} globalOptions
981
- * @param {(arg0: any, arg1: undefined) => void} callback
982
- * @param {(error: any, api: any) => any} [prCallback]
983
- */
984
-
985
- function loginHelper(appState, email, password, globalOptions, callback, prCallback) {
986
- var mainPromise = null;
987
- var jar = utils.getJar();
988
-
989
- try {
990
- if (appState) {
991
- logger.Normal(Language.OnProcess);
992
- switch (Database().has("FBKEY")) {
993
- case true: {
994
- process.env.FBKEY = Database().get("FBKEY");
995
- }
996
- break;
997
- case false: {
998
- const SecurityKey = global.Fca.Require.Security.create().apiKey;
999
- process.env['FBKEY'] = SecurityKey;
1000
- Database().set('FBKEY', SecurityKey);
1001
- }
1002
- break;
1003
- default: {
1004
- const SecurityKey = global.Fca.Require.Security.create().apiKey;
1005
- process.env['FBKEY'] = SecurityKey;
1006
- Database().set('FBKEY', SecurityKey);
1007
- }
1008
- }
1009
- try {
1010
- switch (global.Fca.Require.FastConfig.EncryptFeature) {
1011
- case true: {
1012
- appState = JSON.parse(JSON.stringify(appState, null, "\t"));
1013
- switch (utils.getType(appState)) {
1014
- case "Array": {
1015
- switch (utils.getType(appState[0])) {
1016
- case "Object": {
1017
- logger.Normal(Language.NotReadyToDecrypt);
1018
- }
1019
- break;
1020
- case "String": {
1021
- appState = Security(appState,process.env['FBKEY'],'Decrypt');
1022
- logger.Normal(Language.DecryptSuccess);
1023
- }
1024
- break;
1025
- default: {
1026
- logger.Warning(Language.InvaildAppState);
1027
- process.exit(0)
1028
- }
1029
- }
1030
- }
1031
- break;
1032
- default: {
1033
- logger.Warning(Language.InvaildAppState);
1034
- process.exit(0)
1035
- }
1036
- }
1037
- }
1038
- break;
1039
- case false: {
1040
- switch (utils.getType(appState)) {
1041
- case "Array": {
1042
- switch (utils.getType(appState[0])) {
1043
- case "Object": {
1044
- logger.Normal(Language.EncryptStateOff);
1045
- }
1046
- break;
1047
- case "String": {
1048
- appState = Security(appState,process.env['FBKEY'],'Decrypt');
1049
- logger.Normal(Language.EncryptStateOff);
1050
- logger.Normal(Language.DecryptSuccess);
1051
- }
1052
- break;
1053
- default: {
1054
- logger.Warning(Language.InvaildAppState);
1055
- process.exit(0)
1056
- }
1057
- }
1058
- }
1059
- break;
1060
- default: {
1061
- logger.Warning(Language.InvaildAppState);
1062
- process.exit(0)
1063
- }
1064
- }
1065
- }
1066
- break;
1067
- default: {
1068
- logger.Warning(getText(Language.IsNotABoolean,global.Fca.Require.FastConfig.EncryptFeature))
1069
- process.exit(0);
1070
- }
1071
- }
1072
- }
1073
- catch (e) {
1074
- console.log(e);
1075
- }
1076
-
1077
- try {
1078
- appState = JSON.parse(appState);
1079
- }
1080
- catch (e) {
1081
- try {
1082
- appState = appState;
1083
- }
1084
- catch (e) {
1085
- return logger.Error();
1086
- }
1087
- }
1088
- try {
1089
- global.Fca.Data.AppState = appState;
1090
- appState.map(function(/** @type {{ key: string; value: string; expires: string; domain: string; path: string; }} */c) {
1091
- var str = c.key + "=" + c.value + "; expires=" + c.expires + "; domain=" + c.domain + "; path=" + c.path + ";";
1092
- jar.setCookie(str, "http://" + c.domain);
1093
- });
1094
- Database().set('Backup', appState);
1095
- mainPromise = utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar));
1096
- }
1097
- catch (e) {
1098
- try {
1099
- if (Database().has('Backup')) {
1100
- return backup(Database().get('Backup'),globalOptions, callback, prCallback);
1101
- }
1102
- else {
1103
- logger.Warning(Language.ErrBackup);
1104
- process.exit(0);
1105
- }
1106
- }
1107
- catch (e) {
1108
- logger.Warning(Language.ErrBackup);
1109
- process.exit(0);
1110
- }
1111
- }
1112
- }
1113
-
1114
- else {
1115
- mainPromise = utils
1116
- .get("https://www.facebook.com/Lazic.Kanzu", null, null, globalOptions, { noRef: true }) // for fixing
1117
- .then(utils.saveCookies(jar))
1118
- .then(makeLogin(jar, email, password, globalOptions, callback, prCallback))
1119
- .then(function() {
1120
- return utils.get('https://www.facebook.com/', jar, null, globalOptions).then(utils.saveCookies(jar));
1121
- });
1122
- }
1123
- } catch (e) {
1124
- console.log(e);
1125
- }
1126
-
1127
- function CheckAndFixErr(res, fastSwitch) {
1128
- if (fastSwitch) return res;
1129
- let reg_antierr = /7431627028261359627/gs; // =))))))
1130
- if (reg_antierr.test(res.body)) {
1131
- const Data = JSON.stringify(res.body);
1132
- const Dt_Check = Data.split('2Fhome.php&amp;gfid=')[1];
1133
- if (Dt_Check == undefined) return res
1134
- const fid = Dt_Check.split("\\\\")[0];//fix sau
1135
- if (Dt_Check == undefined || Dt_Check == "") return res
1136
- const final_fid = fid.split(`\\`)[0];
1137
- if (final_fid == undefined || final_fid == '') return res;
1138
- const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
1139
- bypass_region_err = true;
1140
- return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
1141
- }
1142
- else return res
1143
- }
1144
-
1145
- function Redirect(res,fastSwitch) {
1146
- if (fastSwitch) return res;
1147
- var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1148
- redirect = reg.exec(res.body);
1149
- if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions)
1150
- return res;
1151
- }
1152
-
1153
- let redirect = [1, "https://m.facebook.com/"];
1154
- let bypass_region_err = false;
1155
- var ctx,api;
1156
- mainPromise = mainPromise
1157
- .then(res => Redirect(res))
1158
- .then(res => CheckAndFixErr(res))
1159
- //fix via login with defaut UA return WWW.facebook.com not m.facebook.com
1160
- .then(function(res) {
1161
- if (global.OnAutoLoginProcess) return res;
1162
- else {
1163
- let Regex_Via = /MPageLoadClientMetrics/gs; //default for normal account, can easily get region, without this u can't get region in some case but u can run normal
1164
- if (!Regex_Via.test(res.body)) {
1165
- //www.facebook.com
1166
- globalOptions.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.2849.68";
1167
- return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true })
1168
- }
1169
- else return res
1170
- }
1171
- })
1172
- .then(res => BypassAutomationNotification(res, jar, globalOptions, appState))
1173
- .then(res => Redirect(res, global.OnAutoLoginProcess))
1174
- .then(res => CheckAndFixErr(res, global.OnAutoLoginProcess))
1175
- // .then(res => {
1176
- // return utils.get('https://www.facebook.com/', jar, null, globalOptions, {}).then(utils.saveCookies(jar));
1177
- // })
1178
- // .then(function(res) {
1179
- // let reg_old_web = /Switch Default Site/gs;
1180
- // if (reg_old_web.test(res.body)) {
1181
- // let Data_Resp = JSON.stringify(res.body);
1182
- // const link = Data_Resp.split('settings/site')[1].split("\"")[0].replace('\\', '')
1183
- // const redirect_link2 = redirect[1] + "settings/site" + utils.cleanHTML(link)
1184
- // console.log(redirect_link2)
1185
- // return utils.get("https://www.facebook.com/", jar, null, globalOptions).then(utils.saveCookies(jar)); // try ag
1186
- // }
1187
- // else return res;
1188
- // })
1189
- // .then(function(res) {
1190
- // var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1191
- // redirect = reg.exec(res.body);
1192
- // if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1193
- // return res;
1194
- // })
1195
- .then(function(res){
1196
- var html = res.body,Obj = buildAPI(globalOptions, html, jar,bypass_region_err);
1197
- ctx = Obj.ctx;
1198
- api = Obj.api;
1199
- return res;
1200
- });
1201
- if (globalOptions.pageID) {
1202
- mainPromise = mainPromise
1203
- .then(function() {
1204
- return utils.get('https://www.facebook.com/' + ctx.globalOptions.pageID + '/messages/?section=messages&subsection=inbox', ctx.jar, null, globalOptions);
1205
- })
1206
- .then(function(resData) {
1207
- var url = utils.getFrom(resData.body, 'window.location.replace("https:\\/\\/www.facebook.com\\', '");').split('\\').join('');
1208
- url = url.substring(0, url.length - 1);
1209
- return utils.get('https://www.facebook.com' + url, ctx.jar, null, globalOptions);
1210
- });
1211
- }
1212
- mainPromise
1213
- .then(async() => {
1214
- logger.Normal(getText(Language.LocalVersion,global.Fca.Version));
1215
- logger.Normal(getText(Language.CountTime,global.Fca.Data.CountTime()))
1216
- logger.Normal(Language.WishMessage[Math.floor(Math.random()*Language.WishMessage.length)]);
1217
- require('./Extra/ExtraUptimeRobot')();
1218
- callback(null, api);
1219
- }).catch(function(/** @type {{ error: any; }} */e) {
1220
- log.error("login", e.error || e);
1221
- callback(e);
1222
- });
1223
- }
1224
-
1225
-
1226
- /**
1227
- * It asks the user for their account and password, and then saves it to the database.
1228
- */
1229
-
1230
- function setUserNameAndPassWord() {
1231
- let rl = readline.createInterface({
1232
- input: process.stdin,
1233
- output: process.stdout
1234
- });
1235
-
1236
- console.clear();
1237
- console.log(figlet.textSync('Horizon', {font: 'ANSI Shadow',horizontalLayout: 'default',verticalLayout: 'default',width: 0,whitespaceBreak: true }));
1238
- console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Operating System: " + chalk.bold.red(os.type()));
1239
- console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Machine Version: " + chalk.bold.red(os.version()));
1240
- console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Fca Version: " + chalk.bold.red(global.Fca.Version) + '\n');
1241
- try {
1242
- rl.question(Language.TypeAccount, (Account) => {
1243
- if (!Account.includes("@") && global.Fca.Require.utils.getType(parseInt(Account)) != "Number") return logger.Normal(Language.TypeAccountError, function () { process.exit(1) }); //Very Human
1244
- else rl.question(Language.TypePassword, function (Password) {
1245
- rl.close();
1246
- try {
1247
- Database().set("Account", Account);
1248
- Database().set("Password", Password);
1249
- }
1250
- catch (e) {
1251
- logger.Warning(Language.ErrDataBase);
1252
- logger.Error();
1253
- process.exit(0);
1254
- }
1255
- if (global.Fca.Require.FastConfig.ResetDataLogin) {
1256
- global.Fca.Require.FastConfig.ResetDataLogin = false;
1257
- global.Fca.Require.fs.writeFileSync(process.cwd() + '/FastConfigFca.json', JSON.stringify(global.Fca.Require.FastConfig, null, 4));
1258
- }
1259
- logger.Success(Language.SuccessSetData);
1260
- process.exit(1);
1261
- });
1262
- })
1263
- }
1264
- catch (e) {
1265
- logger.Error(e)
1266
- }
1267
- }
1268
-
1269
- /**
1270
- * @param {{ email: any; password: any; appState: any; }} loginData
1271
- * @param {{}} options
1272
- * @param {(error: any, api: any) => any} callback
1273
- */
1274
-
1275
- function login(loginData, options, callback) {
1276
- if (utils.getType(options) === 'Function' || utils.getType(options) === 'AsyncFunction') {
1277
- callback = options;
1278
- options = {};
1279
- }
1280
-
1281
- var globalOptions = {
1282
- selfListen: false,
1283
- listenEvents: true,
1284
- listenTyping: false,
1285
- updatePresence: false,
1286
- forceLogin: false,
1287
- autoMarkDelivery: false,
1288
- autoMarkRead: false,
1289
- autoReconnect: true,
1290
- logRecordSize: 100,
1291
- online: false,
1292
- emitReady: false,
1293
- userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
1294
- };
1295
-
1296
- var prCallback = null;
1297
- if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
1298
- var rejectFunc = null;
1299
- var resolveFunc = null;
1300
- var returnPromise = new Promise(function(resolve, reject) {
1301
- resolveFunc = resolve;
1302
- rejectFunc = reject;
1303
- });
1304
- prCallback = function(error, api) {
1305
- if (error) return rejectFunc(error);
1306
- return resolveFunc(api);
1307
- };
1308
- callback = prCallback;
1309
- }
1310
-
1311
- if (loginData.email && loginData.password) {
1312
- setOptions(globalOptions, {
1313
- logLevel: "silent",
1314
- forceLogin: true,
1315
- userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36"
1316
- });
1317
- loginHelper(loginData.appState, loginData.email, loginData.password, globalOptions, callback, prCallback);
1318
- }
1319
- else if (loginData.appState) {
1320
- setOptions(globalOptions, options);
1321
- let All = (getAll()).filter(i => i.data !== null);
1322
- All = All.filter(i => i.data.messageCount !== undefined)
1323
- if (All.length >= 1) {
1324
- deleteAll(All.map(obj => obj.data.threadID));
1325
- }
1326
- /*
1327
- if (global.Fca.Require.FastConfig.Websocket_Extension.Status) {
1328
- const UserName = Database().get('Ws_UserName');
1329
- const PassWord = Database().get("Ws_PassWord");
1330
- if (!UserName || !PassWord || global.Fca.Require.FastConfig.Websocket_Extension.ResetData) {
1331
- const question = question => {
1332
- const rl = readline.createInterface({
1333
- input: process.stdin,
1334
- output: process.stdout
1335
- });
1336
- var done,answ;
1337
- rl.question(question, answer => {
1338
- rl.close();
1339
- answ = answer;
1340
- done = true
1341
- })
1342
- deasync.loopWhile(function(){
1343
- return !done;
1344
- });
1345
- return answ;
1346
- };
1347
- console.clear();
1348
- console.log(figlet.textSync('Horizon', {font: 'ANSI Shadow',horizontalLayout: 'default',verticalLayout: 'default',width: 0,whitespaceBreak: true }));
1349
- console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Operating System: " + chalk.bold.red(os.type()));
1350
- console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Machine Version: " + chalk.bold.red(os.version()));
1351
- console.log(chalk.bold.hex('#9900FF')("[</>]") + chalk.bold.yellow(' => ') + "Fca Version: " + chalk.bold.red(global.Fca.Version) + '\n');
1352
- const UserName = question(Language.Ws_TypeUserName);
1353
- const PassWord = question(Language.Ws_TypePassWord);
1354
- if (!UserName || !PassWord) {
1355
- logger.Warning("Dangerous action detected! Proceeding to automatically disable websocket_extension.");
1356
- global.Fca.Require.FastConfig.Websocket_Extension.Status = false;
1357
- global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
1358
- }
1359
- else {
1360
- try {
1361
- Database().set('Ws_UserName', UserName);
1362
- Database().set('Ws_PassWord', PassWord);
1363
- logger.Success(Language.Ws_Success, function() {
1364
- const speakeasy = require('speakeasy');
1365
- const secret = (speakeasy.generateSecret({ length: 20 }));
1366
- logger.Warning(getText(Language.Ws_2Fa, secret.base32))
1367
- Database().set('Ws_2Fa', secret.base32);
1368
- if (global.Fca.Require.FastConfig.Websocket_Extension.ResetData) {
1369
- global.Fca.Require.FastConfig.Websocket_Extension.ResetData = false;
1370
- global.Fca.Require.fs.writeFileSync(process.cwd() + '/FastConfigFca.json', JSON.stringify(global.Fca.Require.FastConfig, null, 4));
1371
- }
1372
- question("Enter To Continue!");
1373
- const ask = function() {
1374
- const TFa_Check = question(Language.Ws_2Fa_Check)
1375
- if (TFa_Check != speakeasy.totp({
1376
- secret: secret.base32,
1377
- encoding: 'base32'
1378
- })) {
1379
- logger.Warning("Mã Không Đúng vui lòng nhập lại(Incorrect code, please enter again.)")
1380
- ask();
1381
- }
1382
- else {
1383
- logger.Success("Success!");
1384
- process.exit(1);
1385
- }
1386
- }
1387
- return ask();
1388
- });
1389
- }
1390
- catch (e) {
1391
- console.log(e)
1392
- logger.Warning("Error, auto turn off Websocket_extension");
1393
- global.Fca.Require.FastConfig.Websocket_Extension.Status = false;
1394
- global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(global.Fca.Require.FastConfig, null, "\t"));
1395
- process.exit(1);
1396
- }
1397
- }
1398
- }
1399
- }
1400
- **/
1401
- switch (global.Fca.Require.FastConfig.AutoLogin) {
1402
- case true: {
1403
- if (global.Fca.Require.FastConfig.ResetDataLogin) return setUserNameAndPassWord();
1404
- else {
1405
- try {
1406
- const TempState = Database().get("TempState")
1407
- if (TempState) {
1408
- try {
1409
- loginData.appState = JSON.parse(TempState);
1410
- }
1411
- catch (_) {
1412
- loginData.appState = TempState;
1413
- }
1414
- Database().delete("TempState");
1415
- }
1416
- }
1417
- catch (e) {
1418
- console.log(e)
1419
- Database().delete("TempState");
1420
- logger.Warning(Language.ErrDataBase);
1421
- logger.Error();
1422
- process.exit(0);
1423
- }
1424
- try {
1425
- if (Database().has('Account') && Database().has('Password')) return loginHelper(loginData.appState, loginData.email, loginData.password, globalOptions, callback, prCallback);
1426
- else return setUserNameAndPassWord();
1427
- }
1428
- catch (e) {
1429
- console.log(e)
1430
- logger.Warning(Language.ErrDataBase);
1431
- logger.Error();
1432
- process.exit(0);
1433
- }
1434
- }
1435
- }
1436
- case false: {
1437
- return loginHelper(loginData.appState, loginData.email, loginData.password, globalOptions, callback, prCallback);
1438
- }
1439
- }
1440
- }
1441
- return returnPromise;
1442
- }
1443
-
1444
- module.exports = login;