alicezetion 1.9.6 → 1.9.8
Sign up to get free protection for your applications and to get access to all the features.
- package/.cache/replit/modules/nodejs-20.res +1 -0
- package/.cache/replit/modules/replit.res +1 -0
- package/.cache/typescript/5.4/node_modules/.package-lock.json +137 -0
- package/.cache/typescript/5.4/node_modules/@types/bluebird/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/bluebird/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/bluebird/index.d.ts +1365 -0
- package/.cache/typescript/5.4/node_modules/@types/bluebird/package.json +25 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/README.md +48 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/index.d.ts +29 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/package.json +35 -0
- package/.cache/typescript/5.4/node_modules/@types/cheerio/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/cheerio/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/cheerio/index.d.ts +318 -0
- package/.cache/typescript/5.4/node_modules/@types/cheerio/package.json +71 -0
- package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/node/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +1040 -0
- package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +2363 -0
- package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +1544 -0
- package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +578 -0
- package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +452 -0
- package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +4523 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +596 -0
- package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +864 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +124 -0
- package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +170 -0
- package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +931 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +4317 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +412 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +1 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +1908 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +2418 -0
- package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +550 -0
- package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +89 -0
- package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +2746 -0
- package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +315 -0
- package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +999 -0
- package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +495 -0
- package/.cache/typescript/5.4/node_modules/@types/node/package.json +217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +191 -0
- package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +905 -0
- package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +1754 -0
- package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +117 -0
- package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +540 -0
- package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +430 -0
- package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +367 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +1707 -0
- package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +1718 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +240 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +1217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +197 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +208 -0
- package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +952 -0
- package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +2292 -0
- package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +808 -0
- package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +924 -0
- package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +181 -0
- package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +694 -0
- package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +530 -0
- package/.cache/typescript/5.4/node_modules/@types/npmlog/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/npmlog/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/npmlog/index.d.ts +84 -0
- package/.cache/typescript/5.4/node_modules/@types/npmlog/package.json +32 -0
- package/.cache/typescript/5.4/node_modules/@types/request/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/request/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/request/index.d.ts +395 -0
- package/.cache/typescript/5.4/node_modules/@types/request/package.json +70 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/index.d.ts +321 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/package.json +35 -0
- package/.cache/typescript/5.4/node_modules/asynckit/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/asynckit/README.md +233 -0
- package/.cache/typescript/5.4/node_modules/asynckit/bench.js +76 -0
- package/.cache/typescript/5.4/node_modules/asynckit/index.js +6 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/abort.js +29 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/async.js +34 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/defer.js +26 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/iterate.js +75 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/state.js +37 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/streamify.js +141 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/terminator.js +29 -0
- package/.cache/typescript/5.4/node_modules/asynckit/package.json +63 -0
- package/.cache/typescript/5.4/node_modules/asynckit/parallel.js +43 -0
- package/.cache/typescript/5.4/node_modules/asynckit/serial.js +17 -0
- package/.cache/typescript/5.4/node_modules/asynckit/serialOrdered.js +75 -0
- package/.cache/typescript/5.4/node_modules/asynckit/stream.js +21 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/License +19 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/Readme.md +138 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/package.json +25 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/yarn.lock +17 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/License +19 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/Makefile +7 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/Readme.md +141 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/package.json +27 -0
- package/.cache/typescript/5.4/node_modules/form-data/License +19 -0
- package/.cache/typescript/5.4/node_modules/form-data/README.md +350 -0
- package/.cache/typescript/5.4/node_modules/form-data/README.md.bak +350 -0
- package/.cache/typescript/5.4/node_modules/form-data/index.d.ts +51 -0
- package/.cache/typescript/5.4/node_modules/form-data/lib/browser.js +2 -0
- package/.cache/typescript/5.4/node_modules/form-data/lib/form_data.js +483 -0
- package/.cache/typescript/5.4/node_modules/form-data/lib/populate.js +10 -0
- package/.cache/typescript/5.4/node_modules/form-data/package.json +68 -0
- package/.cache/typescript/5.4/node_modules/mime-db/HISTORY.md +507 -0
- package/.cache/typescript/5.4/node_modules/mime-db/LICENSE +23 -0
- package/.cache/typescript/5.4/node_modules/mime-db/README.md +100 -0
- package/.cache/typescript/5.4/node_modules/mime-db/db.json +8519 -0
- package/.cache/typescript/5.4/node_modules/mime-db/index.js +12 -0
- package/.cache/typescript/5.4/node_modules/mime-db/package.json +60 -0
- package/.cache/typescript/5.4/node_modules/mime-types/HISTORY.md +397 -0
- package/.cache/typescript/5.4/node_modules/mime-types/LICENSE +23 -0
- package/.cache/typescript/5.4/node_modules/mime-types/README.md +113 -0
- package/.cache/typescript/5.4/node_modules/mime-types/index.js +188 -0
- package/.cache/typescript/5.4/node_modules/mime-types/package.json +44 -0
- package/.cache/typescript/5.4/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.4/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.4/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.4/node_modules/undici-types/README.md +6 -0
- package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +31 -0
- package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +43 -0
- package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +36 -0
- package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +34 -0
- package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +21 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +128 -0
- package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +209 -0
- package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +39 -0
- package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +54 -0
- package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +108 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +7 -0
- package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +4 -0
- package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +63 -0
- package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +5 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/package.json +55 -0
- package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +71 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +61 -0
- package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +220 -0
- package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +131 -0
- package/.cache/typescript/5.4/package-lock.json +149 -0
- package/.cache/typescript/5.4/package.json +1 -0
- package/index.js +290 -70
- package/leiamnash/addExternalModule.js +15 -0
- package/leiamnash/addUserToGroup.js +77 -0
- package/leiamnash/changeAdminStatus.js +47 -0
- package/leiamnash/changeArchivedStatus.js +41 -0
- package/{src → leiamnash}/changeAvatar.js +3 -2
- package/leiamnash/changeBio.js +64 -0
- package/leiamnash/changeBlockedStatus.js +36 -0
- package/leiamnash/changeGroupImage.js +105 -0
- package/leiamnash/changeNickname.js +43 -0
- package/leiamnash/changeThreadColor.js +61 -0
- package/leiamnash/changeThreadEmoji.js +41 -0
- package/{src → leiamnash}/chat.js +4 -29
- package/leiamnash/createNewGroup.js +70 -0
- package/leiamnash/createPoll.js +59 -0
- package/leiamnash/deleteMessage.js +44 -0
- package/leiamnash/deleteThread.js +42 -0
- package/leiamnash/editMessage.js +62 -0
- package/leiamnash/forwardAttachment.js +47 -0
- package/leiamnash/forwardMessage.js +0 -0
- package/leiamnash/getCurrentUserID.js +7 -0
- package/leiamnash/getEmojiUrl.js +27 -0
- package/leiamnash/getFriendsList.js +73 -0
- package/leiamnash/getInfoVideo.js +134 -0
- package/leiamnash/getThreadHistory.js +537 -0
- package/leiamnash/getThreadHistoryDeprecated.js +71 -0
- package/leiamnash/getThreadInfo.js +171 -0
- package/leiamnash/getThreadInfoDeprecated.js +56 -0
- package/leiamnash/getThreadList.js +213 -0
- package/leiamnash/getThreadListDeprecated.js +46 -0
- package/leiamnash/getThreadPictures.js +59 -0
- package/leiamnash/getUserID.js +61 -0
- package/leiamnash/getUserInfo.js +66 -0
- package/leiamnash/handleFriendRequest.js +46 -0
- package/leiamnash/handleMessageRequest.js +47 -0
- package/leiamnash/httpGet.js +47 -0
- package/leiamnash/httpPost.js +47 -0
- package/leiamnash/httpPostFormData.js +42 -0
- package/leiamnash/listenMqtt.js +843 -0
- package/leiamnash/logout.js +68 -0
- package/leiamnash/markAsDelivered.js +47 -0
- package/leiamnash/markAsRead.js +70 -0
- package/leiamnash/markAsReadAll.js +40 -0
- package/leiamnash/markAsSeen.js +48 -0
- package/leiamnash/muteThread.js +45 -0
- package/leiamnash/pinMessage.js +58 -0
- package/leiamnash/react.js +109 -0
- package/{src → leiamnash}/refreshFb_dtsg.js +1 -1
- package/leiamnash/removeUserFromGroup.js +45 -0
- package/leiamnash/resolvePhotoUrl.js +36 -0
- package/leiamnash/searchForThread.js +42 -0
- package/leiamnash/seen.js +40 -0
- package/leiamnash/sendMessage.js +315 -0
- package/leiamnash/sendTypingIndicator.js +70 -0
- package/leiamnash/setMessageReaction.js +103 -0
- package/leiamnash/setPostReaction.js +63 -0
- package/leiamnash/setTitle.js +70 -0
- package/leiamnash/threadColors.js +41 -0
- package/leiamnash/token.js +112 -0
- package/leiamnash/unfriend.js +42 -0
- package/leiamnash/unsendMessage.js +39 -0
- package/{src → leiamnash}/uploadAttachment.js +2 -1
- package/package.json +3 -2
- package/utils.js +1345 -1382
- package/.cache/replit/modules/nodejs-20:v28-20240213-3f08513.res +0 -1
- package/.cache/replit/modules/replit:v5-20240209-9e3a339.res +0 -1
- package/.replit +0 -1
- package/src/addExternalModule.js +0 -19
- package/src/addUserToGroup.js +0 -113
- package/src/changeAdminStatus.js +0 -79
- package/src/changeArchivedStatus.js +0 -55
- package/src/changeBio.js +0 -77
- package/src/changeBlockedStatus.js +0 -47
- package/src/changeGroupImage.js +0 -132
- package/src/changeNickname.js +0 -59
- package/src/changeThreadColor.js +0 -65
- package/src/changeThreadEmoji.js +0 -55
- package/src/createNewGroup.js +0 -86
- package/src/createPoll.js +0 -71
- package/src/deleteMessage.js +0 -56
- package/src/deleteThread.js +0 -56
- package/src/edit.js +0 -66
- package/src/forwardAttachment.js +0 -60
- package/src/getCurrentUserID.js +0 -7
- package/src/getEmojiUrl.js +0 -29
- package/src/getFriendsList.js +0 -83
- package/src/getThreadHistory.js +0 -666
- package/src/getThreadInfo.js +0 -232
- package/src/getThreadList.js +0 -241
- package/src/getThreadPictures.js +0 -79
- package/src/getUserID.js +0 -66
- package/src/getUserInfo.js +0 -74
- package/src/handleFriendRequest.js +0 -61
- package/src/handleMessageRequest.js +0 -65
- package/src/httpGet.js +0 -57
- package/src/httpPost.js +0 -57
- package/src/httpPostFormData.js +0 -63
- package/src/listenMqtt.js +0 -854
- package/src/logout.js +0 -75
- package/src/markAsDelivered.js +0 -58
- package/src/markAsRead.js +0 -80
- package/src/markAsReadAll.js +0 -50
- package/src/markAsSeen.js +0 -59
- package/src/muteThread.js +0 -52
- package/src/react.js +0 -121
- package/src/removeUserFromGroup.js +0 -79
- package/src/resolvePhotoUrl.js +0 -45
- package/src/searchForThread.js +0 -53
- package/src/seen.js +0 -50
- package/src/sendMessage.js +0 -477
- package/src/sendTypingIndicator.js +0 -103
- package/src/setMessageReaction.js +0 -121
- package/src/setPostReaction.js +0 -109
- package/src/setTitle.js +0 -86
- package/src/threadColors.js +0 -131
- package/src/unfriend.js +0 -52
- package/src/unsendMessage.js +0 -49
- /package/{src → leiamnash}/getMessage.js +0 -0
package/utils.js
CHANGED
@@ -1,1545 +1,1508 @@
|
|
1
|
-
/* eslint-disable no-prototype-builtins */
|
2
1
|
"use strict";
|
3
2
|
|
4
|
-
|
3
|
+
const bluebird = require("bluebird");
|
4
|
+
let request = bluebird.promisify(require("request").defaults({ jar: true, proxy: process.env.FB_PROXY }));
|
5
5
|
const stream = require("stream");
|
6
6
|
const log = require("npmlog");
|
7
7
|
const querystring = require("querystring");
|
8
8
|
const url = require("url");
|
9
9
|
|
10
10
|
class CustomError extends Error {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}
|
20
|
-
|
21
|
-
function callbackToPromise(func) {
|
22
|
-
return function (...args) {
|
23
|
-
return new Promise((resolve, reject) => {
|
24
|
-
func(...args, (err, data) => {
|
25
|
-
if (err)
|
26
|
-
reject(err);
|
27
|
-
else
|
28
|
-
resolve(data);
|
29
|
-
});
|
30
|
-
});
|
31
|
-
};
|
32
|
-
}
|
33
|
-
|
34
|
-
function isHasCallback(func) {
|
35
|
-
if (typeof func !== "function")
|
36
|
-
return false;
|
37
|
-
return func.toString().split("\n")[0].match(/(callback|cb)\s*\)/) !== null;
|
38
|
-
}
|
39
|
-
|
40
|
-
// replace for bluebird.promisify (but this only applies best to the `request` package)
|
41
|
-
function promisifyPromise(promise) {
|
42
|
-
const keys = Object.keys(promise);
|
43
|
-
let promise_;
|
44
|
-
if (
|
45
|
-
typeof promise === "function"
|
46
|
-
&& isHasCallback(promise)
|
47
|
-
)
|
48
|
-
promise_ = callbackToPromise(promise);
|
49
|
-
else
|
50
|
-
promise_ = promise;
|
51
|
-
|
52
|
-
for (const key of keys) {
|
53
|
-
if (!promise[key]?.toString)
|
54
|
-
continue;
|
55
|
-
|
56
|
-
if (
|
57
|
-
typeof promise[key] === "function"
|
58
|
-
&& isHasCallback(promise[key])
|
59
|
-
) {
|
60
|
-
promise_[key] = callbackToPromise(promise[key]);
|
61
|
-
}
|
62
|
-
else {
|
63
|
-
promise_[key] = promise[key];
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
return promise_;
|
68
|
-
}
|
69
|
-
|
70
|
-
// replace for bluebird.delay
|
71
|
-
function delay(ms) {
|
72
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
73
|
-
}
|
74
|
-
|
75
|
-
// replace for bluebird.try
|
76
|
-
function tryPromise(tryFunc) {
|
77
|
-
return new Promise((resolve, reject) => {
|
78
|
-
try {
|
79
|
-
resolve(tryFunc());
|
80
|
-
} catch (error) {
|
81
|
-
reject(error);
|
82
|
-
}
|
83
|
-
});
|
11
|
+
constructor(obj) {
|
12
|
+
if (typeof obj === 'string')
|
13
|
+
obj = { message: obj };
|
14
|
+
if (typeof obj !== 'object' || obj === null)
|
15
|
+
throw new TypeError('Object required');
|
16
|
+
obj.message ? super(obj.message) : super();
|
17
|
+
Object.assign(this, obj);
|
18
|
+
}
|
84
19
|
}
|
85
20
|
|
86
21
|
function setProxy(url) {
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
22
|
+
if (typeof url == "undefined")
|
23
|
+
return request = bluebird.promisify(require("request").defaults({
|
24
|
+
jar: true
|
25
|
+
}));
|
26
|
+
return request = bluebird.promisify(require("request").defaults({
|
27
|
+
jar: true,
|
28
|
+
proxy: url
|
29
|
+
}));
|
95
30
|
}
|
96
31
|
|
97
32
|
function getHeaders(url, options, ctx, customHeader) {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
33
|
+
const headers = {
|
34
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
35
|
+
Referer: "https://www.facebook.com/",
|
36
|
+
Host: url.replace("https://", "").split("/")[0],
|
37
|
+
Origin: "https://www.facebook.com",
|
38
|
+
"User-Agent": options.userAgent,
|
39
|
+
Connection: "keep-alive",
|
40
|
+
"sec-fetch-site": "same-origin"
|
41
|
+
};
|
42
|
+
if (customHeader) {
|
43
|
+
Object.assign(headers, customHeader);
|
44
|
+
}
|
45
|
+
if (ctx && ctx.region) {
|
46
|
+
headers["X-MSGR-Region"] = ctx.region;
|
47
|
+
}
|
48
|
+
|
49
|
+
return headers;
|
115
50
|
}
|
116
51
|
|
117
52
|
function isReadableStream(obj) {
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
53
|
+
return (
|
54
|
+
obj instanceof stream.Stream &&
|
55
|
+
(getType(obj._read) === "Function" ||
|
56
|
+
getType(obj._read) === "AsyncFunction") &&
|
57
|
+
getType(obj._readableState) === "Object"
|
58
|
+
);
|
124
59
|
}
|
125
60
|
|
126
61
|
function get(url, jar, qs, options, ctx) {
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
62
|
+
// I'm still confused about this
|
63
|
+
if (getType(qs) === "Object") {
|
64
|
+
for (const prop in qs) {
|
65
|
+
if (qs.hasOwnProperty(prop) && getType(qs[prop]) === "Object") {
|
66
|
+
qs[prop] = JSON.stringify(qs[prop]);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
const op = {
|
71
|
+
headers: getHeaders(url, options, ctx),
|
72
|
+
timeout: 60000,
|
73
|
+
qs: qs,
|
74
|
+
url: url,
|
75
|
+
method: "GET",
|
76
|
+
jar: jar,
|
77
|
+
gzip: true
|
78
|
+
};
|
79
|
+
|
80
|
+
return request(op).then(function (res) {
|
81
|
+
return Array.isArray(res) ? res[0] : res;
|
82
|
+
});
|
148
83
|
}
|
149
84
|
|
150
85
|
function post(url, jar, form, options, ctx, customHeader) {
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
86
|
+
const op = {
|
87
|
+
headers: getHeaders(url, options, ctx, customHeader),
|
88
|
+
timeout: 60000,
|
89
|
+
url: url,
|
90
|
+
method: "POST",
|
91
|
+
form: form,
|
92
|
+
jar: jar,
|
93
|
+
gzip: true
|
94
|
+
};
|
95
|
+
|
96
|
+
return request(op).then(function (res) {
|
97
|
+
return Array.isArray(res) ? res[0] : res;
|
98
|
+
});
|
164
99
|
}
|
165
100
|
|
166
101
|
function postFormData(url, jar, form, qs, options, ctx) {
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
102
|
+
const headers = getHeaders(url, options, ctx);
|
103
|
+
headers["Content-Type"] = "multipart/form-data";
|
104
|
+
const op = {
|
105
|
+
headers: headers,
|
106
|
+
timeout: 60000,
|
107
|
+
url: url,
|
108
|
+
method: "POST",
|
109
|
+
formData: form,
|
110
|
+
qs: qs,
|
111
|
+
jar: jar,
|
112
|
+
gzip: true
|
113
|
+
};
|
114
|
+
|
115
|
+
return request(op).then(function (res) {
|
116
|
+
return Array.isArray(res) ? res[0] : res;
|
117
|
+
});
|
183
118
|
}
|
184
119
|
|
185
120
|
function padZeros(val, len) {
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
121
|
+
val = String(val);
|
122
|
+
len = len || 2;
|
123
|
+
while (val.length < len) val = "0" + val;
|
124
|
+
return val;
|
190
125
|
}
|
191
126
|
|
192
127
|
function generateThreadingID(clientID) {
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
128
|
+
const k = Date.now();
|
129
|
+
const l = Math.floor(Math.random() * 4294967295);
|
130
|
+
const m = clientID;
|
131
|
+
return "<" + k + ":" + l + "-" + m + "@mail.projektitan.com>";
|
197
132
|
}
|
198
133
|
|
199
134
|
function binaryToDecimal(data) {
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
135
|
+
let ret = "";
|
136
|
+
while (data !== "0") {
|
137
|
+
let end = 0;
|
138
|
+
let fullName = "";
|
139
|
+
let i = 0;
|
140
|
+
for (; i < data.length; i++) {
|
141
|
+
end = 2 * end + parseInt(data[i], 10);
|
142
|
+
if (end >= 10) {
|
143
|
+
fullName += "1";
|
144
|
+
end -= 10;
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
fullName += "0";
|
148
|
+
}
|
149
|
+
}
|
150
|
+
ret = end.toString() + ret;
|
151
|
+
data = fullName.slice(fullName.indexOf("1"));
|
152
|
+
}
|
153
|
+
return ret;
|
219
154
|
}
|
220
155
|
|
221
156
|
function generateOfflineThreadingID() {
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
157
|
+
const ret = Date.now();
|
158
|
+
const value = Math.floor(Math.random() * 4294967295);
|
159
|
+
const str = ("0000000000000000000000" + value.toString(2)).slice(-22);
|
160
|
+
const msgs = ret.toString(2) + str;
|
161
|
+
return binaryToDecimal(msgs);
|
227
162
|
}
|
228
163
|
|
229
164
|
let h;
|
230
165
|
const i = {};
|
231
166
|
const j = {
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
167
|
+
_: "%",
|
168
|
+
A: "%2",
|
169
|
+
B: "000",
|
170
|
+
C: "%7d",
|
171
|
+
D: "%7b%22",
|
172
|
+
E: "%2c%22",
|
173
|
+
F: "%22%3a",
|
174
|
+
G: "%2c%22ut%22%3a1",
|
175
|
+
H: "%2c%22bls%22%3a",
|
176
|
+
I: "%2c%22n%22%3a%22%",
|
177
|
+
J: "%22%3a%7b%22i%22%3a0%7d",
|
178
|
+
K: "%2c%22pt%22%3a0%2c%22vis%22%3a",
|
179
|
+
L: "%2c%22ch%22%3a%7b%22h%22%3a%22",
|
180
|
+
M: "%7b%22v%22%3a2%2c%22time%22%3a1",
|
181
|
+
N: ".channel%22%2c%22sub%22%3a%5b",
|
182
|
+
O: "%2c%22sb%22%3a1%2c%22t%22%3a%5b",
|
183
|
+
P: "%2c%22ud%22%3a100%2c%22lc%22%3a0",
|
184
|
+
Q: "%5d%2c%22f%22%3anull%2c%22uct%22%3a",
|
185
|
+
R: ".channel%22%2c%22sub%22%3a%5b1%5d",
|
186
|
+
S: "%22%2c%22m%22%3a0%7d%2c%7b%22i%22%3a",
|
187
|
+
T: "%2c%22blc%22%3a1%2c%22snd%22%3a1%2c%22ct%22%3a",
|
188
|
+
U: "%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a",
|
189
|
+
V: "%2c%22blc%22%3a0%2c%22snd%22%3a0%2c%22ct%22%3a",
|
190
|
+
W: "%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a",
|
191
|
+
X: "%2c%22ri%22%3a0%7d%2c%22state%22%3a%7b%22p%22%3a0%2c%22ut%22%3a1",
|
192
|
+
Y:
|
193
|
+
"%2c%22pt%22%3a0%2c%22vis%22%3a1%2c%22bls%22%3a0%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a",
|
194
|
+
Z:
|
195
|
+
"%2c%22sb%22%3a1%2c%22t%22%3a%5b%5d%2c%22f%22%3anull%2c%22uct%22%3a0%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a"
|
261
196
|
};
|
262
197
|
(function () {
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
198
|
+
const l = [];
|
199
|
+
for (const m in j) {
|
200
|
+
i[j[m]] = m;
|
201
|
+
l.push(j[m]);
|
202
|
+
}
|
203
|
+
l.reverse();
|
204
|
+
h = new RegExp(l.join("|"), "g");
|
270
205
|
})();
|
271
206
|
|
272
207
|
function presenceEncode(str) {
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
208
|
+
return encodeURIComponent(str)
|
209
|
+
.replace(/([_A-Z])|%../g, function (m, n) {
|
210
|
+
return n ? "%" + n.charCodeAt(0).toString(16) : m;
|
211
|
+
})
|
212
|
+
.toLowerCase()
|
213
|
+
.replace(h, function (m) {
|
214
|
+
return i[m];
|
215
|
+
});
|
281
216
|
}
|
282
217
|
|
283
218
|
// eslint-disable-next-line no-unused-vars
|
284
219
|
function presenceDecode(str) {
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
220
|
+
return decodeURIComponent(
|
221
|
+
str.replace(/[_A-Z]/g, function (m) {
|
222
|
+
return j[m];
|
223
|
+
})
|
224
|
+
);
|
290
225
|
}
|
291
226
|
|
292
227
|
function generatePresence(userID) {
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
228
|
+
const time = Date.now();
|
229
|
+
return (
|
230
|
+
"E" +
|
231
|
+
presenceEncode(
|
232
|
+
JSON.stringify({
|
233
|
+
v: 3,
|
234
|
+
time: parseInt(time / 1000, 10),
|
235
|
+
user: userID,
|
236
|
+
state: {
|
237
|
+
ut: 0,
|
238
|
+
t2: [],
|
239
|
+
lm2: null,
|
240
|
+
uct2: time,
|
241
|
+
tr: null,
|
242
|
+
tw: Math.floor(Math.random() * 4294967295) + 1,
|
243
|
+
at: time
|
244
|
+
},
|
245
|
+
ch: {
|
246
|
+
["p_" + userID]: 0
|
247
|
+
}
|
248
|
+
})
|
249
|
+
)
|
250
|
+
);
|
316
251
|
}
|
317
252
|
|
318
253
|
function generateAccessiblityCookie() {
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
254
|
+
const time = Date.now();
|
255
|
+
return encodeURIComponent(
|
256
|
+
JSON.stringify({
|
257
|
+
sr: 0,
|
258
|
+
"sr-ts": time,
|
259
|
+
jk: 0,
|
260
|
+
"jk-ts": time,
|
261
|
+
kb: 0,
|
262
|
+
"kb-ts": time,
|
263
|
+
hcm: 0,
|
264
|
+
"hcm-ts": time
|
265
|
+
})
|
266
|
+
);
|
332
267
|
}
|
333
268
|
|
334
269
|
function getGUID() {
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
270
|
+
/** @type {number} */
|
271
|
+
let sectionLength = Date.now();
|
272
|
+
/** @type {string} */
|
273
|
+
const id = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
274
|
+
/** @type {number} */
|
275
|
+
const r = Math.floor((sectionLength + Math.random() * 16) % 16);
|
276
|
+
/** @type {number} */
|
277
|
+
sectionLength = Math.floor(sectionLength / 16);
|
278
|
+
/** @type {string} */
|
279
|
+
const _guid = (c == "x" ? r : (r & 7) | 8).toString(16);
|
280
|
+
return _guid;
|
281
|
+
});
|
282
|
+
return id;
|
348
283
|
}
|
349
284
|
|
350
285
|
function getExtension(original_extension, fullFileName = "") {
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
286
|
+
if (original_extension) {
|
287
|
+
return original_extension;
|
288
|
+
}
|
289
|
+
else {
|
290
|
+
const extension = fullFileName.split(".").pop();
|
291
|
+
if (extension === fullFileName) {
|
292
|
+
return "";
|
293
|
+
}
|
294
|
+
else {
|
295
|
+
return extension;
|
296
|
+
}
|
297
|
+
}
|
363
298
|
}
|
364
299
|
|
365
300
|
function _formatAttachment(attachment1, attachment2) {
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
301
|
+
// TODO: THIS IS REALLY BAD
|
302
|
+
// This is an attempt at fixing Facebook's inconsistencies. Sometimes they give us
|
303
|
+
// two attachment objects, but sometimes only one. They each contain part of the
|
304
|
+
// data that you'd want so we merge them for convenience.
|
305
|
+
// Instead of having a bunch of if statements guarding every access to image_data,
|
306
|
+
// we set it to empty object and use the fact that it'll return undefined.
|
307
|
+
const fullFileName = attachment1.filename;
|
308
|
+
const fileSize = Number(attachment1.fileSize || 0);
|
309
|
+
const durationVideo = attachment1.genericMetadata ? Number(attachment1.genericMetadata.videoLength) : undefined;
|
310
|
+
const durationAudio = attachment1.genericMetadata ? Number(attachment1.genericMetadata.duration) : undefined;
|
311
|
+
const mimeType = attachment1.mimeType;
|
312
|
+
|
313
|
+
attachment2 = attachment2 || { id: "", image_data: {} };
|
314
|
+
attachment1 = attachment1.mercury || attachment1;
|
315
|
+
let blob = attachment1.blob_attachment || attachment1.sticker_attachment;
|
316
|
+
let type =
|
317
|
+
blob && blob.__typename ? blob.__typename : attachment1.attach_type;
|
318
|
+
if (!type && attachment1.sticker_attachment) {
|
319
|
+
type = "StickerAttachment";
|
320
|
+
blob = attachment1.sticker_attachment;
|
321
|
+
}
|
322
|
+
else if (!type && attachment1.extensible_attachment) {
|
323
|
+
if (
|
324
|
+
attachment1.extensible_attachment.story_attachment &&
|
325
|
+
attachment1.extensible_attachment.story_attachment.target &&
|
326
|
+
attachment1.extensible_attachment.story_attachment.target.__typename &&
|
327
|
+
attachment1.extensible_attachment.story_attachment.target.__typename === "MessageLocation"
|
328
|
+
) {
|
329
|
+
type = "MessageLocation";
|
330
|
+
}
|
331
|
+
else {
|
332
|
+
type = "ExtensibleAttachment";
|
333
|
+
}
|
334
|
+
|
335
|
+
blob = attachment1.extensible_attachment;
|
336
|
+
}
|
337
|
+
// TODO: Determine whether "sticker", "photo", "file" etc are still used
|
338
|
+
// KEEP IN SYNC WITH getThreadHistory
|
339
|
+
switch (type) {
|
340
|
+
case "sticker":
|
341
|
+
return {
|
342
|
+
type: "sticker",
|
343
|
+
ID: attachment1.metadata.stickerID.toString(),
|
344
|
+
url: attachment1.url,
|
345
|
+
|
346
|
+
packID: attachment1.metadata.packID.toString(),
|
347
|
+
spriteUrl: attachment1.metadata.spriteURI,
|
348
|
+
spriteUrl2x: attachment1.metadata.spriteURI2x,
|
349
|
+
width: attachment1.metadata.width,
|
350
|
+
height: attachment1.metadata.height,
|
351
|
+
|
352
|
+
caption: attachment2.caption,
|
353
|
+
description: attachment2.description,
|
354
|
+
|
355
|
+
frameCount: attachment1.metadata.frameCount,
|
356
|
+
frameRate: attachment1.metadata.frameRate,
|
357
|
+
framesPerRow: attachment1.metadata.framesPerRow,
|
358
|
+
framesPerCol: attachment1.metadata.framesPerCol,
|
359
|
+
|
360
|
+
stickerID: attachment1.metadata.stickerID.toString(), // @Legacy
|
361
|
+
spriteURI: attachment1.metadata.spriteURI, // @Legacy
|
362
|
+
spriteURI2x: attachment1.metadata.spriteURI2x // @Legacy
|
363
|
+
};
|
364
|
+
case "file":
|
365
|
+
return {
|
366
|
+
type: "file",
|
367
|
+
ID: attachment2.id.toString(),
|
368
|
+
fullFileName: fullFileName,
|
369
|
+
filename: attachment1.name,
|
370
|
+
fileSize: fileSize,
|
371
|
+
original_extension: getExtension(attachment1.original_extension, fullFileName),
|
372
|
+
mimeType: mimeType,
|
373
|
+
url: attachment1.url,
|
374
|
+
|
375
|
+
isMalicious: attachment2.is_malicious,
|
376
|
+
contentType: attachment2.mime_type,
|
377
|
+
|
378
|
+
name: attachment1.name // @Legacy
|
379
|
+
};
|
380
|
+
case "photo":
|
381
|
+
return {
|
382
|
+
type: "photo",
|
383
|
+
ID: attachment1.metadata.fbid.toString(),
|
384
|
+
filename: attachment1.fileName,
|
385
|
+
fullFileName: fullFileName,
|
386
|
+
fileSize: fileSize,
|
387
|
+
original_extension: getExtension(attachment1.original_extension, fullFileName),
|
388
|
+
mimeType: mimeType,
|
389
|
+
thumbnailUrl: attachment1.thumbnail_url,
|
390
|
+
|
391
|
+
previewUrl: attachment1.preview_url,
|
392
|
+
previewWidth: attachment1.preview_width,
|
393
|
+
previewHeight: attachment1.preview_height,
|
394
|
+
|
395
|
+
largePreviewUrl: attachment1.large_preview_url,
|
396
|
+
largePreviewWidth: attachment1.large_preview_width,
|
397
|
+
largePreviewHeight: attachment1.large_preview_height,
|
398
|
+
|
399
|
+
url: attachment1.metadata.url, // @Legacy
|
400
|
+
width: attachment1.metadata.dimensions.split(",")[0], // @Legacy
|
401
|
+
height: attachment1.metadata.dimensions.split(",")[1], // @Legacy
|
402
|
+
name: fullFileName // @Legacy
|
403
|
+
};
|
404
|
+
case "animated_image":
|
405
|
+
return {
|
406
|
+
type: "animated_image",
|
407
|
+
ID: attachment2.id.toString(),
|
408
|
+
filename: attachment2.filename,
|
409
|
+
fullFileName: fullFileName,
|
410
|
+
original_extension: getExtension(attachment2.original_extension, fullFileName),
|
411
|
+
mimeType: mimeType,
|
412
|
+
|
413
|
+
previewUrl: attachment1.preview_url,
|
414
|
+
previewWidth: attachment1.preview_width,
|
415
|
+
previewHeight: attachment1.preview_height,
|
416
|
+
|
417
|
+
url: attachment2.image_data.url,
|
418
|
+
width: attachment2.image_data.width,
|
419
|
+
height: attachment2.image_data.height,
|
420
|
+
|
421
|
+
name: attachment1.name, // @Legacy
|
422
|
+
facebookUrl: attachment1.url, // @Legacy
|
423
|
+
thumbnailUrl: attachment1.thumbnail_url, // @Legacy
|
424
|
+
rawGifImage: attachment2.image_data.raw_gif_image, // @Legacy
|
425
|
+
rawWebpImage: attachment2.image_data.raw_webp_image, // @Legacy
|
426
|
+
animatedGifUrl: attachment2.image_data.animated_gif_url, // @Legacy
|
427
|
+
animatedGifPreviewUrl: attachment2.image_data.animated_gif_preview_url, // @Legacy
|
428
|
+
animatedWebpUrl: attachment2.image_data.animated_webp_url, // @Legacy
|
429
|
+
animatedWebpPreviewUrl: attachment2.image_data.animated_webp_preview_url // @Legacy
|
430
|
+
};
|
431
|
+
case "share":
|
432
|
+
return {
|
433
|
+
type: "share",
|
434
|
+
ID: attachment1.share.share_id.toString(),
|
435
|
+
url: attachment2.href,
|
436
|
+
|
437
|
+
title: attachment1.share.title,
|
438
|
+
description: attachment1.share.description,
|
439
|
+
source: attachment1.share.source,
|
440
|
+
|
441
|
+
image: attachment1.share.media.image,
|
442
|
+
width: attachment1.share.media.image_size.width,
|
443
|
+
height: attachment1.share.media.image_size.height,
|
444
|
+
playable: attachment1.share.media.playable,
|
445
|
+
duration: attachment1.share.media.duration,
|
446
|
+
|
447
|
+
subattachments: attachment1.share.subattachments,
|
448
|
+
properties: {},
|
449
|
+
|
450
|
+
animatedImageSize: attachment1.share.media.animated_image_size, // @Legacy
|
451
|
+
facebookUrl: attachment1.share.uri, // @Legacy
|
452
|
+
target: attachment1.share.target, // @Legacy
|
453
|
+
styleList: attachment1.share.style_list // @Legacy
|
454
|
+
};
|
455
|
+
case "video":
|
456
|
+
return {
|
457
|
+
type: "video",
|
458
|
+
ID: attachment1.metadata.fbid.toString(),
|
459
|
+
filename: attachment1.name,
|
460
|
+
fullFileName: fullFileName,
|
461
|
+
original_extension: getExtension(attachment1.original_extension, fullFileName),
|
462
|
+
mimeType: mimeType,
|
463
|
+
duration: durationVideo,
|
464
|
+
|
465
|
+
previewUrl: attachment1.preview_url,
|
466
|
+
previewWidth: attachment1.preview_width,
|
467
|
+
previewHeight: attachment1.preview_height,
|
468
|
+
|
469
|
+
url: attachment1.url,
|
470
|
+
width: attachment1.metadata.dimensions.width,
|
471
|
+
height: attachment1.metadata.dimensions.height,
|
472
|
+
|
473
|
+
videoType: "unknown",
|
474
|
+
|
475
|
+
thumbnailUrl: attachment1.thumbnail_url // @Legacy
|
476
|
+
};
|
477
|
+
case "error":
|
478
|
+
return {
|
479
|
+
type: "error",
|
480
|
+
|
481
|
+
// Save error attachments because we're unsure of their format,
|
482
|
+
// and whether there are cases they contain something useful for debugging.
|
483
|
+
attachment1: attachment1,
|
484
|
+
attachment2: attachment2
|
485
|
+
};
|
486
|
+
case "MessageImage":
|
487
|
+
return {
|
488
|
+
type: "photo",
|
489
|
+
ID: blob.legacy_attachment_id,
|
490
|
+
filename: blob.filename,
|
491
|
+
fullFileName: fullFileName,
|
492
|
+
fileSize: fileSize,
|
493
|
+
original_extension: getExtension(blob.original_extension, fullFileName),
|
494
|
+
mimeType: mimeType,
|
495
|
+
thumbnailUrl: blob.thumbnail.uri,
|
496
|
+
|
497
|
+
previewUrl: blob.preview.uri,
|
498
|
+
previewWidth: blob.preview.width,
|
499
|
+
previewHeight: blob.preview.height,
|
500
|
+
|
501
|
+
largePreviewUrl: blob.large_preview.uri,
|
502
|
+
largePreviewWidth: blob.large_preview.width,
|
503
|
+
largePreviewHeight: blob.large_preview.height,
|
504
|
+
|
505
|
+
url: blob.large_preview.uri, // @Legacy
|
506
|
+
width: blob.original_dimensions.x, // @Legacy
|
507
|
+
height: blob.original_dimensions.y, // @Legacy
|
508
|
+
name: blob.filename // @Legacy
|
509
|
+
};
|
510
|
+
case "MessageAnimatedImage":
|
511
|
+
return {
|
512
|
+
type: "animated_image",
|
513
|
+
ID: blob.legacy_attachment_id,
|
514
|
+
filename: blob.filename,
|
515
|
+
fullFileName: fullFileName,
|
516
|
+
original_extension: getExtension(blob.original_extension, fullFileName),
|
517
|
+
mimeType: mimeType,
|
518
|
+
|
519
|
+
previewUrl: blob.preview_image.uri,
|
520
|
+
previewWidth: blob.preview_image.width,
|
521
|
+
previewHeight: blob.preview_image.height,
|
522
|
+
|
523
|
+
url: blob.animated_image.uri,
|
524
|
+
width: blob.animated_image.width,
|
525
|
+
height: blob.animated_image.height,
|
526
|
+
|
527
|
+
thumbnailUrl: blob.preview_image.uri, // @Legacy
|
528
|
+
name: blob.filename, // @Legacy
|
529
|
+
facebookUrl: blob.animated_image.uri, // @Legacy
|
530
|
+
rawGifImage: blob.animated_image.uri, // @Legacy
|
531
|
+
animatedGifUrl: blob.animated_image.uri, // @Legacy
|
532
|
+
animatedGifPreviewUrl: blob.preview_image.uri, // @Legacy
|
533
|
+
animatedWebpUrl: blob.animated_image.uri, // @Legacy
|
534
|
+
animatedWebpPreviewUrl: blob.preview_image.uri // @Legacy
|
535
|
+
};
|
536
|
+
case "MessageVideo":
|
537
|
+
return {
|
538
|
+
type: "video",
|
539
|
+
ID: blob.legacy_attachment_id,
|
540
|
+
filename: blob.filename,
|
541
|
+
fullFileName: fullFileName,
|
542
|
+
original_extension: getExtension(blob.original_extension, fullFileName),
|
543
|
+
fileSize: fileSize,
|
544
|
+
duration: durationVideo,
|
545
|
+
mimeType: mimeType,
|
546
|
+
|
547
|
+
previewUrl: blob.large_image.uri,
|
548
|
+
previewWidth: blob.large_image.width,
|
549
|
+
previewHeight: blob.large_image.height,
|
550
|
+
|
551
|
+
url: blob.playable_url,
|
552
|
+
width: blob.original_dimensions.x,
|
553
|
+
height: blob.original_dimensions.y,
|
554
|
+
|
555
|
+
videoType: blob.video_type.toLowerCase(),
|
556
|
+
|
557
|
+
thumbnailUrl: blob.large_image.uri // @Legacy
|
558
|
+
};
|
559
|
+
case "MessageAudio":
|
560
|
+
return {
|
561
|
+
type: "audio",
|
562
|
+
ID: blob.url_shimhash,
|
563
|
+
filename: blob.filename,
|
564
|
+
fullFileName: fullFileName,
|
565
|
+
fileSize: fileSize,
|
566
|
+
duration: durationAudio,
|
567
|
+
original_extension: getExtension(blob.original_extension, fullFileName),
|
568
|
+
mimeType: mimeType,
|
569
|
+
|
570
|
+
audioType: blob.audio_type,
|
571
|
+
url: blob.playable_url,
|
572
|
+
|
573
|
+
isVoiceMail: blob.is_voicemail
|
574
|
+
};
|
575
|
+
case "StickerAttachment":
|
576
|
+
case "Sticker":
|
577
|
+
return {
|
578
|
+
type: "sticker",
|
579
|
+
ID: blob.id,
|
580
|
+
url: blob.url,
|
581
|
+
|
582
|
+
packID: blob.pack ? blob.pack.id : null,
|
583
|
+
spriteUrl: blob.sprite_image,
|
584
|
+
spriteUrl2x: blob.sprite_image_2x,
|
585
|
+
width: blob.width,
|
586
|
+
height: blob.height,
|
587
|
+
|
588
|
+
caption: blob.label,
|
589
|
+
description: blob.label,
|
590
|
+
|
591
|
+
frameCount: blob.frame_count,
|
592
|
+
frameRate: blob.frame_rate,
|
593
|
+
framesPerRow: blob.frames_per_row,
|
594
|
+
framesPerCol: blob.frames_per_column,
|
595
|
+
|
596
|
+
stickerID: blob.id, // @Legacy
|
597
|
+
spriteURI: blob.sprite_image, // @Legacy
|
598
|
+
spriteURI2x: blob.sprite_image_2x // @Legacy
|
599
|
+
};
|
600
|
+
case "MessageLocation":
|
601
|
+
var urlAttach = blob.story_attachment.url;
|
602
|
+
var mediaAttach = blob.story_attachment.media;
|
603
|
+
|
604
|
+
var u = querystring.parse(url.parse(urlAttach).query).u;
|
605
|
+
var where1 = querystring.parse(url.parse(u).query).where1;
|
606
|
+
var address = where1.split(", ");
|
607
|
+
|
608
|
+
var latitude;
|
609
|
+
var longitude;
|
610
|
+
|
611
|
+
try {
|
612
|
+
latitude = Number.parseFloat(address[0]);
|
613
|
+
longitude = Number.parseFloat(address[1]);
|
614
|
+
} catch (err) {
|
615
|
+
/* empty */
|
616
|
+
}
|
617
|
+
|
618
|
+
var imageUrl;
|
619
|
+
var width;
|
620
|
+
var height;
|
621
|
+
|
622
|
+
if (mediaAttach && mediaAttach.image) {
|
623
|
+
imageUrl = mediaAttach.image.uri;
|
624
|
+
width = mediaAttach.image.width;
|
625
|
+
height = mediaAttach.image.height;
|
626
|
+
}
|
627
|
+
|
628
|
+
return {
|
629
|
+
type: "location",
|
630
|
+
ID: blob.legacy_attachment_id,
|
631
|
+
latitude: latitude,
|
632
|
+
longitude: longitude,
|
633
|
+
image: imageUrl,
|
634
|
+
width: width,
|
635
|
+
height: height,
|
636
|
+
url: u || urlAttach,
|
637
|
+
address: where1,
|
638
|
+
|
639
|
+
facebookUrl: blob.story_attachment.url, // @Legacy
|
640
|
+
target: blob.story_attachment.target, // @Legacy
|
641
|
+
styleList: blob.story_attachment.style_list // @Legacy
|
642
|
+
};
|
643
|
+
case "ExtensibleAttachment":
|
644
|
+
return {
|
645
|
+
type: "share",
|
646
|
+
ID: blob.legacy_attachment_id,
|
647
|
+
url: blob.story_attachment.url,
|
648
|
+
|
649
|
+
title: blob.story_attachment.title_with_entities.text,
|
650
|
+
description:
|
651
|
+
blob.story_attachment.description &&
|
652
|
+
blob.story_attachment.description.text,
|
653
|
+
source: blob.story_attachment.source
|
654
|
+
? blob.story_attachment.source.text
|
655
|
+
: null,
|
656
|
+
|
657
|
+
image:
|
658
|
+
blob.story_attachment.media &&
|
659
|
+
blob.story_attachment.media.image &&
|
660
|
+
blob.story_attachment.media.image.uri,
|
661
|
+
width:
|
662
|
+
blob.story_attachment.media &&
|
663
|
+
blob.story_attachment.media.image &&
|
664
|
+
blob.story_attachment.media.image.width,
|
665
|
+
height:
|
666
|
+
blob.story_attachment.media &&
|
667
|
+
blob.story_attachment.media.image &&
|
668
|
+
blob.story_attachment.media.image.height,
|
669
|
+
playable:
|
670
|
+
blob.story_attachment.media &&
|
671
|
+
blob.story_attachment.media.is_playable,
|
672
|
+
duration:
|
673
|
+
blob.story_attachment.media &&
|
674
|
+
blob.story_attachment.media.playable_duration_in_ms,
|
675
|
+
playableUrl:
|
676
|
+
blob.story_attachment.media == null
|
677
|
+
? null
|
678
|
+
: blob.story_attachment.media.playable_url,
|
679
|
+
|
680
|
+
subattachments: blob.story_attachment.subattachments,
|
681
|
+
properties: blob.story_attachment.properties.reduce(function (obj, cur) {
|
682
|
+
obj[cur.key] = cur.value.text;
|
683
|
+
return obj;
|
684
|
+
}, {}),
|
685
|
+
|
686
|
+
facebookUrl: blob.story_attachment.url, // @Legacy
|
687
|
+
target: blob.story_attachment.target, // @Legacy
|
688
|
+
styleList: blob.story_attachment.style_list // @Legacy
|
689
|
+
};
|
690
|
+
case "MessageFile":
|
691
|
+
return {
|
692
|
+
type: "file",
|
693
|
+
ID: blob.message_file_fbid,
|
694
|
+
fullFileName: fullFileName,
|
695
|
+
filename: blob.filename,
|
696
|
+
fileSize: fileSize,
|
697
|
+
mimeType: blob.mimetype,
|
698
|
+
original_extension: blob.original_extension || fullFileName.split(".").pop(),
|
699
|
+
|
700
|
+
url: blob.url,
|
701
|
+
isMalicious: blob.is_malicious,
|
702
|
+
contentType: blob.content_type,
|
703
|
+
|
704
|
+
name: blob.filename
|
705
|
+
};
|
706
|
+
default:
|
707
|
+
throw new Error(
|
708
|
+
"unrecognized attach_file of type " +
|
709
|
+
type +
|
710
|
+
"`" +
|
711
|
+
JSON.stringify(attachment1, null, 4) +
|
712
|
+
" attachment2: " +
|
713
|
+
JSON.stringify(attachment2, null, 4) +
|
714
|
+
"`"
|
715
|
+
);
|
716
|
+
}
|
782
717
|
}
|
783
718
|
|
784
719
|
function formatAttachment(attachments, attachmentIds, attachmentMap, shareMap) {
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
720
|
+
attachmentMap = shareMap || attachmentMap;
|
721
|
+
return attachments
|
722
|
+
? attachments.map(function (val, i) {
|
723
|
+
if (
|
724
|
+
!attachmentMap ||
|
725
|
+
!attachmentIds ||
|
726
|
+
!attachmentMap[attachmentIds[i]]
|
727
|
+
) {
|
728
|
+
return _formatAttachment(val);
|
729
|
+
}
|
730
|
+
return _formatAttachment(val, attachmentMap[attachmentIds[i]]);
|
731
|
+
})
|
732
|
+
: [];
|
798
733
|
}
|
799
734
|
|
800
735
|
function formatDeltaMessage(m) {
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
736
|
+
const md = m.delta.messageMetadata;
|
737
|
+
|
738
|
+
const mdata =
|
739
|
+
m.delta.data === undefined
|
740
|
+
? []
|
741
|
+
: m.delta.data.prng === undefined
|
742
|
+
? []
|
743
|
+
: JSON.parse(m.delta.data.prng);
|
744
|
+
const m_id = mdata.map(u => u.i);
|
745
|
+
const m_offset = mdata.map(u => u.o);
|
746
|
+
const m_length = mdata.map(u => u.l);
|
747
|
+
const mentions = {};
|
748
|
+
for (let i = 0; i < m_id.length; i++) {
|
749
|
+
mentions[m_id[i]] = m.delta.body.substring(
|
750
|
+
m_offset[i],
|
751
|
+
m_offset[i] + m_length[i]
|
752
|
+
);
|
753
|
+
}
|
754
|
+
return {
|
755
|
+
type: "message",
|
756
|
+
senderID: formatID(md.actorFbId.toString()),
|
757
|
+
body: m.delta.body || "",
|
758
|
+
threadID: formatID(
|
759
|
+
(md.threadKey.threadFbId || md.threadKey.otherUserFbId).toString()
|
760
|
+
),
|
761
|
+
messageID: md.messageId,
|
762
|
+
attachments: (m.delta.attachments || []).map(v => _formatAttachment(v)),
|
763
|
+
mentions: mentions,
|
764
|
+
timestamp: md.timestamp,
|
765
|
+
isGroup: !!md.threadKey.threadFbId,
|
766
|
+
participantIDs: m.delta.participants || (md.cid ? md.cid.canonicalParticipantFbids : []) || []
|
767
|
+
};
|
833
768
|
}
|
834
769
|
|
835
770
|
function formatID(id) {
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
771
|
+
if (id != undefined && id != null) {
|
772
|
+
return id.replace(/(fb)?id[:.]/, "");
|
773
|
+
}
|
774
|
+
else {
|
775
|
+
return id;
|
776
|
+
}
|
842
777
|
}
|
843
778
|
|
844
779
|
function formatMessage(m) {
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
780
|
+
const originalMessage = m.message ? m.message : m;
|
781
|
+
const obj = {
|
782
|
+
type: "message",
|
783
|
+
senderName: originalMessage.sender_name,
|
784
|
+
senderID: formatID(originalMessage.sender_fbid.toString()),
|
785
|
+
participantNames: originalMessage.group_thread_info
|
786
|
+
? originalMessage.group_thread_info.participant_names
|
787
|
+
: [originalMessage.sender_name.split(" ")[0]],
|
788
|
+
participantIDs: originalMessage.group_thread_info
|
789
|
+
? originalMessage.group_thread_info.participant_ids.map(function (v) {
|
790
|
+
return formatID(v.toString());
|
791
|
+
})
|
792
|
+
: [formatID(originalMessage.sender_fbid)],
|
793
|
+
body: originalMessage.body || "",
|
794
|
+
threadID: formatID(
|
795
|
+
(
|
796
|
+
originalMessage.thread_fbid || originalMessage.other_user_fbid
|
797
|
+
).toString()
|
798
|
+
),
|
799
|
+
threadName: originalMessage.group_thread_info
|
800
|
+
? originalMessage.group_thread_info.name
|
801
|
+
: originalMessage.sender_name,
|
802
|
+
location: originalMessage.coordinates ? originalMessage.coordinates : null,
|
803
|
+
messageID: originalMessage.mid
|
804
|
+
? originalMessage.mid.toString()
|
805
|
+
: originalMessage.message_id,
|
806
|
+
attachments: formatAttachment(
|
807
|
+
originalMessage.attachments,
|
808
|
+
originalMessage.attachmentIds,
|
809
|
+
originalMessage.attachment_map,
|
810
|
+
originalMessage.share_map
|
811
|
+
),
|
812
|
+
timestamp: originalMessage.timestamp,
|
813
|
+
timestampAbsolute: originalMessage.timestamp_absolute,
|
814
|
+
timestampRelative: originalMessage.timestamp_relative,
|
815
|
+
timestampDatetime: originalMessage.timestamp_datetime,
|
816
|
+
tags: originalMessage.tags,
|
817
|
+
reactions: originalMessage.reactions ? originalMessage.reactions : [],
|
818
|
+
isUnread: originalMessage.is_unread
|
819
|
+
};
|
820
|
+
|
821
|
+
if (m.type === "pages_messaging")
|
822
|
+
obj.pageID = m.realtime_viewer_fbid.toString();
|
823
|
+
obj.isGroup = obj.participantIDs.length > 2;
|
824
|
+
|
825
|
+
return obj;
|
891
826
|
}
|
892
827
|
|
893
828
|
function formatEvent(m) {
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
829
|
+
const originalMessage = m.message ? m.message : m;
|
830
|
+
let logMessageType = originalMessage.log_message_type;
|
831
|
+
let logMessageData;
|
832
|
+
if (logMessageType === "log:generic-admin-text") {
|
833
|
+
logMessageData = originalMessage.log_message_data.untypedData;
|
834
|
+
logMessageType = getAdminTextMessageType(
|
835
|
+
originalMessage.log_message_data.message_type
|
836
|
+
);
|
837
|
+
}
|
838
|
+
else {
|
839
|
+
logMessageData = originalMessage.log_message_data;
|
840
|
+
}
|
841
|
+
|
842
|
+
return Object.assign(formatMessage(originalMessage), {
|
843
|
+
type: "event",
|
844
|
+
logMessageType: logMessageType,
|
845
|
+
logMessageData: logMessageData,
|
846
|
+
logMessageBody: originalMessage.log_message_body
|
847
|
+
});
|
913
848
|
}
|
914
849
|
|
915
850
|
function formatHistoryMessage(m) {
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
851
|
+
switch (m.action_type) {
|
852
|
+
case "ma-type:log-message":
|
853
|
+
return formatEvent(m);
|
854
|
+
default:
|
855
|
+
return formatMessage(m);
|
856
|
+
}
|
922
857
|
}
|
923
858
|
|
924
859
|
// Get a more readable message type for AdminTextMessages
|
925
860
|
function getAdminTextMessageType(type) {
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
}
|
861
|
+
switch (type) {
|
862
|
+
case "change_thread_theme":
|
863
|
+
return "log:thread-color";
|
864
|
+
case "change_thread_icon":
|
865
|
+
return "log:thread-icon";
|
866
|
+
case "change_thread_nickname":
|
867
|
+
return "log:user-nickname";
|
868
|
+
case "change_thread_admins":
|
869
|
+
return "log:thread-admins";
|
870
|
+
case "group_poll":
|
871
|
+
return "log:thread-poll";
|
872
|
+
case "change_thread_approval_mode":
|
873
|
+
return "log:thread-approval-mode";
|
874
|
+
case "messenger_call_log":
|
875
|
+
case "participant_joined_group_call":
|
876
|
+
return "log:thread-call";
|
877
|
+
default:
|
878
|
+
return type;
|
879
|
+
}
|
946
880
|
}
|
947
881
|
|
948
882
|
function formatDeltaEvent(m) {
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
883
|
+
let logMessageType;
|
884
|
+
let logMessageData;
|
885
|
+
|
886
|
+
// log:thread-color => {theme_color}
|
887
|
+
// log:user-nickname => {participant_id, nickname}
|
888
|
+
// log:thread-icon => {thread_icon}
|
889
|
+
// log:thread-name => {name}
|
890
|
+
// log:subscribe => {addedParticipants - [Array]}
|
891
|
+
// log:unsubscribe => {leftParticipantFbId}
|
892
|
+
|
893
|
+
switch (m.class) {
|
894
|
+
case "AdminTextMessage":
|
895
|
+
logMessageData = m.untypedData;
|
896
|
+
logMessageType = getAdminTextMessageType(m.type);
|
897
|
+
break;
|
898
|
+
case "ThreadName":
|
899
|
+
logMessageType = "log:thread-name";
|
900
|
+
logMessageData = { name: m.name };
|
901
|
+
break;
|
902
|
+
case "ParticipantsAddedToGroupThread":
|
903
|
+
logMessageType = "log:subscribe";
|
904
|
+
logMessageData = { addedParticipants: m.addedParticipants };
|
905
|
+
break;
|
906
|
+
case "ParticipantLeftGroupThread":
|
907
|
+
logMessageType = "log:unsubscribe";
|
908
|
+
logMessageData = { leftParticipantFbId: m.leftParticipantFbId };
|
909
|
+
break;
|
910
|
+
case "ApprovalQueue":
|
911
|
+
logMessageType = "log:approval-queue";
|
912
|
+
logMessageData = {
|
913
|
+
approvalQueue: {
|
914
|
+
action: m.action,
|
915
|
+
recipientFbId: m.recipientFbId,
|
916
|
+
requestSource: m.requestSource,
|
917
|
+
...m.messageMetadata
|
918
|
+
}
|
919
|
+
};
|
920
|
+
}
|
921
|
+
|
922
|
+
return {
|
923
|
+
type: "event",
|
924
|
+
threadID: formatID(
|
925
|
+
(
|
926
|
+
m.messageMetadata.threadKey.threadFbId ||
|
927
|
+
m.messageMetadata.threadKey.otherUserFbId
|
928
|
+
).toString()
|
929
|
+
),
|
930
|
+
messageID: m.messageMetadata.messageId.toString(),
|
931
|
+
logMessageType: logMessageType,
|
932
|
+
logMessageData: logMessageData,
|
933
|
+
logMessageBody: m.messageMetadata.adminText,
|
934
|
+
timestamp: m.messageMetadata.timestamp,
|
935
|
+
author: m.messageMetadata.actorFbId,
|
936
|
+
participantIDs: (m.participants || []).map(p => p.toString())
|
937
|
+
};
|
1004
938
|
}
|
1005
939
|
|
1006
940
|
function formatTyp(event) {
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
941
|
+
return {
|
942
|
+
isTyping: !!event.st,
|
943
|
+
from: event.from.toString(),
|
944
|
+
threadID: formatID(
|
945
|
+
(event.to || event.thread_fbid || event.from).toString()
|
946
|
+
),
|
947
|
+
// When receiving typ indication from mobile, `from_mobile` isn't set.
|
948
|
+
// If it is, we just use that value.
|
949
|
+
fromMobile: event.hasOwnProperty("from_mobile") ? event.from_mobile : true,
|
950
|
+
userID: (event.realtime_viewer_fbid || event.from).toString(),
|
951
|
+
type: "typ"
|
952
|
+
};
|
1019
953
|
}
|
1020
954
|
|
1021
955
|
function formatDeltaReadReceipt(delta) {
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
956
|
+
// otherUserFbId seems to be used as both the readerID and the threadID in a 1-1 chat.
|
957
|
+
// In a group chat actorFbId is used for the reader and threadFbId for the thread.
|
958
|
+
return {
|
959
|
+
reader: (delta.threadKey.otherUserFbId || delta.actorFbId).toString(),
|
960
|
+
time: delta.actionTimestampMs,
|
961
|
+
threadID: formatID(
|
962
|
+
(delta.threadKey.otherUserFbId || delta.threadKey.threadFbId).toString()
|
963
|
+
),
|
964
|
+
type: "read_receipt"
|
965
|
+
};
|
1032
966
|
}
|
1033
967
|
|
1034
968
|
function formatReadReceipt(event) {
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
969
|
+
return {
|
970
|
+
reader: event.reader.toString(),
|
971
|
+
time: event.time,
|
972
|
+
threadID: formatID((event.thread_fbid || event.reader).toString()),
|
973
|
+
type: "read_receipt"
|
974
|
+
};
|
1041
975
|
}
|
1042
976
|
|
1043
977
|
function formatRead(event) {
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
978
|
+
return {
|
979
|
+
threadID: formatID(
|
980
|
+
(
|
981
|
+
(event.chat_ids && event.chat_ids[0]) ||
|
982
|
+
(event.thread_fbids && event.thread_fbids[0])
|
983
|
+
).toString()
|
984
|
+
),
|
985
|
+
time: event.timestamp,
|
986
|
+
type: "read"
|
987
|
+
};
|
1054
988
|
}
|
1055
989
|
|
1056
990
|
function getFrom(str, startToken, endToken) {
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
991
|
+
const start = str.indexOf(startToken) + startToken.length;
|
992
|
+
if (start < startToken.length) return "";
|
993
|
+
|
994
|
+
const lastHalf = str.substring(start);
|
995
|
+
const end = lastHalf.indexOf(endToken);
|
996
|
+
if (end === -1) {
|
997
|
+
throw new Error(
|
998
|
+
"Could not find endTime `" + endToken + "` in the given string."
|
999
|
+
);
|
1000
|
+
}
|
1001
|
+
return lastHalf.substring(0, end);
|
1068
1002
|
}
|
1069
1003
|
|
1070
1004
|
function makeParsable(html) {
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1005
|
+
const withoutForLoop = html.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/, "");
|
1006
|
+
|
1007
|
+
// (What the fuck FB, why windows style newlines?)
|
1008
|
+
// So sometimes FB will send us base multiple objects in the same response.
|
1009
|
+
// They're all valid JSON, one after the other, at the top level. We detect
|
1010
|
+
// that and make it parse-able by JSON.parse.
|
1011
|
+
// Ben - July 15th 2017
|
1012
|
+
//
|
1013
|
+
// It turns out that Facebook may insert random number of spaces before
|
1014
|
+
// next object begins (issue #616)
|
1015
|
+
// rav_kr - 2018-03-19
|
1016
|
+
const maybeMultipleObjects = withoutForLoop.split(/\}\r\n *\{/);
|
1017
|
+
if (maybeMultipleObjects.length === 1) return maybeMultipleObjects;
|
1018
|
+
|
1019
|
+
return "[" + maybeMultipleObjects.join("},{") + "]";
|
1086
1020
|
}
|
1087
1021
|
|
1088
1022
|
function arrToForm(form) {
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1023
|
+
return arrayToObject(
|
1024
|
+
form,
|
1025
|
+
function (v) {
|
1026
|
+
return v.name;
|
1027
|
+
},
|
1028
|
+
function (v) {
|
1029
|
+
return v.val;
|
1030
|
+
}
|
1031
|
+
);
|
1098
1032
|
}
|
1099
1033
|
|
1100
1034
|
function arrayToObject(arr, getKey, getValue) {
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1035
|
+
return arr.reduce(function (acc, val) {
|
1036
|
+
acc[getKey(val)] = getValue(val);
|
1037
|
+
return acc;
|
1038
|
+
}, {});
|
1105
1039
|
}
|
1106
1040
|
|
1107
1041
|
function getSignatureID() {
|
1108
|
-
|
1042
|
+
return Math.floor(Math.random() * 2147483648).toString(16);
|
1109
1043
|
}
|
1110
1044
|
|
1111
1045
|
function generateTimestampRelative() {
|
1112
|
-
|
1113
|
-
|
1046
|
+
const d = new Date();
|
1047
|
+
return d.getHours() + ":" + padZeros(d.getMinutes());
|
1114
1048
|
}
|
1115
1049
|
|
1116
1050
|
function makeDefaults(html, userID, ctx) {
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1051
|
+
let reqCounter = 1;
|
1052
|
+
const fb_dtsg = getFrom(html, 'name="fb_dtsg" value="', '"');
|
1053
|
+
|
1054
|
+
// @Hack Ok we've done hacky things, this is definitely on top 5.
|
1055
|
+
// We totally assume the object is flat and try parsing until a }.
|
1056
|
+
// If it works though it's cool because we get a bunch of extra data things.
|
1057
|
+
//
|
1058
|
+
// Update: we don't need this. Leaving it in in case we ever do.
|
1059
|
+
// Ben - July 15th 2017
|
1060
|
+
|
1061
|
+
// var siteData = getFrom(html, "[\"SiteData\",[],", "},");
|
1062
|
+
// try {
|
1063
|
+
// siteData = JSON.parse(siteData + "}");
|
1064
|
+
// } catch(e) {
|
1065
|
+
// log.warn("makeDefaults", "Couldn't parse SiteData. Won't have access to some variables.");
|
1066
|
+
// siteData = {};
|
1067
|
+
// }
|
1068
|
+
|
1069
|
+
let ttstamp = "2";
|
1070
|
+
for (let i = 0; i < fb_dtsg.length; i++) {
|
1071
|
+
ttstamp += fb_dtsg.charCodeAt(i);
|
1072
|
+
}
|
1073
|
+
const revision = getFrom(html, 'revision":', ",");
|
1074
|
+
|
1075
|
+
function mergeWithDefaults(obj) {
|
1076
|
+
// @TODO This is missing a key called __dyn.
|
1077
|
+
// After some investigation it seems like __dyn is some sort of set that FB
|
1078
|
+
// calls BitMap. It seems like certain responses have a "define" key in the
|
1079
|
+
// res.jsmods arrays. I think the code iterates over those and calls `set`
|
1080
|
+
// on the bitmap for each of those keys. Then it calls
|
1081
|
+
// bitmap.toCompressedString() which returns what __dyn is.
|
1082
|
+
//
|
1083
|
+
// So far the API has been working without this.
|
1084
|
+
//
|
1085
|
+
// Ben - July 15th 2017
|
1086
|
+
const newObj = {
|
1087
|
+
__user: userID,
|
1088
|
+
__req: (reqCounter++).toString(36),
|
1089
|
+
__rev: revision,
|
1090
|
+
__a: 1,
|
1091
|
+
// __af: siteData.features,
|
1092
|
+
fb_dtsg: ctx.fb_dtsg ? ctx.fb_dtsg : fb_dtsg,
|
1093
|
+
jazoest: ctx.ttstamp ? ctx.ttstamp : ttstamp
|
1094
|
+
// __spin_r: siteData.__spin_r,
|
1095
|
+
// __spin_b: siteData.__spin_b,
|
1096
|
+
// __spin_t: siteData.__spin_t,
|
1097
|
+
};
|
1098
|
+
|
1099
|
+
// @TODO this is probably not needed.
|
1100
|
+
// Ben - July 15th 2017
|
1101
|
+
// if (siteData.be_key) {
|
1102
|
+
// newObj[siteData.be_key] = siteData.be_mode;
|
1103
|
+
// }
|
1104
|
+
// if (siteData.pkg_cohort_key) {
|
1105
|
+
// newObj[siteData.pkg_cohort_key] = siteData.pkg_cohort;
|
1106
|
+
// }
|
1107
|
+
|
1108
|
+
if (!obj) return newObj;
|
1109
|
+
|
1110
|
+
for (const prop in obj) {
|
1111
|
+
if (obj.hasOwnProperty(prop)) {
|
1112
|
+
if (!newObj[prop]) {
|
1113
|
+
newObj[prop] = obj[prop];
|
1114
|
+
}
|
1115
|
+
}
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
return newObj;
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
function postWithDefaults(url, jar, form, ctxx, customHeader = {}) {
|
1122
|
+
return post(url, jar, mergeWithDefaults(form), ctx.globalOptions, ctxx || ctx, customHeader);
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
function getWithDefaults(url, jar, qs, ctxx, customHeader = {}) {
|
1126
|
+
return get(url, jar, mergeWithDefaults(qs), ctx.globalOptions, ctxx || ctx, customHeader);
|
1127
|
+
}
|
1128
|
+
|
1129
|
+
function postFormDataWithDefault(url, jar, form, qs, ctxx) {
|
1130
|
+
return postFormData(
|
1131
|
+
url,
|
1132
|
+
jar,
|
1133
|
+
mergeWithDefaults(form),
|
1134
|
+
mergeWithDefaults(qs),
|
1135
|
+
ctx.globalOptions,
|
1136
|
+
ctxx || ctx
|
1137
|
+
);
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
return {
|
1141
|
+
get: getWithDefaults,
|
1142
|
+
post: postWithDefaults,
|
1143
|
+
postFormData: postFormDataWithDefault
|
1144
|
+
};
|
1211
1145
|
}
|
1212
1146
|
|
1213
1147
|
function parseAndCheckLogin(ctx, defaultFuncs, retryCount, sourceCall) {
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1148
|
+
if (retryCount == undefined) {
|
1149
|
+
retryCount = 0;
|
1150
|
+
}
|
1151
|
+
if (sourceCall == undefined) {
|
1152
|
+
try {
|
1153
|
+
throw new Error();
|
1154
|
+
}
|
1155
|
+
catch (e) {
|
1156
|
+
sourceCall = e;
|
1157
|
+
}
|
1158
|
+
}
|
1159
|
+
return function (data) {
|
1160
|
+
return bluebird.try(function () {
|
1161
|
+
log.verbose("parseAndCheckLogin", data.body);
|
1162
|
+
if (data.statusCode >= 500 && data.statusCode < 600) {
|
1163
|
+
if (retryCount >= 5) {
|
1164
|
+
throw new CustomError({
|
1165
|
+
message: "Request retry failed. Check the `res` and `statusCode` property on this error.",
|
1166
|
+
statusCode: data.statusCode,
|
1167
|
+
res: data.body,
|
1168
|
+
error: "Request retry failed. Check the `res` and `statusCode` property on this error.",
|
1169
|
+
sourceCall: sourceCall
|
1170
|
+
});
|
1171
|
+
}
|
1172
|
+
retryCount++;
|
1173
|
+
const retryTime = Math.floor(Math.random() * 5000);
|
1174
|
+
log.warn(
|
1175
|
+
"parseAndCheckLogin",
|
1176
|
+
"Got status code " +
|
1177
|
+
data.statusCode +
|
1178
|
+
" - " +
|
1179
|
+
retryCount +
|
1180
|
+
". attempt to retry in " +
|
1181
|
+
retryTime +
|
1182
|
+
" milliseconds..."
|
1183
|
+
);
|
1184
|
+
const url =
|
1185
|
+
data.request.uri.protocol +
|
1186
|
+
"//" +
|
1187
|
+
data.request.uri.hostname +
|
1188
|
+
data.request.uri.pathname;
|
1189
|
+
if (
|
1190
|
+
data.request.headers["Content-Type"].split(";")[0] ===
|
1191
|
+
"multipart/form-data"
|
1192
|
+
) {
|
1193
|
+
return bluebird
|
1194
|
+
.delay(retryTime)
|
1195
|
+
.then(function () {
|
1196
|
+
return defaultFuncs.postFormData(
|
1197
|
+
url,
|
1198
|
+
ctx.jar,
|
1199
|
+
data.request.formData,
|
1200
|
+
{}
|
1201
|
+
);
|
1202
|
+
})
|
1203
|
+
.then(parseAndCheckLogin(ctx, defaultFuncs, retryCount, sourceCall));
|
1204
|
+
}
|
1205
|
+
else {
|
1206
|
+
return bluebird
|
1207
|
+
.delay(retryTime)
|
1208
|
+
.then(function () {
|
1209
|
+
return defaultFuncs.post(url, ctx.jar, data.request.formData);
|
1210
|
+
})
|
1211
|
+
.then(parseAndCheckLogin(ctx, defaultFuncs, retryCount, sourceCall));
|
1212
|
+
}
|
1213
|
+
}
|
1214
|
+
if (data.statusCode !== 200)
|
1215
|
+
throw new CustomError({
|
1216
|
+
message: "parseAndCheckLogin got status code: " + data.statusCode + ". Bailing out of trying to parse response.",
|
1217
|
+
statusCode: data.statusCode,
|
1218
|
+
res: data.body,
|
1219
|
+
error: "parseAndCheckLogin got status code: " + data.statusCode + ". Bailing out of trying to parse response.",
|
1220
|
+
sourceCall: sourceCall
|
1221
|
+
});
|
1222
|
+
|
1223
|
+
let res = null;
|
1224
|
+
try {
|
1225
|
+
res = JSON.parse(makeParsable(data.body));
|
1226
|
+
} catch (e) {
|
1227
|
+
throw new CustomError({
|
1228
|
+
message: "JSON.parse error. Check the `detail` property on this error.",
|
1229
|
+
detail: e,
|
1230
|
+
res: data.body,
|
1231
|
+
error: "JSON.parse error. Check the `detail` property on this error.",
|
1232
|
+
sourceCall: sourceCall
|
1233
|
+
});
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
// In some cases the response contains only a redirect URL which should be followed
|
1237
|
+
if (res.redirect && data.request.method === "GET") {
|
1238
|
+
return defaultFuncs
|
1239
|
+
.get(res.redirect, ctx.jar)
|
1240
|
+
.then(parseAndCheckLogin(ctx, defaultFuncs, undefined, sourceCall));
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
// TODO: handle multiple cookies?
|
1244
|
+
if (
|
1245
|
+
res.jsmods &&
|
1246
|
+
res.jsmods.require &&
|
1247
|
+
Array.isArray(res.jsmods.require[0]) &&
|
1248
|
+
res.jsmods.require[0][0] === "Cookie"
|
1249
|
+
) {
|
1250
|
+
res.jsmods.require[0][3][0] = res.jsmods.require[0][3][0].replace(
|
1251
|
+
"_js_",
|
1252
|
+
""
|
1253
|
+
);
|
1254
|
+
const cookie = formatCookie(res.jsmods.require[0][3], "facebook");
|
1255
|
+
const cookie2 = formatCookie(res.jsmods.require[0][3], "messenger");
|
1256
|
+
ctx.jar.setCookie(cookie, "https://www.facebook.com");
|
1257
|
+
ctx.jar.setCookie(cookie2, "https://www.messenger.com");
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
// On every request we check if we got a DTSG and we mutate the context so that we use the latest
|
1261
|
+
// one for the next requests.
|
1262
|
+
if (res.jsmods && Array.isArray(res.jsmods.require)) {
|
1263
|
+
const arr = res.jsmods.require;
|
1264
|
+
for (const i in arr) {
|
1265
|
+
if (arr[i][0] === "DTSG" && arr[i][1] === "setToken") {
|
1266
|
+
ctx.fb_dtsg = arr[i][3][0];
|
1267
|
+
|
1268
|
+
// Update ttstamp since that depends on fb_dtsg
|
1269
|
+
ctx.ttstamp = "2";
|
1270
|
+
for (let j = 0; j < ctx.fb_dtsg.length; j++) {
|
1271
|
+
ctx.ttstamp += ctx.fb_dtsg.charCodeAt(j);
|
1272
|
+
}
|
1273
|
+
}
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
if (res.error === 1357001) {
|
1278
|
+
throw new CustomError({
|
1279
|
+
message: "Facebook blocked login. Please visit https://facebook.com and check your account.",
|
1280
|
+
error: "Not logged in.",
|
1281
|
+
res: res,
|
1282
|
+
statusCode: data.statusCode,
|
1283
|
+
sourceCall: sourceCall
|
1284
|
+
});
|
1285
|
+
}
|
1286
|
+
return res;
|
1287
|
+
});
|
1288
|
+
};
|
1353
1289
|
}
|
1354
1290
|
|
1291
|
+
/*
|
1355
1292
|
function checkLiveCookie(ctx, defaultFuncs) {
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1293
|
+
return defaultFuncs
|
1294
|
+
.get("https://m.facebook.com/me", ctx.jar)
|
1295
|
+
.then(function (res) {
|
1296
|
+
if (res.body.indexOf(ctx.i_userID || ctx.userID) === -1) {
|
1297
|
+
throw new CustomError({
|
1298
|
+
message: "Not logged in.",
|
1299
|
+
error: "Not logged in."
|
1300
|
+
});
|
1301
|
+
}
|
1302
|
+
return true;
|
1303
|
+
});
|
1367
1304
|
}
|
1305
|
+
*/
|
1368
1306
|
|
1369
1307
|
function saveCookies(jar) {
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1308
|
+
return function (res) {
|
1309
|
+
const cookies = res.headers["set-cookie"] || [];
|
1310
|
+
cookies.forEach(function (c) {
|
1311
|
+
if (c.indexOf(".facebook.com") > -1) {
|
1312
|
+
jar.setCookie(c, "https://www.facebook.com");
|
1313
|
+
}
|
1314
|
+
const c2 = c.replace(/domain=\.facebook\.com/, "domain=.messenger.com");
|
1315
|
+
jar.setCookie(c2, "https://www.messenger.com");
|
1316
|
+
});
|
1317
|
+
return res;
|
1318
|
+
};
|
1381
1319
|
}
|
1382
1320
|
|
1383
1321
|
const NUM_TO_MONTH = [
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1322
|
+
"Jan",
|
1323
|
+
"Feb",
|
1324
|
+
"Mar",
|
1325
|
+
"Apr",
|
1326
|
+
"May",
|
1327
|
+
"Jun",
|
1328
|
+
"Jul",
|
1329
|
+
"Aug",
|
1330
|
+
"Sep",
|
1331
|
+
"Oct",
|
1332
|
+
"Nov",
|
1333
|
+
"Dec"
|
1396
1334
|
];
|
1397
1335
|
const NUM_TO_DAY = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
1398
1336
|
function formatDate(date) {
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1337
|
+
let d = date.getUTCDate();
|
1338
|
+
d = d >= 10 ? d : "0" + d;
|
1339
|
+
let h = date.getUTCHours();
|
1340
|
+
h = h >= 10 ? h : "0" + h;
|
1341
|
+
let m = date.getUTCMinutes();
|
1342
|
+
m = m >= 10 ? m : "0" + m;
|
1343
|
+
let s = date.getUTCSeconds();
|
1344
|
+
s = s >= 10 ? s : "0" + s;
|
1345
|
+
return (
|
1346
|
+
NUM_TO_DAY[date.getUTCDay()] +
|
1347
|
+
", " +
|
1348
|
+
d +
|
1349
|
+
" " +
|
1350
|
+
NUM_TO_MONTH[date.getUTCMonth()] +
|
1351
|
+
" " +
|
1352
|
+
date.getUTCFullYear() +
|
1353
|
+
" " +
|
1354
|
+
h +
|
1355
|
+
":" +
|
1356
|
+
m +
|
1357
|
+
":" +
|
1358
|
+
s +
|
1359
|
+
" GMT"
|
1360
|
+
);
|
1423
1361
|
}
|
1424
1362
|
|
1425
1363
|
function formatCookie(arr, url) {
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1364
|
+
return (
|
1365
|
+
arr[0] + "=" + arr[1] + "; Path=" + arr[3] + "; Domain=" + url + ".com"
|
1366
|
+
);
|
1429
1367
|
}
|
1430
1368
|
|
1431
1369
|
function formatThread(data) {
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1370
|
+
return {
|
1371
|
+
threadID: formatID(data.thread_fbid.toString()),
|
1372
|
+
participants: data.participants.map(formatID),
|
1373
|
+
participantIDs: data.participants.map(formatID),
|
1374
|
+
name: data.name,
|
1375
|
+
nicknames: data.custom_nickname,
|
1376
|
+
snippet: data.snippet,
|
1377
|
+
snippetAttachments: data.snippet_attachments,
|
1378
|
+
snippetSender: formatID((data.snippet_sender || "").toString()),
|
1379
|
+
unreadCount: data.unread_count,
|
1380
|
+
messageCount: data.message_count,
|
1381
|
+
imageSrc: data.image_src,
|
1382
|
+
timestamp: data.timestamp,
|
1383
|
+
serverTimestamp: data.server_timestamp, // what is this?
|
1384
|
+
muteUntil: data.mute_until,
|
1385
|
+
isCanonicalUser: data.is_canonical_user,
|
1386
|
+
isCanonical: data.is_canonical,
|
1387
|
+
isSubscribed: data.is_subscribed,
|
1388
|
+
folder: data.folder,
|
1389
|
+
isArchived: data.is_archived,
|
1390
|
+
recipientsLoadable: data.recipients_loadable,
|
1391
|
+
hasEmailParticipant: data.has_email_participant,
|
1392
|
+
readOnly: data.read_only,
|
1393
|
+
canReply: data.can_reply,
|
1394
|
+
cannotReplyReason: data.cannot_reply_reason,
|
1395
|
+
lastMessageTimestamp: data.last_message_timestamp,
|
1396
|
+
lastReadTimestamp: data.last_read_timestamp,
|
1397
|
+
lastMessageType: data.last_message_type,
|
1398
|
+
emoji: data.custom_like_icon,
|
1399
|
+
color: data.custom_color,
|
1400
|
+
adminIDs: data.admin_ids,
|
1401
|
+
threadType: data.thread_type
|
1402
|
+
};
|
1465
1403
|
}
|
1466
1404
|
|
1467
1405
|
function getType(obj) {
|
1468
|
-
|
1406
|
+
return Object.prototype.toString.call(obj).slice(8, -1);
|
1469
1407
|
}
|
1470
1408
|
|
1471
1409
|
function formatProxyPresence(presence, userID) {
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1410
|
+
if (presence.lat === undefined || presence.p === undefined) return null;
|
1411
|
+
return {
|
1412
|
+
type: "presence",
|
1413
|
+
timestamp: presence.lat * 1000,
|
1414
|
+
userID: userID,
|
1415
|
+
statuses: presence.p
|
1416
|
+
};
|
1479
1417
|
}
|
1480
1418
|
|
1481
1419
|
function formatPresence(presence, userID) {
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1420
|
+
return {
|
1421
|
+
type: "presence",
|
1422
|
+
timestamp: presence.la * 1000,
|
1423
|
+
userID: userID,
|
1424
|
+
statuses: presence.a
|
1425
|
+
};
|
1488
1426
|
}
|
1489
1427
|
|
1490
1428
|
function decodeClientPayload(payload) {
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1429
|
+
/*
|
1430
|
+
Special function which Client using to "encode" clients JSON payload
|
1431
|
+
*/
|
1432
|
+
return JSON.parse(String.fromCharCode.apply(null, payload));
|
1495
1433
|
}
|
1496
1434
|
|
1497
1435
|
function getAppState(jar) {
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1436
|
+
return jar
|
1437
|
+
.getCookies("https://www.facebook.com")
|
1438
|
+
.concat(jar.getCookies("https://facebook.com"))
|
1439
|
+
.concat(jar.getCookies("https://www.messenger.com"));
|
1502
1440
|
}
|
1503
|
-
module.exports = {
|
1504
|
-
CustomError,
|
1505
|
-
isReadableStream,
|
1506
|
-
get,
|
1507
|
-
post,
|
1508
|
-
postFormData,
|
1509
|
-
generateThreadingID,
|
1510
|
-
generateOfflineThreadingID,
|
1511
|
-
getGUID,
|
1512
|
-
getFrom,
|
1513
|
-
makeParsable,
|
1514
|
-
arrToForm,
|
1515
|
-
getSignatureID,
|
1516
|
-
getJar: request.jar,
|
1517
|
-
generateTimestampRelative,
|
1518
|
-
makeDefaults,
|
1519
|
-
parseAndCheckLogin,
|
1520
|
-
saveCookies,
|
1521
|
-
getType,
|
1522
|
-
_formatAttachment,
|
1523
|
-
formatHistoryMessage,
|
1524
|
-
formatID,
|
1525
|
-
formatMessage,
|
1526
|
-
formatDeltaEvent,
|
1527
|
-
formatDeltaMessage,
|
1528
|
-
formatProxyPresence,
|
1529
|
-
formatPresence,
|
1530
|
-
formatTyp,
|
1531
|
-
formatDeltaReadReceipt,
|
1532
|
-
formatCookie,
|
1533
|
-
formatThread,
|
1534
|
-
formatReadReceipt,
|
1535
|
-
formatRead,
|
1536
|
-
generatePresence,
|
1537
|
-
generateAccessiblityCookie,
|
1538
|
-
formatDate,
|
1539
|
-
decodeClientPayload,
|
1540
|
-
getAppState,
|
1541
|
-
getAdminTextMessageType,
|
1542
|
-
setProxy,
|
1543
|
-
checkLiveCookie
|
1544
|
-
};
|
1545
1441
|
|
1442
|
+
/*
|
1443
|
+
function createAccess_token(jar, globalOptions) {
|
1444
|
+
return function (res) {
|
1445
|
+
return get('https://business.facebook.com/business_locations', jar, null, globalOptions)
|
1446
|
+
.then(function (resp) {
|
1447
|
+
var accessToken = /"],\["(\S+)","436761779744620",{/g.exec(resp.body);
|
1448
|
+
if (accessToken) accessToken = accessToken[1].split('"],["').pop();
|
1449
|
+
else accessToken = 'NONE';
|
1450
|
+
return [(res || resp.body), accessToken];
|
1451
|
+
})
|
1452
|
+
.catch(() => {
|
1453
|
+
return [(res || null), 'NONE'];
|
1454
|
+
})
|
1455
|
+
}
|
1456
|
+
}
|
1457
|
+
*/
|
1458
|
+
|
1459
|
+
function getCurrentTimestamp() {
|
1460
|
+
const date = new Date();
|
1461
|
+
const unixTime = date.getTime();
|
1462
|
+
return unixTime;
|
1463
|
+
}
|
1464
|
+
|
1465
|
+
module.exports = {
|
1466
|
+
CustomError,
|
1467
|
+
isReadableStream,
|
1468
|
+
get,
|
1469
|
+
post,
|
1470
|
+
postFormData,
|
1471
|
+
generateThreadingID,
|
1472
|
+
generateOfflineThreadingID,
|
1473
|
+
getGUID,
|
1474
|
+
getFrom,
|
1475
|
+
makeParsable,
|
1476
|
+
arrToForm,
|
1477
|
+
getSignatureID,
|
1478
|
+
getJar: request.jar,
|
1479
|
+
generateTimestampRelative,
|
1480
|
+
makeDefaults,
|
1481
|
+
parseAndCheckLogin,
|
1482
|
+
saveCookies,
|
1483
|
+
getType,
|
1484
|
+
_formatAttachment,
|
1485
|
+
formatHistoryMessage,
|
1486
|
+
formatID,
|
1487
|
+
formatMessage,
|
1488
|
+
formatDeltaEvent,
|
1489
|
+
formatDeltaMessage,
|
1490
|
+
formatProxyPresence,
|
1491
|
+
formatPresence,
|
1492
|
+
formatTyp,
|
1493
|
+
formatDeltaReadReceipt,
|
1494
|
+
formatCookie,
|
1495
|
+
formatThread,
|
1496
|
+
formatReadReceipt,
|
1497
|
+
formatRead,
|
1498
|
+
generatePresence,
|
1499
|
+
generateAccessiblityCookie,
|
1500
|
+
formatDate,
|
1501
|
+
decodeClientPayload,
|
1502
|
+
getAppState,
|
1503
|
+
getAdminTextMessageType,
|
1504
|
+
setProxy,
|
1505
|
+
//checkLiveCookie,
|
1506
|
+
//createAccess_token,
|
1507
|
+
getCurrentTimestamp
|
1508
|
+
}
|