zai-fca 1.0.8
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.
Potentially problematic release.
This version of zai-fca might be problematic. Click here for more details.
- package/.cache/replit/env/latest +56 -0
- package/.cache/replit/env/latest.json +1 -0
- package/.cache/replit/modules/nodejs-20.res +1 -0
- package/.cache/replit/modules/replit.res +1 -0
- package/.cache/replit/modules.stamp +0 -0
- package/.cache/typescript/5.6/node_modules/.package-lock.json +178 -0
- package/.cache/typescript/5.6/node_modules/@types/bluebird/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/@types/bluebird/README.md +15 -0
- package/.cache/typescript/5.6/node_modules/@types/bluebird/index.d.ts +1365 -0
- package/.cache/typescript/5.6/node_modules/@types/bluebird/package.json +25 -0
- package/.cache/typescript/5.6/node_modules/@types/caseless/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/@types/caseless/README.md +48 -0
- package/.cache/typescript/5.6/node_modules/@types/caseless/index.d.ts +29 -0
- package/.cache/typescript/5.6/node_modules/@types/caseless/package.json +35 -0
- package/.cache/typescript/5.6/node_modules/@types/mocha/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/@types/mocha/README.md +15 -0
- package/.cache/typescript/5.6/node_modules/@types/mocha/index.d.ts +2929 -0
- package/.cache/typescript/5.6/node_modules/@types/mocha/package.json +56 -0
- package/.cache/typescript/5.6/node_modules/@types/node/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/@types/node/README.md +15 -0
- package/.cache/typescript/5.6/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.6/node_modules/@types/node/assert.d.ts +1040 -0
- package/.cache/typescript/5.6/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/.cache/typescript/5.6/node_modules/@types/node/buffer.buffer.d.ts +385 -0
- package/.cache/typescript/5.6/node_modules/@types/node/buffer.d.ts +1933 -0
- package/.cache/typescript/5.6/node_modules/@types/node/child_process.d.ts +1549 -0
- package/.cache/typescript/5.6/node_modules/@types/node/cluster.d.ts +579 -0
- package/.cache/typescript/5.6/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/.cache/typescript/5.6/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/.cache/typescript/5.6/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/.cache/typescript/5.6/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/.cache/typescript/5.6/node_modules/@types/node/console.d.ts +452 -0
- package/.cache/typescript/5.6/node_modules/@types/node/constants.d.ts +19 -0
- package/.cache/typescript/5.6/node_modules/@types/node/crypto.d.ts +4475 -0
- package/.cache/typescript/5.6/node_modules/@types/node/dgram.d.ts +596 -0
- package/.cache/typescript/5.6/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/.cache/typescript/5.6/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/.cache/typescript/5.6/node_modules/@types/node/dns.d.ts +865 -0
- package/.cache/typescript/5.6/node_modules/@types/node/dom-events.d.ts +124 -0
- package/.cache/typescript/5.6/node_modules/@types/node/domain.d.ts +170 -0
- package/.cache/typescript/5.6/node_modules/@types/node/events.d.ts +931 -0
- package/.cache/typescript/5.6/node_modules/@types/node/fs/promises.d.ts +1275 -0
- package/.cache/typescript/5.6/node_modules/@types/node/fs.d.ts +4396 -0
- package/.cache/typescript/5.6/node_modules/@types/node/globals.d.ts +566 -0
- package/.cache/typescript/5.6/node_modules/@types/node/globals.typedarray.d.ts +21 -0
- package/.cache/typescript/5.6/node_modules/@types/node/http.d.ts +1958 -0
- package/.cache/typescript/5.6/node_modules/@types/node/http2.d.ts +2558 -0
- package/.cache/typescript/5.6/node_modules/@types/node/https.d.ts +543 -0
- package/.cache/typescript/5.6/node_modules/@types/node/index.d.ts +92 -0
- package/.cache/typescript/5.6/node_modules/@types/node/inspector.d.ts +3966 -0
- package/.cache/typescript/5.6/node_modules/@types/node/module.d.ts +402 -0
- package/.cache/typescript/5.6/node_modules/@types/node/net.d.ts +1001 -0
- package/.cache/typescript/5.6/node_modules/@types/node/os.d.ts +495 -0
- package/.cache/typescript/5.6/node_modules/@types/node/package.json +220 -0
- package/.cache/typescript/5.6/node_modules/@types/node/path.d.ts +200 -0
- package/.cache/typescript/5.6/node_modules/@types/node/perf_hooks.d.ts +965 -0
- package/.cache/typescript/5.6/node_modules/@types/node/process.d.ts +1963 -0
- package/.cache/typescript/5.6/node_modules/@types/node/punycode.d.ts +117 -0
- package/.cache/typescript/5.6/node_modules/@types/node/querystring.d.ts +153 -0
- package/.cache/typescript/5.6/node_modules/@types/node/readline/promises.d.ts +162 -0
- package/.cache/typescript/5.6/node_modules/@types/node/readline.d.ts +589 -0
- package/.cache/typescript/5.6/node_modules/@types/node/repl.d.ts +430 -0
- package/.cache/typescript/5.6/node_modules/@types/node/sea.d.ts +153 -0
- package/.cache/typescript/5.6/node_modules/@types/node/sqlite.d.ts +213 -0
- package/.cache/typescript/5.6/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.6/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/.cache/typescript/5.6/node_modules/@types/node/stream/web.d.ts +609 -0
- package/.cache/typescript/5.6/node_modules/@types/node/stream.d.ts +1726 -0
- package/.cache/typescript/5.6/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.6/node_modules/@types/node/test.d.ts +2248 -0
- package/.cache/typescript/5.6/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/.cache/typescript/5.6/node_modules/@types/node/timers.d.ts +240 -0
- package/.cache/typescript/5.6/node_modules/@types/node/tls.d.ts +1226 -0
- package/.cache/typescript/5.6/node_modules/@types/node/trace_events.d.ts +197 -0
- package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
- package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
- package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/index.d.ts +92 -0
- package/.cache/typescript/5.6/node_modules/@types/node/tty.d.ts +208 -0
- package/.cache/typescript/5.6/node_modules/@types/node/url.d.ts +972 -0
- package/.cache/typescript/5.6/node_modules/@types/node/util.d.ts +2371 -0
- package/.cache/typescript/5.6/node_modules/@types/node/v8.d.ts +808 -0
- package/.cache/typescript/5.6/node_modules/@types/node/vm.d.ts +976 -0
- package/.cache/typescript/5.6/node_modules/@types/node/wasi.d.ts +181 -0
- package/.cache/typescript/5.6/node_modules/@types/node/worker_threads.d.ts +745 -0
- package/.cache/typescript/5.6/node_modules/@types/node/zlib.d.ts +539 -0
- package/.cache/typescript/5.6/node_modules/@types/node-cron/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/@types/node-cron/README.md +76 -0
- package/.cache/typescript/5.6/node_modules/@types/node-cron/index.d.ts +57 -0
- package/.cache/typescript/5.6/node_modules/@types/node-cron/package.json +50 -0
- package/.cache/typescript/5.6/node_modules/@types/npmlog/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/@types/npmlog/README.md +15 -0
- package/.cache/typescript/5.6/node_modules/@types/npmlog/index.d.ts +84 -0
- package/.cache/typescript/5.6/node_modules/@types/npmlog/package.json +32 -0
- package/.cache/typescript/5.6/node_modules/@types/request/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/@types/request/README.md +15 -0
- package/.cache/typescript/5.6/node_modules/@types/request/index.d.ts +395 -0
- package/.cache/typescript/5.6/node_modules/@types/request/package.json +70 -0
- package/.cache/typescript/5.6/node_modules/@types/tough-cookie/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/@types/tough-cookie/README.md +15 -0
- package/.cache/typescript/5.6/node_modules/@types/tough-cookie/index.d.ts +321 -0
- package/.cache/typescript/5.6/node_modules/@types/tough-cookie/package.json +35 -0
- package/.cache/typescript/5.6/node_modules/asynckit/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/asynckit/README.md +233 -0
- package/.cache/typescript/5.6/node_modules/asynckit/bench.js +76 -0
- package/.cache/typescript/5.6/node_modules/asynckit/index.js +6 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/abort.js +29 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/async.js +34 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/defer.js +26 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/iterate.js +75 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/state.js +37 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/streamify.js +141 -0
- package/.cache/typescript/5.6/node_modules/asynckit/lib/terminator.js +29 -0
- package/.cache/typescript/5.6/node_modules/asynckit/package.json +63 -0
- package/.cache/typescript/5.6/node_modules/asynckit/parallel.js +43 -0
- package/.cache/typescript/5.6/node_modules/asynckit/serial.js +17 -0
- package/.cache/typescript/5.6/node_modules/asynckit/serialOrdered.js +75 -0
- package/.cache/typescript/5.6/node_modules/asynckit/stream.js +21 -0
- package/.cache/typescript/5.6/node_modules/combined-stream/License +19 -0
- package/.cache/typescript/5.6/node_modules/combined-stream/Readme.md +138 -0
- package/.cache/typescript/5.6/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/.cache/typescript/5.6/node_modules/combined-stream/package.json +25 -0
- package/.cache/typescript/5.6/node_modules/combined-stream/yarn.lock +17 -0
- package/.cache/typescript/5.6/node_modules/delayed-stream/License +19 -0
- package/.cache/typescript/5.6/node_modules/delayed-stream/Makefile +7 -0
- package/.cache/typescript/5.6/node_modules/delayed-stream/Readme.md +141 -0
- package/.cache/typescript/5.6/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/.cache/typescript/5.6/node_modules/delayed-stream/package.json +27 -0
- package/.cache/typescript/5.6/node_modules/form-data/License +19 -0
- package/.cache/typescript/5.6/node_modules/form-data/Readme.md +350 -0
- package/.cache/typescript/5.6/node_modules/form-data/index.d.ts +51 -0
- package/.cache/typescript/5.6/node_modules/form-data/lib/browser.js +2 -0
- package/.cache/typescript/5.6/node_modules/form-data/lib/form_data.js +484 -0
- package/.cache/typescript/5.6/node_modules/form-data/lib/populate.js +10 -0
- package/.cache/typescript/5.6/node_modules/form-data/package.json +72 -0
- package/.cache/typescript/5.6/node_modules/mime-db/HISTORY.md +507 -0
- package/.cache/typescript/5.6/node_modules/mime-db/LICENSE +23 -0
- package/.cache/typescript/5.6/node_modules/mime-db/README.md +100 -0
- package/.cache/typescript/5.6/node_modules/mime-db/db.json +8519 -0
- package/.cache/typescript/5.6/node_modules/mime-db/index.js +12 -0
- package/.cache/typescript/5.6/node_modules/mime-db/package.json +60 -0
- package/.cache/typescript/5.6/node_modules/mime-types/HISTORY.md +397 -0
- package/.cache/typescript/5.6/node_modules/mime-types/LICENSE +23 -0
- package/.cache/typescript/5.6/node_modules/mime-types/README.md +113 -0
- package/.cache/typescript/5.6/node_modules/mime-types/index.js +188 -0
- package/.cache/typescript/5.6/node_modules/mime-types/package.json +44 -0
- package/.cache/typescript/5.6/node_modules/safe-buffer/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/safe-buffer/README.md +584 -0
- package/.cache/typescript/5.6/node_modules/safe-buffer/index.d.ts +187 -0
- package/.cache/typescript/5.6/node_modules/safe-buffer/index.js +65 -0
- package/.cache/typescript/5.6/node_modules/safe-buffer/package.json +51 -0
- package/.cache/typescript/5.6/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.6/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.6/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.6/node_modules/undici-types/LICENSE +21 -0
- package/.cache/typescript/5.6/node_modules/undici-types/README.md +6 -0
- package/.cache/typescript/5.6/node_modules/undici-types/agent.d.ts +31 -0
- package/.cache/typescript/5.6/node_modules/undici-types/api.d.ts +43 -0
- package/.cache/typescript/5.6/node_modules/undici-types/balanced-pool.d.ts +29 -0
- package/.cache/typescript/5.6/node_modules/undici-types/cache.d.ts +36 -0
- package/.cache/typescript/5.6/node_modules/undici-types/client.d.ts +108 -0
- package/.cache/typescript/5.6/node_modules/undici-types/connector.d.ts +34 -0
- package/.cache/typescript/5.6/node_modules/undici-types/content-type.d.ts +21 -0
- package/.cache/typescript/5.6/node_modules/undici-types/cookies.d.ts +28 -0
- package/.cache/typescript/5.6/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- package/.cache/typescript/5.6/node_modules/undici-types/dispatcher.d.ts +255 -0
- package/.cache/typescript/5.6/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/.cache/typescript/5.6/node_modules/undici-types/errors.d.ts +149 -0
- package/.cache/typescript/5.6/node_modules/undici-types/eventsource.d.ts +61 -0
- package/.cache/typescript/5.6/node_modules/undici-types/fetch.d.ts +209 -0
- package/.cache/typescript/5.6/node_modules/undici-types/file.d.ts +39 -0
- package/.cache/typescript/5.6/node_modules/undici-types/filereader.d.ts +54 -0
- package/.cache/typescript/5.6/node_modules/undici-types/formdata.d.ts +108 -0
- package/.cache/typescript/5.6/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/.cache/typescript/5.6/node_modules/undici-types/global-origin.d.ts +7 -0
- package/.cache/typescript/5.6/node_modules/undici-types/handlers.d.ts +15 -0
- package/.cache/typescript/5.6/node_modules/undici-types/header.d.ts +4 -0
- package/.cache/typescript/5.6/node_modules/undici-types/index.d.ts +71 -0
- package/.cache/typescript/5.6/node_modules/undici-types/interceptors.d.ts +17 -0
- package/.cache/typescript/5.6/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/.cache/typescript/5.6/node_modules/undici-types/mock-client.d.ts +25 -0
- package/.cache/typescript/5.6/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/.cache/typescript/5.6/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/.cache/typescript/5.6/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/.cache/typescript/5.6/node_modules/undici-types/package.json +55 -0
- package/.cache/typescript/5.6/node_modules/undici-types/patch.d.ts +33 -0
- package/.cache/typescript/5.6/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/.cache/typescript/5.6/node_modules/undici-types/pool.d.ts +39 -0
- package/.cache/typescript/5.6/node_modules/undici-types/proxy-agent.d.ts +28 -0
- package/.cache/typescript/5.6/node_modules/undici-types/readable.d.ts +60 -0
- package/.cache/typescript/5.6/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/.cache/typescript/5.6/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/.cache/typescript/5.6/node_modules/undici-types/util.d.ts +18 -0
- package/.cache/typescript/5.6/node_modules/undici-types/webidl.d.ts +222 -0
- package/.cache/typescript/5.6/node_modules/undici-types/websocket.d.ts +150 -0
- package/.cache/typescript/5.6/package-lock.json +190 -0
- package/.cache/typescript/5.6/package.json +1 -0
- package/.replit +4 -0
- package/.upm/store.json +1 -0
- package/LICENSE +21 -0
- package/README.md +289 -0
- package/index.js +460 -0
- package/package.json +45 -0
- package/src/Screenshot.js +83 -0
- package/src/addExternalModule.js +25 -0
- package/src/addUserToGroup.js +115 -0
- package/src/changeAdminStatus.js +103 -0
- package/src/changeArchivedStatus.js +55 -0
- package/src/changeAvatar.js +136 -0
- package/src/changeAvatarV2.js +86 -0
- package/src/changeAvt.js +85 -0
- package/src/changeBio.js +76 -0
- package/src/changeBlockedStatus.js +49 -0
- package/src/changeBlockedStatusMqtt.js +80 -0
- package/src/changeCover.js +72 -0
- package/src/changeGroupImage.js +135 -0
- package/src/changeName.js +79 -0
- package/src/changeNickname.js +59 -0
- package/src/changeThreadColor.js +65 -0
- package/src/changeThreadEmoji.js +55 -0
- package/src/changeUsername.js +59 -0
- package/src/createCommentPost.js +230 -0
- package/src/createNewGroup.js +88 -0
- package/src/createPoll.js +71 -0
- package/src/createPost.js +276 -0
- package/src/deleteMessage.js +56 -0
- package/src/deleteThread.js +56 -0
- package/src/editMessage.js +59 -0
- package/src/editMessageOld.js +67 -0
- package/src/follow.js +74 -0
- package/src/forwardAttachment.js +60 -0
- package/src/getAccess.js +112 -0
- package/src/getAvatarUser.js +78 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +29 -0
- package/src/getFriendsList.js +83 -0
- package/src/getMessage.js +835 -0
- package/src/getRegion.js +7 -0
- package/src/getThreadHistory.js +680 -0
- package/src/getThreadHistoryDeprecated.js +71 -0
- package/src/getThreadInfo.js +232 -0
- package/src/getThreadInfoDeprecated.js +56 -0
- package/src/getThreadList.js +213 -0
- package/src/getThreadListDeprecated.js +46 -0
- package/src/getThreadPictures.js +59 -0
- package/src/getUID.js +119 -0
- package/src/getUserID.js +61 -0
- package/src/getUserInfo.js +66 -0
- package/src/handleFriendRequest.js +46 -0
- package/src/handleMessageRequest.js +47 -0
- package/src/httpGet.js +49 -0
- package/src/httpPost.js +48 -0
- package/src/listenMqtt.js +827 -0
- package/src/listenMqtt.txt +827 -0
- package/src/logout.js +75 -0
- package/src/markAsDelivered.js +47 -0
- package/src/markAsRead.js +70 -0
- package/src/markAsReadAll.js +40 -0
- package/src/markAsSeen.js +48 -0
- package/src/muteThread.js +45 -0
- package/src/postFormData.txt +46 -0
- package/src/refreshFb_dtsg.js +89 -0
- package/src/removeUserFromGroup.js +79 -0
- package/src/resolvePhotoUrl.js +45 -0
- package/src/searchForThread.js +53 -0
- package/src/searchStickers.js +53 -0
- package/src/sendMessage.js +329 -0
- package/src/sendMessageMqtt.js +322 -0
- package/src/sendTypingIndicator.js +101 -0
- package/src/sendTypingIndicatorV2.js +28 -0
- package/src/setMessageReaction.js +122 -0
- package/src/setMessageReactionMqtt.js +62 -0
- package/src/setPostReaction.js +112 -0
- package/src/setProfileGuard.js +45 -0
- package/src/setStoryReaction.js +64 -0
- package/src/setTitle.js +90 -0
- package/src/shareContact.js +110 -0
- package/src/shareLink.js +59 -0
- package/src/stopListenMqtt.js +23 -0
- package/src/threadColors.js +131 -0
- package/src/unfriend.js +52 -0
- package/src/unsendMessage.js +45 -0
- package/src/uploadAttachment.js +94 -0
- package/test/example-config.json +18 -0
- package/test/test-page.js +140 -0
- package/test/test.js +385 -0
- package/utils.js +2876 -0
    
        package/src/logout.js
    ADDED
    
    | @@ -0,0 +1,75 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            const utils = require("../utils");
         | 
| 4 | 
            +
            // @NethWs3Dev
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
              return function logout(callback) {
         | 
| 8 | 
            +
                let resolveFunc = function () {};
         | 
| 9 | 
            +
                let rejectFunc = function () {};
         | 
| 10 | 
            +
                const returnPromise = new Promise(function (resolve, reject) {
         | 
| 11 | 
            +
                  resolveFunc = resolve;
         | 
| 12 | 
            +
                  rejectFunc = reject;
         | 
| 13 | 
            +
                });
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                if (!callback) {
         | 
| 16 | 
            +
                  callback = function (err, friendList) {
         | 
| 17 | 
            +
                    if (err) {
         | 
| 18 | 
            +
                      return rejectFunc(err);
         | 
| 19 | 
            +
                    }
         | 
| 20 | 
            +
                    resolveFunc(friendList);
         | 
| 21 | 
            +
                  };
         | 
| 22 | 
            +
                }
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                const form = {
         | 
| 25 | 
            +
                  pmid: "0",
         | 
| 26 | 
            +
                };
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                defaultFuncs
         | 
| 29 | 
            +
                  .post(
         | 
| 30 | 
            +
                    "https://www.facebook.com/bluebar/modern_settings_menu/?help_type=364455653583099&show_contextual_help=1",
         | 
| 31 | 
            +
                    ctx.jar,
         | 
| 32 | 
            +
                    form,
         | 
| 33 | 
            +
                  )
         | 
| 34 | 
            +
                  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
         | 
| 35 | 
            +
                  .then(function (resData) {
         | 
| 36 | 
            +
                    const elem = resData.jsmods.instances[0][2][0].filter(function (v) {
         | 
| 37 | 
            +
                      return v.value === "logout";
         | 
| 38 | 
            +
                    })[0];
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                    const html = resData.jsmods.markup.filter(function (v) {
         | 
| 41 | 
            +
                      return v[0] === elem.markup.__m;
         | 
| 42 | 
            +
                    })[0][1].__html;
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                    const form = {
         | 
| 45 | 
            +
                      fb_dtsg: utils.getFrom(html, '"fb_dtsg" value="', '"'),
         | 
| 46 | 
            +
                      ref: utils.getFrom(html, '"ref" value="', '"'),
         | 
| 47 | 
            +
                      h: utils.getFrom(html, '"h" value="', '"'),
         | 
| 48 | 
            +
                    };
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                    return defaultFuncs
         | 
| 51 | 
            +
                      .post("https://www.facebook.com/logout.php", ctx.jar, form)
         | 
| 52 | 
            +
                      .then(utils.saveCookies(ctx.jar));
         | 
| 53 | 
            +
                  })
         | 
| 54 | 
            +
                  .then(function (res) {
         | 
| 55 | 
            +
                    if (!res.headers) {
         | 
| 56 | 
            +
                      throw { error: "An error occurred when logging out." };
         | 
| 57 | 
            +
                    }
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                    return defaultFuncs
         | 
| 60 | 
            +
                      .get(res.headers.location, ctx.jar)
         | 
| 61 | 
            +
                      .then(utils.saveCookies(ctx.jar));
         | 
| 62 | 
            +
                  })
         | 
| 63 | 
            +
                  .then(function () {
         | 
| 64 | 
            +
                    ctx.loggedIn = false;
         | 
| 65 | 
            +
                    console.log("logout", "Logged out successfully.");
         | 
| 66 | 
            +
                    callback();
         | 
| 67 | 
            +
                  })
         | 
| 68 | 
            +
                  .catch(function (err) {
         | 
| 69 | 
            +
                    console.error("logout", err);
         | 
| 70 | 
            +
                    return callback(err);
         | 
| 71 | 
            +
                  });
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                return returnPromise;
         | 
| 74 | 
            +
              };
         | 
| 75 | 
            +
            };
         | 
| @@ -0,0 +1,47 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            var utils = require("../utils");
         | 
| 4 | 
            +
            var log = require("npmlog");
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
              return function markAsDelivered(threadID, messageID, callback) {
         | 
| 8 | 
            +
                var resolveFunc = function () { };
         | 
| 9 | 
            +
                var rejectFunc = function () { };
         | 
| 10 | 
            +
                var returnPromise = new Promise(function (resolve, reject) {
         | 
| 11 | 
            +
                  resolveFunc = resolve;
         | 
| 12 | 
            +
                  rejectFunc = reject;
         | 
| 13 | 
            +
                });
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                if (!callback) {
         | 
| 16 | 
            +
                  callback = function (err, data) {
         | 
| 17 | 
            +
                    if (err) return rejectFunc(err);
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    resolveFunc(data);
         | 
| 20 | 
            +
                  };
         | 
| 21 | 
            +
                }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                if (!threadID || !messageID) return callback("Error: messageID or threadID is not defined");
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                var form = {};
         | 
| 26 | 
            +
                form["message_ids[0]"] = messageID;
         | 
| 27 | 
            +
                form["thread_ids[" + threadID + "][0]"] = messageID;
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                defaultFuncs
         | 
| 30 | 
            +
                  .post("https://www.facebook.com/ajax/mercury/delivery_receipts.php", ctx.jar, form)
         | 
| 31 | 
            +
                  .then(utils.saveCookies(ctx.jar))
         | 
| 32 | 
            +
                  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
         | 
| 33 | 
            +
                  .then(function (resData) {
         | 
| 34 | 
            +
                    if (resData.error) throw resData;
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    return callback();
         | 
| 37 | 
            +
                  })
         | 
| 38 | 
            +
                  .catch(function (err) {
         | 
| 39 | 
            +
                    log.error("markAsDelivered", err);
         | 
| 40 | 
            +
                    if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                    return callback(err);
         | 
| 43 | 
            +
                  });
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                return returnPromise;
         | 
| 46 | 
            +
              };
         | 
| 47 | 
            +
            };
         | 
| @@ -0,0 +1,70 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            var utils = require("../utils");
         | 
| 4 | 
            +
            var log = require("npmlog");
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
              return async function markAsRead(threadID, read, callback) {
         | 
| 8 | 
            +
                if (utils.getType(read) === 'Function' || utils.getType(read) === 'AsyncFunction') {
         | 
| 9 | 
            +
                  callback = read;
         | 
| 10 | 
            +
                  read = true;
         | 
| 11 | 
            +
                }
         | 
| 12 | 
            +
                if (read == undefined) read = true;
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                if (!callback) callback = () => { };
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                var form = {};
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                if (typeof ctx.globalOptions.pageID !== 'undefined') {
         | 
| 19 | 
            +
                  form["source"] = "PagesManagerMessagesInterface";
         | 
| 20 | 
            +
                  form["request_user_id"] = ctx.globalOptions.pageID;
         | 
| 21 | 
            +
                  form["ids[" + threadID + "]"] = read;
         | 
| 22 | 
            +
                  form["watermarkTimestamp"] = new Date().getTime();
         | 
| 23 | 
            +
                  form["shouldSendReadReceipt"] = true;
         | 
| 24 | 
            +
                  form["commerce_last_message_type"] = "";
         | 
| 25 | 
            +
                  //form["titanOriginatedThreadId"] = utils.generateThreadingID(ctx.clientID);
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  let resData;
         | 
| 28 | 
            +
                  try {
         | 
| 29 | 
            +
                    resData = await (
         | 
| 30 | 
            +
                      defaultFuncs
         | 
| 31 | 
            +
                        .post("https://www.facebook.com/ajax/mercury/change_read_status.php", ctx.jar, form)
         | 
| 32 | 
            +
                        .then(utils.saveCookies(ctx.jar))
         | 
| 33 | 
            +
                        .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
         | 
| 34 | 
            +
                    );
         | 
| 35 | 
            +
                  }
         | 
| 36 | 
            +
                  catch (e) {
         | 
| 37 | 
            +
                    callback(e);
         | 
| 38 | 
            +
                    return e;
         | 
| 39 | 
            +
                  }
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                  if (resData.error) {
         | 
| 42 | 
            +
                    let err = resData.error;
         | 
| 43 | 
            +
                    log.error("markAsRead", err);
         | 
| 44 | 
            +
                    if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
         | 
| 45 | 
            +
                    callback(err);
         | 
| 46 | 
            +
                    return err;
         | 
| 47 | 
            +
                  }
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                  callback();
         | 
| 50 | 
            +
                  return null;
         | 
| 51 | 
            +
                }
         | 
| 52 | 
            +
                else {
         | 
| 53 | 
            +
                  try {
         | 
| 54 | 
            +
                    if (ctx.mqttClient) {
         | 
| 55 | 
            +
                      let err = await new Promise(r => ctx.mqttClient.publish("/mark_thread", JSON.stringify({
         | 
| 56 | 
            +
                        threadID,
         | 
| 57 | 
            +
                        mark: "read",
         | 
| 58 | 
            +
                        state: read
         | 
| 59 | 
            +
                      }), { qos: 1, retain: false }, r));
         | 
| 60 | 
            +
                      if (err) throw err;
         | 
| 61 | 
            +
                    }
         | 
| 62 | 
            +
                    else throw { error: "You can only use this function after you start listening." };
         | 
| 63 | 
            +
                  }
         | 
| 64 | 
            +
                  catch (e) {
         | 
| 65 | 
            +
                    callback(e);
         | 
| 66 | 
            +
                    return e;
         | 
| 67 | 
            +
                  }
         | 
| 68 | 
            +
                }
         | 
| 69 | 
            +
              };
         | 
| 70 | 
            +
            };
         | 
| @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            var utils = require("../utils");
         | 
| 4 | 
            +
            var log = require("npmlog");
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
              return function markAsReadAll(callback) {
         | 
| 8 | 
            +
                var resolveFunc = function () { };
         | 
| 9 | 
            +
                var rejectFunc = function () { };
         | 
| 10 | 
            +
                var returnPromise = new Promise(function (resolve, reject) {
         | 
| 11 | 
            +
                  resolveFunc = resolve;
         | 
| 12 | 
            +
                  rejectFunc = reject;
         | 
| 13 | 
            +
                });
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                if (!callback) {
         | 
| 16 | 
            +
                  callback = function (err, data) {
         | 
| 17 | 
            +
                    if (err) return rejectFunc(err);
         | 
| 18 | 
            +
                    resolveFunc(data);
         | 
| 19 | 
            +
                  };
         | 
| 20 | 
            +
                }
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                var form = {
         | 
| 23 | 
            +
                  folder: 'inbox'
         | 
| 24 | 
            +
                };
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                defaultFuncs
         | 
| 27 | 
            +
                  .post("https://www.facebook.com/ajax/mercury/mark_folder_as_read.php", ctx.jar, form)
         | 
| 28 | 
            +
                  .then(utils.saveCookies(ctx.jar))
         | 
| 29 | 
            +
                  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
         | 
| 30 | 
            +
                  .then(function (resData) {
         | 
| 31 | 
            +
                    if (resData.error) throw resData;
         | 
| 32 | 
            +
                    return callback();
         | 
| 33 | 
            +
                  })
         | 
| 34 | 
            +
                  .catch(function (err) {
         | 
| 35 | 
            +
                    log.error("markAsReadAll", err);
         | 
| 36 | 
            +
                    return callback(err);
         | 
| 37 | 
            +
                  });
         | 
| 38 | 
            +
                return returnPromise;
         | 
| 39 | 
            +
              };
         | 
| 40 | 
            +
            };
         | 
| @@ -0,0 +1,48 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            var utils = require("../utils");
         | 
| 4 | 
            +
            var log = require("npmlog");
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
              return function markAsRead(seen_timestamp, callback) {
         | 
| 8 | 
            +
                if (utils.getType(seen_timestamp) == "Function" ||
         | 
| 9 | 
            +
                  utils.getType(seen_timestamp) == "AsyncFunction") {
         | 
| 10 | 
            +
                  callback = seen_timestamp;
         | 
| 11 | 
            +
                  seen_timestamp = Date.now();
         | 
| 12 | 
            +
                }
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                var resolveFunc = function () { };
         | 
| 15 | 
            +
                var rejectFunc = function () { };
         | 
| 16 | 
            +
                var returnPromise = new Promise(function (resolve, reject) {
         | 
| 17 | 
            +
                  resolveFunc = resolve;
         | 
| 18 | 
            +
                  rejectFunc = reject;
         | 
| 19 | 
            +
                });
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                if (!callback) {
         | 
| 22 | 
            +
                  callback = function (err, data) {
         | 
| 23 | 
            +
                    if (err) return rejectFunc(err);
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                    resolveFunc(data);
         | 
| 26 | 
            +
                  };
         | 
| 27 | 
            +
                }
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                var form = {
         | 
| 30 | 
            +
                  seen_timestamp: seen_timestamp
         | 
| 31 | 
            +
                };
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                defaultFuncs
         | 
| 34 | 
            +
                  .post("https://www.facebook.com/ajax/mercury/mark_seen.php", ctx.jar, form)
         | 
| 35 | 
            +
                  .then(utils.saveCookies(ctx.jar))
         | 
| 36 | 
            +
                  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
         | 
| 37 | 
            +
                  .then(function (resData) {
         | 
| 38 | 
            +
                    if (resData.error) throw resData;
         | 
| 39 | 
            +
                    return callback();
         | 
| 40 | 
            +
                  })
         | 
| 41 | 
            +
                  .catch(function (err) {
         | 
| 42 | 
            +
                    log.error("markAsSeen", err);
         | 
| 43 | 
            +
                    if (utils.getType(err) == "Object" && err.error === "Not logged in.") ctx.loggedIn = false;
         | 
| 44 | 
            +
                    return callback(err);
         | 
| 45 | 
            +
                  });
         | 
| 46 | 
            +
                return returnPromise;
         | 
| 47 | 
            +
              };
         | 
| 48 | 
            +
            };
         | 
| @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            var utils = require("../utils");
         | 
| 4 | 
            +
            var log = require("npmlog");
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
              // muteSecond: -1=permanent mute, 0=unmute, 60=one minute, 3600=one hour, etc.
         | 
| 8 | 
            +
              return function muteThread(threadID, muteSeconds, callback) {
         | 
| 9 | 
            +
                var resolveFunc = function () { };
         | 
| 10 | 
            +
                var rejectFunc = function () { };
         | 
| 11 | 
            +
                var returnPromise = new Promise(function (resolve, reject) {
         | 
| 12 | 
            +
                  resolveFunc = resolve;
         | 
| 13 | 
            +
                  rejectFunc = reject;
         | 
| 14 | 
            +
                });
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                if (!callback) {
         | 
| 17 | 
            +
                  callback = function (err, data) {
         | 
| 18 | 
            +
                    if (err) return rejectFunc(err);
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                    resolveFunc(data);
         | 
| 21 | 
            +
                  };
         | 
| 22 | 
            +
                }
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                var form = {
         | 
| 25 | 
            +
                  thread_fbid: threadID,
         | 
| 26 | 
            +
                  mute_settings: muteSeconds
         | 
| 27 | 
            +
                };
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                defaultFuncs
         | 
| 30 | 
            +
                  .post("https://www.facebook.com/ajax/mercury/change_mute_thread.php", ctx.jar, form)
         | 
| 31 | 
            +
                  .then(utils.saveCookies(ctx.jar))
         | 
| 32 | 
            +
                  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
         | 
| 33 | 
            +
                  .then(function (resData) {
         | 
| 34 | 
            +
                    if (resData.error) throw resData;
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    return callback();
         | 
| 37 | 
            +
                  })
         | 
| 38 | 
            +
                  .catch(function (err) {
         | 
| 39 | 
            +
                    log.error("muteThread", err);
         | 
| 40 | 
            +
                    return callback(err);
         | 
| 41 | 
            +
                  });
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                return returnPromise;
         | 
| 44 | 
            +
              };
         | 
| 45 | 
            +
            };
         | 
| @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            var utils = require("../utils");
         | 
| 4 | 
            +
            var log = require("npmlog");
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
              return function postFormData(url, form, callback) {
         | 
| 8 | 
            +
                var resolveFunc = function () {};
         | 
| 9 | 
            +
                var rejectFunc = function () {};
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                var returnPromise = new Promise(function (resolve, reject) {
         | 
| 12 | 
            +
                  resolveFunc = resolve;
         | 
| 13 | 
            +
                  rejectFunc = reject;
         | 
| 14 | 
            +
                });
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                if (
         | 
| 17 | 
            +
                  !callback &&
         | 
| 18 | 
            +
                  (utils.getType(form) == "Function" ||
         | 
| 19 | 
            +
                    utils.getType(form) == "AsyncFunction")
         | 
| 20 | 
            +
                ) {
         | 
| 21 | 
            +
                  callback = form;
         | 
| 22 | 
            +
                  form = {};
         | 
| 23 | 
            +
                }
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                form = form || {};
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                callback =
         | 
| 28 | 
            +
                  callback ||
         | 
| 29 | 
            +
                  function (err, data) {
         | 
| 30 | 
            +
                    if (err) return rejectFunc(err);
         | 
| 31 | 
            +
                    resolveFunc(data);
         | 
| 32 | 
            +
                  };
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                defaultFuncs
         | 
| 35 | 
            +
                  .postFormData(url, ctx.jar, form, {})
         | 
| 36 | 
            +
                  .then(function (resData) {
         | 
| 37 | 
            +
                    callback(null, resData.body.toString());
         | 
| 38 | 
            +
                  })
         | 
| 39 | 
            +
                  .catch(function (err) {
         | 
| 40 | 
            +
                    log.error("postFormData", err);
         | 
| 41 | 
            +
                    return callback(err);
         | 
| 42 | 
            +
                  });
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                return returnPromise;
         | 
| 45 | 
            +
              };
         | 
| 46 | 
            +
            };
         | 
| @@ -0,0 +1,89 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            const utils = require("../utils");
         | 
| 4 | 
            +
            // @NethWs3Dev
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
             /**
         | 
| 8 | 
            +
               * Refreshes the fb_dtsg and jazoest values.
         | 
| 9 | 
            +
               * @param {Function} callback
         | 
| 10 | 
            +
               * @returns {Promise}
         | 
| 11 | 
            +
               * @description if you don't update the value of fb_dtsg and jazoest for a long time an error "Please try closing and re-opening your browser window" will appear
         | 
| 12 | 
            +
               * @description you should refresh it every 48h or less
         | 
| 13 | 
            +
               */
         | 
| 14 | 
            +
              return function refreshFb_dtsg(obj, callback) {
         | 
| 15 | 
            +
                let resolveFunc = function () {};
         | 
| 16 | 
            +
                let rejectFunc = function () {};
         | 
| 17 | 
            +
                const returnPromise = new Promise(function (resolve, reject) {
         | 
| 18 | 
            +
                  resolveFunc = resolve;
         | 
| 19 | 
            +
                  rejectFunc = reject;
         | 
| 20 | 
            +
                });
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                if (
         | 
| 23 | 
            +
                  utils.getType(obj) === "Function" ||
         | 
| 24 | 
            +
                  utils.getType(obj) === "AsyncFunction"
         | 
| 25 | 
            +
                ) {
         | 
| 26 | 
            +
                  callback = obj;
         | 
| 27 | 
            +
                  obj = {};
         | 
| 28 | 
            +
                }
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                if (!obj) {
         | 
| 31 | 
            +
                  obj = {};
         | 
| 32 | 
            +
                }
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                if (utils.getType(obj) !== "Object") {
         | 
| 35 | 
            +
                  throw new utils.CustomError(
         | 
| 36 | 
            +
                    "the first parameter must be an object or a callback function",
         | 
| 37 | 
            +
                  );
         | 
| 38 | 
            +
                }
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                if (!callback) {
         | 
| 41 | 
            +
                  callback = function (err, friendList) {
         | 
| 42 | 
            +
                    if (err) {
         | 
| 43 | 
            +
                      return rejectFunc(err);
         | 
| 44 | 
            +
                    }
         | 
| 45 | 
            +
                    resolveFunc(friendList);
         | 
| 46 | 
            +
                  };
         | 
| 47 | 
            +
                }
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                if (Object.keys(obj).length == 0) {
         | 
| 50 | 
            +
                  utils
         | 
| 51 | 
            +
                    .get("https://m.facebook.com/", ctx.jar, null, ctx.globalOptions, {
         | 
| 52 | 
            +
                      noRef: true,
         | 
| 53 | 
            +
                    })
         | 
| 54 | 
            +
                    .then(function (resData) {
         | 
| 55 | 
            +
                      const html = resData.body;
         | 
| 56 | 
            +
                      const fb_dtsg = utils.getFrom(html, 'name="fb_dtsg" value="', '"');
         | 
| 57 | 
            +
                      const jazoest = utils.getFrom(html, 'name="jazoest" value="', '"');
         | 
| 58 | 
            +
                      if (!fb_dtsg) {
         | 
| 59 | 
            +
                        throw new utils.CustomError(
         | 
| 60 | 
            +
                          "Could not find fb_dtsg in HTML after requesting https://www.facebook.com/",
         | 
| 61 | 
            +
                        );
         | 
| 62 | 
            +
                      }
         | 
| 63 | 
            +
                      ctx.fb_dtsg = fb_dtsg;
         | 
| 64 | 
            +
                      ctx.jazoest = jazoest;
         | 
| 65 | 
            +
                      callback(null, {
         | 
| 66 | 
            +
                        data: {
         | 
| 67 | 
            +
                          fb_dtsg: fb_dtsg,
         | 
| 68 | 
            +
                          jazoest: jazoest,
         | 
| 69 | 
            +
                        },
         | 
| 70 | 
            +
                        message: "refreshed fb_dtsg and jazoest",
         | 
| 71 | 
            +
                      });
         | 
| 72 | 
            +
                    })
         | 
| 73 | 
            +
                    .catch(function (err) {
         | 
| 74 | 
            +
                      console.error("refreshFb_dtsg", err);
         | 
| 75 | 
            +
                      return callback(err);
         | 
| 76 | 
            +
                    });
         | 
| 77 | 
            +
                } else {
         | 
| 78 | 
            +
                  Object.keys(obj).forEach(function (key) {
         | 
| 79 | 
            +
                    ctx[key] = obj[key];
         | 
| 80 | 
            +
                  });
         | 
| 81 | 
            +
                  callback(null, {
         | 
| 82 | 
            +
                    data: obj,
         | 
| 83 | 
            +
                    message: "refreshed " + Object.keys(obj).join(", "),
         | 
| 84 | 
            +
                  });
         | 
| 85 | 
            +
                }
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                return returnPromise;
         | 
| 88 | 
            +
              };
         | 
| 89 | 
            +
            };
         | 
| @@ -0,0 +1,79 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            const utils = require("../utils");
         | 
| 4 | 
            +
            // @NethWs3Dev
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
              return function removeUserFromGroup(userID, threadID, callback) {
         | 
| 8 | 
            +
                if (
         | 
| 9 | 
            +
                  !callback &&
         | 
| 10 | 
            +
                  (utils.getType(threadID) === "Function" ||
         | 
| 11 | 
            +
                    utils.getType(threadID) === "AsyncFunction")
         | 
| 12 | 
            +
                ) {
         | 
| 13 | 
            +
                  throw { error: "please pass a threadID as a second argument." };
         | 
| 14 | 
            +
                }
         | 
| 15 | 
            +
                if (
         | 
| 16 | 
            +
                  utils.getType(threadID) !== "Number" &&
         | 
| 17 | 
            +
                  utils.getType(threadID) !== "String"
         | 
| 18 | 
            +
                ) {
         | 
| 19 | 
            +
                  throw {
         | 
| 20 | 
            +
                    error:
         | 
| 21 | 
            +
                      "threadID should be of type Number or String and not " +
         | 
| 22 | 
            +
                      utils.getType(threadID) +
         | 
| 23 | 
            +
                      ".",
         | 
| 24 | 
            +
                  };
         | 
| 25 | 
            +
                }
         | 
| 26 | 
            +
                if (
         | 
| 27 | 
            +
                  utils.getType(userID) !== "Number" &&
         | 
| 28 | 
            +
                  utils.getType(userID) !== "String"
         | 
| 29 | 
            +
                ) {
         | 
| 30 | 
            +
                  throw {
         | 
| 31 | 
            +
                    error:
         | 
| 32 | 
            +
                      "userID should be of type Number or String and not " +
         | 
| 33 | 
            +
                      utils.getType(userID) +
         | 
| 34 | 
            +
                      ".",
         | 
| 35 | 
            +
                  };
         | 
| 36 | 
            +
                }
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                let resolveFunc = function () {};
         | 
| 39 | 
            +
                let rejectFunc = function () {};
         | 
| 40 | 
            +
                const returnPromise = new Promise(function (resolve, reject) {
         | 
| 41 | 
            +
                  resolveFunc = resolve;
         | 
| 42 | 
            +
                  rejectFunc = reject;
         | 
| 43 | 
            +
                });
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                if (!callback) {
         | 
| 46 | 
            +
                  callback = function (err, friendList) {
         | 
| 47 | 
            +
                    if (err) {
         | 
| 48 | 
            +
                      return rejectFunc(err);
         | 
| 49 | 
            +
                    }
         | 
| 50 | 
            +
                    resolveFunc(friendList);
         | 
| 51 | 
            +
                  };
         | 
| 52 | 
            +
                }
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                const form = {
         | 
| 55 | 
            +
                  uid: userID,
         | 
| 56 | 
            +
                  tid: threadID,
         | 
| 57 | 
            +
                };
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                defaultFuncs
         | 
| 60 | 
            +
                  .post("https://www.facebook.com/chat/remove_participants", ctx.jar, form)
         | 
| 61 | 
            +
                  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
         | 
| 62 | 
            +
                  .then(function (resData) {
         | 
| 63 | 
            +
                    if (!resData) {
         | 
| 64 | 
            +
                      throw { error: "Remove from group failed." };
         | 
| 65 | 
            +
                    }
         | 
| 66 | 
            +
                    if (resData.error) {
         | 
| 67 | 
            +
                      throw resData;
         | 
| 68 | 
            +
                    }
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                    return callback();
         | 
| 71 | 
            +
                  })
         | 
| 72 | 
            +
                  .catch(function (err) {
         | 
| 73 | 
            +
                    console.error("removeUserFromGroup", err);
         | 
| 74 | 
            +
                    return callback(err);
         | 
| 75 | 
            +
                  });
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                return returnPromise;
         | 
| 78 | 
            +
              };
         | 
| 79 | 
            +
            };
         | 
| @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            const utils = require("../utils");
         | 
| 4 | 
            +
            // @NethWs3Dev
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 7 | 
            +
              return function resolvePhotoUrl(photoID, callback) {
         | 
| 8 | 
            +
                let resolveFunc = function () {};
         | 
| 9 | 
            +
                let rejectFunc = function () {};
         | 
| 10 | 
            +
                const returnPromise = new Promise(function (resolve, reject) {
         | 
| 11 | 
            +
                  resolveFunc = resolve;
         | 
| 12 | 
            +
                  rejectFunc = reject;
         | 
| 13 | 
            +
                });
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                if (!callback) {
         | 
| 16 | 
            +
                  callback = function (err, friendList) {
         | 
| 17 | 
            +
                    if (err) {
         | 
| 18 | 
            +
                      return rejectFunc(err);
         | 
| 19 | 
            +
                    }
         | 
| 20 | 
            +
                    resolveFunc(friendList);
         | 
| 21 | 
            +
                  };
         | 
| 22 | 
            +
                }
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                defaultFuncs
         | 
| 25 | 
            +
                  .get("https://www.facebook.com/mercury/attachments/photo", ctx.jar, {
         | 
| 26 | 
            +
                    photo_id: photoID,
         | 
| 27 | 
            +
                  })
         | 
| 28 | 
            +
                  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
         | 
| 29 | 
            +
                  .then((resData) => {
         | 
| 30 | 
            +
                    if (resData.error) {
         | 
| 31 | 
            +
                      throw resData;
         | 
| 32 | 
            +
                    }
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                    const photoUrl = resData.jsmods.require[0][3][0];
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    return callback(null, photoUrl);
         | 
| 37 | 
            +
                  })
         | 
| 38 | 
            +
                  .catch((err) => {
         | 
| 39 | 
            +
                    console.error("resolvePhotoUrl", err);
         | 
| 40 | 
            +
                    return callback(err);
         | 
| 41 | 
            +
                  });
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                return returnPromise;
         | 
| 44 | 
            +
              };
         | 
| 45 | 
            +
            };
         | 
| @@ -0,0 +1,53 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            const utils = require("../utils");
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module.exports = function (defaultFuncs, api, ctx) {
         | 
| 6 | 
            +
              return function searchForThread(name, callback) {
         | 
| 7 | 
            +
                let resolveFunc = function () {};
         | 
| 8 | 
            +
                let rejectFunc = function () {};
         | 
| 9 | 
            +
                const returnPromise = new Promise(function (resolve, reject) {
         | 
| 10 | 
            +
                  resolveFunc = resolve;
         | 
| 11 | 
            +
                  rejectFunc = reject;
         | 
| 12 | 
            +
                });
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                if (!callback) {
         | 
| 15 | 
            +
                  callback = function (err, friendList) {
         | 
| 16 | 
            +
                    if (err) {
         | 
| 17 | 
            +
                      return rejectFunc(err);
         | 
| 18 | 
            +
                    }
         | 
| 19 | 
            +
                    resolveFunc(friendList);
         | 
| 20 | 
            +
                  };
         | 
| 21 | 
            +
                }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                const tmpForm = {
         | 
| 24 | 
            +
                  client: "web_messenger",
         | 
| 25 | 
            +
                  query: name,
         | 
| 26 | 
            +
                  offset: 0,
         | 
| 27 | 
            +
                  limit: 21,
         | 
| 28 | 
            +
                  index: "fbid",
         | 
| 29 | 
            +
                };
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                defaultFuncs
         | 
| 32 | 
            +
                  .post(
         | 
| 33 | 
            +
                    "https://www.facebook.com/ajax/mercury/search_threads.php",
         | 
| 34 | 
            +
                    ctx.jar,
         | 
| 35 | 
            +
                    tmpForm,
         | 
| 36 | 
            +
                  )
         | 
| 37 | 
            +
                  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
         | 
| 38 | 
            +
                  .then(function (resData) {
         | 
| 39 | 
            +
                    if (resData.error) {
         | 
| 40 | 
            +
                      throw resData;
         | 
| 41 | 
            +
                    }
         | 
| 42 | 
            +
                    if (!resData.payload.mercury_payload.threads) {
         | 
| 43 | 
            +
                      return callback({ error: "Could not find thread `" + name + "`." });
         | 
| 44 | 
            +
                    }
         | 
| 45 | 
            +
                    return callback(
         | 
| 46 | 
            +
                      null,
         | 
| 47 | 
            +
                      resData.payload.mercury_payload.threads.map(utils.formatThread),
         | 
| 48 | 
            +
                    );
         | 
| 49 | 
            +
                  });
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                return returnPromise;
         | 
| 52 | 
            +
              };
         | 
| 53 | 
            +
            };
         | 
| @@ -0,0 +1,53 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            'use strict';
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            var utils = require('../utils.js');
         | 
| 5 | 
            +
            var log = require('npmlog');
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            module.exports = function (http, api, ctx) {
         | 
| 8 | 
            +
              function formatData(res) {
         | 
| 9 | 
            +
                return {
         | 
| 10 | 
            +
                  id: res.node.id,
         | 
| 11 | 
            +
                  image: res.node.image,
         | 
| 12 | 
            +
                  package: res.node.pack != null ? {
         | 
| 13 | 
            +
                    name: res.node.pack.name,
         | 
| 14 | 
            +
                    id: res.node.pack.id
         | 
| 15 | 
            +
                  } : {},
         | 
| 16 | 
            +
                  label: res.node.label
         | 
| 17 | 
            +
                };
         | 
| 18 | 
            +
              }
         | 
| 19 | 
            +
              
         | 
| 20 | 
            +
              return function searchStickers(query = '', callback) {
         | 
| 21 | 
            +
                var cb;
         | 
| 22 | 
            +
                var returnPromise = new Promise(function (resolve, reject) {
         | 
| 23 | 
            +
                  cb = function (error, data) {
         | 
| 24 | 
            +
                    data ? resolve(data) : reject(error);
         | 
| 25 | 
            +
                  }
         | 
| 26 | 
            +
                });
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                if (typeof callback == 'function') cb = callback;
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                var form = {
         | 
| 31 | 
            +
                  fb_api_req_friendly_name: 'StickersFlyoutTagSelectorQuery',
         | 
| 32 | 
            +
                  variables: JSON.stringify({
         | 
| 33 | 
            +
                    stickerWidth: 64,
         | 
| 34 | 
            +
                    stickerHeight: 64,
         | 
| 35 | 
            +
                    stickerInterface: 'messages',
         | 
| 36 | 
            +
                    query
         | 
| 37 | 
            +
                  }),
         | 
| 38 | 
            +
                  doc_id: '4642836929159953'
         | 
| 39 | 
            +
                }
         | 
| 40 | 
            +
                http
         | 
| 41 | 
            +
                  .post('https://www.facebook.com/api/graphql/', ctx.jar, form)
         | 
| 42 | 
            +
                  .then(utils.parseAndCheckLogin(ctx, http))
         | 
| 43 | 
            +
                  .then(function (res) {
         | 
| 44 | 
            +
                    return cb(null, res.data.sticker_search.sticker_results.edges.map(formatData));
         | 
| 45 | 
            +
                  })
         | 
| 46 | 
            +
                  .catch(function (err) {
         | 
| 47 | 
            +
                    console.error('searchStickers', err);
         | 
| 48 | 
            +
                    return cb(err);
         | 
| 49 | 
            +
                  });
         | 
| 50 | 
            +
                return returnPromise;
         | 
| 51 | 
            +
              }
         | 
| 52 | 
            +
            }
         | 
| 53 | 
            +
             |