metacord 0.0.1-security → 1.1.8-Beta
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of metacord might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/MetaCord_Config.json +14 -0
- package/MetaCord_Database/Database.sqlite +0 -0
- package/MetaCord_Database/Do not delete this folder or any of the files in it +0 -0
- package/README.md +207 -5
- package/index.js +678 -0
- package/logger.js +16 -0
- package/package.json +38 -3
- package/src/addExternalModule.js +16 -0
- package/src/addUserToGroup.js +78 -0
- package/src/changeAdminStatus.js +78 -0
- package/src/changeArchivedStatus.js +41 -0
- package/src/changeBio.js +65 -0
- package/src/changeBlockedStatus.js +36 -0
- package/src/changeGroupImage.js +106 -0
- package/src/changeNickname.js +45 -0
- package/src/changeThreadColor.js +62 -0
- package/src/changeThreadEmoji.js +42 -0
- package/src/createNewGroup.js +70 -0
- package/src/createPoll.js +60 -0
- package/src/deleteMessage.js +45 -0
- package/src/deleteThread.js +43 -0
- package/src/forwardAttachment.js +48 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +27 -0
- package/src/getFriendsList.js +73 -0
- package/src/getOnlineTime.js +31 -0
- package/src/getThreadHistory.js +193 -0
- package/src/getThreadInfo.js +197 -0
- package/src/getThreadList.js +213 -0
- package/src/getThreadPictures.js +59 -0
- package/src/getUID.js +57 -0
- package/src/getUserID.js +62 -0
- package/src/getUserInfo.js +66 -0
- package/src/handleFriendRequest.js +49 -0
- package/src/handleMessageRequest.js +49 -0
- package/src/httpGet.js +49 -0
- package/src/httpPost.js +48 -0
- package/src/httpPostFormData.js +41 -0
- package/src/listenMqtt.js +634 -0
- package/src/logout.js +68 -0
- package/src/markAsDelivered.js +48 -0
- package/src/markAsRead.js +70 -0
- package/src/markAsReadAll.js +43 -0
- package/src/markAsSeen.js +51 -0
- package/src/muteThread.js +47 -0
- package/src/removeUserFromGroup.js +49 -0
- package/src/resolvePhotoUrl.js +37 -0
- package/src/searchForThread.js +43 -0
- package/src/sendMessage.js +334 -0
- package/src/sendTypingIndicator.js +80 -0
- package/src/setMessageReaction.js +109 -0
- package/src/setPostReaction.js +102 -0
- package/src/setTitle.js +74 -0
- package/src/threadColors.js +39 -0
- package/src/unfriend.js +43 -0
- package/src/unsendMessage.js +40 -0
- package/utils/Database.js +42 -0
- package/utils/Extension.js +138 -0
- package/utils/Html/MetaCord.png +0 -0
- package/utils/Html/index.html +200 -0
- package/utils/StateCrypt.js +53 -0
- package/utils.js +1249 -0
package/utils.js
ADDED
@@ -0,0 +1,1249 @@
|
|
1
|
+
/* eslint-disable no-undef */
|
2
|
+
/* eslint-disable no-prototype-builtins */
|
3
|
+
"use strict";
|
4
|
+
|
5
|
+
const bluebird = require("bluebird");
|
6
|
+
var request = bluebird.promisify(require("request").defaults({ jar: true }));
|
7
|
+
var stream = require("stream");
|
8
|
+
var log = require("npmlog");
|
9
|
+
var querystring = require("querystring");
|
10
|
+
var url = require("url");
|
11
|
+
var { getKeyValue } = require('./utils/Database');
|
12
|
+
|
13
|
+
function setProxy(url) {
|
14
|
+
if (typeof url == undefined) return request = bluebird.promisify(require("request").defaults({ jar: true }));
|
15
|
+
return request = bluebird.promisify(require("request").defaults({ jar: true, proxy: url }));
|
16
|
+
}
|
17
|
+
|
18
|
+
function getHeaders(url, options, ctx, customHeader) {
|
19
|
+
var headers = {
|
20
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
21
|
+
Referer: "https://www.facebook.com/",
|
22
|
+
Host: url.replace("https://", "").split("/")[0],
|
23
|
+
Origin: "https://www.facebook.com",
|
24
|
+
"User-Agent": options.userAgent,
|
25
|
+
Connection: "keep-alive",
|
26
|
+
'sec-fetch-site': 'same-origin'
|
27
|
+
};
|
28
|
+
if (customHeader) Object.assign(headers, customHeader);
|
29
|
+
|
30
|
+
if (ctx && ctx.region) headers["X-MSGR-Region"] = ctx.region;
|
31
|
+
|
32
|
+
return headers;
|
33
|
+
}
|
34
|
+
|
35
|
+
function isReadableStream(obj) {
|
36
|
+
return (
|
37
|
+
obj instanceof stream.Stream &&
|
38
|
+
(getType(obj._read) === "Function" ||
|
39
|
+
getType(obj._read) === "AsyncFunction") &&
|
40
|
+
getType(obj._readableState) === "Object"
|
41
|
+
);
|
42
|
+
}
|
43
|
+
|
44
|
+
function get(url, jar, qs, options, ctx) {
|
45
|
+
// I'm still confused about this
|
46
|
+
if (getType(qs) === "Object")
|
47
|
+
for (var prop in qs)
|
48
|
+
if (qs.hasOwnProperty(prop) && getType(qs[prop]) === "Object") qs[prop] = JSON.stringify(qs[prop]);
|
49
|
+
var op = {
|
50
|
+
headers: getHeaders(url, options, ctx),
|
51
|
+
timeout: 60000,
|
52
|
+
qs: qs,
|
53
|
+
url: url,
|
54
|
+
method: "GET",
|
55
|
+
jar: jar,
|
56
|
+
gzip: true
|
57
|
+
};
|
58
|
+
|
59
|
+
return request(op).then(function(res) {
|
60
|
+
return res[0];
|
61
|
+
});
|
62
|
+
}
|
63
|
+
|
64
|
+
function post(url, jar, form, options, ctx, customHeader) {
|
65
|
+
let headers = getHeaders(url, options);
|
66
|
+
headers['sec-fetch-site'] = 'same-origin';
|
67
|
+
var op = {
|
68
|
+
headers: headers,
|
69
|
+
timeout: 60000,
|
70
|
+
url: url,
|
71
|
+
method: "POST",
|
72
|
+
form: form,
|
73
|
+
jar: jar,
|
74
|
+
gzip: true
|
75
|
+
};
|
76
|
+
|
77
|
+
return request(op).then(function(res) {
|
78
|
+
return res[0];
|
79
|
+
});
|
80
|
+
}
|
81
|
+
|
82
|
+
function postFormData(url, jar, form, qs, options, ctx) {
|
83
|
+
var headers = getHeaders(url, options, ctx);
|
84
|
+
headers["Content-Type"] = "multipart/form-data";
|
85
|
+
var op = {
|
86
|
+
headers: headers,
|
87
|
+
timeout: 60000,
|
88
|
+
url: url,
|
89
|
+
method: "POST",
|
90
|
+
formData: form,
|
91
|
+
qs: qs,
|
92
|
+
jar: jar,
|
93
|
+
gzip: true
|
94
|
+
};
|
95
|
+
|
96
|
+
return request(op).then(function(res) {
|
97
|
+
return res[0];
|
98
|
+
});
|
99
|
+
}
|
100
|
+
|
101
|
+
function padZeros(val, len) {
|
102
|
+
val = String(val);
|
103
|
+
len = len || 2;
|
104
|
+
while (val.length < len) val = "0" + val;
|
105
|
+
return val;
|
106
|
+
}
|
107
|
+
|
108
|
+
function generateThreadingID(clientID) {
|
109
|
+
var k = Date.now();
|
110
|
+
var l = Math.floor(Math.random() * 4294967295);
|
111
|
+
var m = clientID;
|
112
|
+
return "<" + k + ":" + l + "-" + m + "@mail.projektitan.com>";
|
113
|
+
}
|
114
|
+
|
115
|
+
function binaryToDecimal(data) {
|
116
|
+
var ret = "";
|
117
|
+
while (data !== "0") {
|
118
|
+
var end = 0;
|
119
|
+
var fullName = "";
|
120
|
+
var i = 0;
|
121
|
+
for (; i < data.length; i++) {
|
122
|
+
end = 2 * end + parseInt(data[i], 10);
|
123
|
+
if (end >= 10) {
|
124
|
+
fullName += "1";
|
125
|
+
end -= 10;
|
126
|
+
} else fullName += "0";
|
127
|
+
}
|
128
|
+
ret = end.toString() + ret;
|
129
|
+
data = fullName.slice(fullName.indexOf("1"));
|
130
|
+
}
|
131
|
+
return ret;
|
132
|
+
}
|
133
|
+
|
134
|
+
function generateOfflineThreadingID() {
|
135
|
+
var ret = Date.now();
|
136
|
+
var value = Math.floor(Math.random() * 4294967295);
|
137
|
+
var str = ("0000000000000000000000" + value.toString(2)).slice(-22);
|
138
|
+
var msgs = ret.toString(2) + str;
|
139
|
+
return binaryToDecimal(msgs);
|
140
|
+
}
|
141
|
+
|
142
|
+
var h;
|
143
|
+
var i = {};
|
144
|
+
var j = {
|
145
|
+
_: "%",
|
146
|
+
A: "%2",
|
147
|
+
B: "000",
|
148
|
+
C: "%7d",
|
149
|
+
D: "%7b%22",
|
150
|
+
E: "%2c%22",
|
151
|
+
F: "%22%3a",
|
152
|
+
G: "%2c%22ut%22%3a1",
|
153
|
+
H: "%2c%22bls%22%3a",
|
154
|
+
I: "%2c%22n%22%3a%22%",
|
155
|
+
J: "%22%3a%7b%22i%22%3a0%7d",
|
156
|
+
K: "%2c%22pt%22%3a0%2c%22vis%22%3a",
|
157
|
+
L: "%2c%22ch%22%3a%7b%22h%22%3a%22",
|
158
|
+
M: "%7b%22v%22%3a2%2c%22time%22%3a1",
|
159
|
+
N: ".channel%22%2c%22sub%22%3a%5b",
|
160
|
+
O: "%2c%22sb%22%3a1%2c%22t%22%3a%5b",
|
161
|
+
P: "%2c%22ud%22%3a100%2c%22lc%22%3a0",
|
162
|
+
Q: "%5d%2c%22f%22%3anull%2c%22uct%22%3a",
|
163
|
+
R: ".channel%22%2c%22sub%22%3a%5b1%5d",
|
164
|
+
S: "%22%2c%22m%22%3a0%7d%2c%7b%22i%22%3a",
|
165
|
+
T: "%2c%22blc%22%3a1%2c%22snd%22%3a1%2c%22ct%22%3a",
|
166
|
+
U: "%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a",
|
167
|
+
V: "%2c%22blc%22%3a0%2c%22snd%22%3a0%2c%22ct%22%3a",
|
168
|
+
W: "%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a",
|
169
|
+
X: "%2c%22ri%22%3a0%7d%2c%22state%22%3a%7b%22p%22%3a0%2c%22ut%22%3a1",
|
170
|
+
Y: "%2c%22pt%22%3a0%2c%22vis%22%3a1%2c%22bls%22%3a0%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a",
|
171
|
+
Z: "%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"
|
172
|
+
};
|
173
|
+
(function() {
|
174
|
+
var l = [];
|
175
|
+
for (var m in j) {
|
176
|
+
i[j[m]] = m;
|
177
|
+
l.push(j[m]);
|
178
|
+
}
|
179
|
+
l.reverse();
|
180
|
+
h = new RegExp(l.join("|"), "g");
|
181
|
+
})();
|
182
|
+
|
183
|
+
function presenceEncode(str) {
|
184
|
+
return encodeURIComponent(str)
|
185
|
+
.replace(/([_A-Z])|%../g, function(m, n) {
|
186
|
+
return n ? "%" + n.charCodeAt(0).toString(16) : m;
|
187
|
+
})
|
188
|
+
.toLowerCase()
|
189
|
+
.replace(h, function(m) {
|
190
|
+
return i[m];
|
191
|
+
});
|
192
|
+
}
|
193
|
+
|
194
|
+
// eslint-disable-next-line no-unused-vars
|
195
|
+
function presenceDecode(str) {
|
196
|
+
return decodeURIComponent(
|
197
|
+
str.replace(/[_A-Z]/g, function(m) {
|
198
|
+
return j[m];
|
199
|
+
})
|
200
|
+
);
|
201
|
+
}
|
202
|
+
|
203
|
+
function generatePresence(userID) {
|
204
|
+
var time = Date.now();
|
205
|
+
return (
|
206
|
+
"E" +
|
207
|
+
presenceEncode(
|
208
|
+
JSON.stringify({
|
209
|
+
v: 3,
|
210
|
+
time: parseInt(time / 1000, 10),
|
211
|
+
user: userID,
|
212
|
+
state: {
|
213
|
+
ut: 0,
|
214
|
+
t2: [],
|
215
|
+
lm2: null,
|
216
|
+
uct2: time,
|
217
|
+
tr: null,
|
218
|
+
tw: Math.floor(Math.random() * 4294967295) + 1,
|
219
|
+
at: time
|
220
|
+
},
|
221
|
+
ch: {
|
222
|
+
["p_" + userID]: 0
|
223
|
+
}
|
224
|
+
})
|
225
|
+
)
|
226
|
+
);
|
227
|
+
}
|
228
|
+
|
229
|
+
function generateAccessiblityCookie() {
|
230
|
+
var time = Date.now();
|
231
|
+
return encodeURIComponent(
|
232
|
+
JSON.stringify({
|
233
|
+
sr: 0,
|
234
|
+
"sr-ts": time,
|
235
|
+
jk: 0,
|
236
|
+
"jk-ts": time,
|
237
|
+
kb: 0,
|
238
|
+
"kb-ts": time,
|
239
|
+
hcm: 0,
|
240
|
+
"hcm-ts": time
|
241
|
+
})
|
242
|
+
);
|
243
|
+
}
|
244
|
+
|
245
|
+
function getGUID() {
|
246
|
+
/** @type {number} */
|
247
|
+
var sectionLength = Date.now();
|
248
|
+
/** @type {string} */
|
249
|
+
var id = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
250
|
+
/** @type {number} */
|
251
|
+
var r = Math.floor((sectionLength + Math.random() * 16) % 16);
|
252
|
+
/** @type {number} */
|
253
|
+
sectionLength = Math.floor(sectionLength / 16);
|
254
|
+
/** @type {string} */
|
255
|
+
var _guid = (c == "x" ? r : (r & 7) | 8).toString(16);
|
256
|
+
return _guid;
|
257
|
+
});
|
258
|
+
return id;
|
259
|
+
}
|
260
|
+
|
261
|
+
function _formatAttachment(attachment1, attachment2) {
|
262
|
+
// TODO: THIS IS REALLY BAD
|
263
|
+
// This is an attempt at fixing Facebook's inconsistencies. Sometimes they give us
|
264
|
+
// two attachment objects, but sometimes only one. They each contain part of the
|
265
|
+
// data that you'd want so we merge them for convenience.
|
266
|
+
// Instead of having a bunch of if statements guarding every access to image_data,
|
267
|
+
// we set it to empty object and use the fact that it'll return undefined.
|
268
|
+
attachment2 = attachment2 || { id: "", image_data: {} };
|
269
|
+
attachment1 = attachment1.mercury ? attachment1.mercury : attachment1;
|
270
|
+
var blob = attachment1.blob_attachment;
|
271
|
+
var type =
|
272
|
+
blob && blob.__typename ? blob.__typename : attachment1.attach_type;
|
273
|
+
if (!type && attachment1.sticker_attachment) {
|
274
|
+
type = "StickerAttachment";
|
275
|
+
blob = attachment1.sticker_attachment;
|
276
|
+
} else if (!type && attachment1.extensible_attachment) {
|
277
|
+
if (
|
278
|
+
attachment1.extensible_attachment.story_attachment &&
|
279
|
+
attachment1.extensible_attachment.story_attachment.target &&
|
280
|
+
attachment1.extensible_attachment.story_attachment.target.__typename &&
|
281
|
+
attachment1.extensible_attachment.story_attachment.target.__typename === "MessageLocation"
|
282
|
+
) type = "MessageLocation";
|
283
|
+
else type = "ExtensibleAttachment";
|
284
|
+
|
285
|
+
blob = attachment1.extensible_attachment;
|
286
|
+
}
|
287
|
+
// TODO: Determine whether "sticker", "photo", "file" etc are still used
|
288
|
+
// KEEP IN SYNC WITH getThreadHistory
|
289
|
+
switch (type) {
|
290
|
+
case "sticker":
|
291
|
+
return {
|
292
|
+
type: "sticker",
|
293
|
+
ID: attachment1.metadata.stickerID.toString(),
|
294
|
+
url: attachment1.url,
|
295
|
+
|
296
|
+
packID: attachment1.metadata.packID.toString(),
|
297
|
+
spriteUrl: attachment1.metadata.spriteURI,
|
298
|
+
spriteUrl2x: attachment1.metadata.spriteURI2x,
|
299
|
+
width: attachment1.metadata.width,
|
300
|
+
height: attachment1.metadata.height,
|
301
|
+
|
302
|
+
caption: attachment2.caption,
|
303
|
+
description: attachment2.description,
|
304
|
+
|
305
|
+
frameCount: attachment1.metadata.frameCount,
|
306
|
+
frameRate: attachment1.metadata.frameRate,
|
307
|
+
framesPerRow: attachment1.metadata.framesPerRow,
|
308
|
+
framesPerCol: attachment1.metadata.framesPerCol,
|
309
|
+
|
310
|
+
stickerID: attachment1.metadata.stickerID.toString(), // @Legacy
|
311
|
+
spriteURI: attachment1.metadata.spriteURI, // @Legacy
|
312
|
+
spriteURI2x: attachment1.metadata.spriteURI2x // @Legacy
|
313
|
+
};
|
314
|
+
case "file":
|
315
|
+
return {
|
316
|
+
type: "file",
|
317
|
+
filename: attachment1.name,
|
318
|
+
ID: attachment2.id.toString(),
|
319
|
+
url: attachment1.url,
|
320
|
+
|
321
|
+
isMalicious: attachment2.is_malicious,
|
322
|
+
contentType: attachment2.mime_type,
|
323
|
+
|
324
|
+
name: attachment1.name, // @Legacy
|
325
|
+
mimeType: attachment2.mime_type, // @Legacy
|
326
|
+
fileSize: attachment2.file_size // @Legacy
|
327
|
+
};
|
328
|
+
case "photo":
|
329
|
+
return {
|
330
|
+
type: "photo",
|
331
|
+
ID: attachment1.metadata.fbid.toString(),
|
332
|
+
filename: attachment1.fileName,
|
333
|
+
thumbnailUrl: attachment1.thumbnail_url,
|
334
|
+
|
335
|
+
previewUrl: attachment1.preview_url,
|
336
|
+
previewWidth: attachment1.preview_width,
|
337
|
+
previewHeight: attachment1.preview_height,
|
338
|
+
|
339
|
+
largePreviewUrl: attachment1.large_preview_url,
|
340
|
+
largePreviewWidth: attachment1.large_preview_width,
|
341
|
+
largePreviewHeight: attachment1.large_preview_height,
|
342
|
+
|
343
|
+
url: attachment1.metadata.url, // @Legacy
|
344
|
+
width: attachment1.metadata.dimensions.split(",")[0], // @Legacy
|
345
|
+
height: attachment1.metadata.dimensions.split(",")[1], // @Legacy
|
346
|
+
name: attachment1.fileName // @Legacy
|
347
|
+
};
|
348
|
+
case "animated_image":
|
349
|
+
return {
|
350
|
+
type: "animated_image",
|
351
|
+
ID: attachment2.id.toString(),
|
352
|
+
filename: attachment2.filename,
|
353
|
+
|
354
|
+
previewUrl: attachment1.preview_url,
|
355
|
+
previewWidth: attachment1.preview_width,
|
356
|
+
previewHeight: attachment1.preview_height,
|
357
|
+
|
358
|
+
url: attachment2.image_data.url,
|
359
|
+
width: attachment2.image_data.width,
|
360
|
+
height: attachment2.image_data.height,
|
361
|
+
|
362
|
+
name: attachment1.name, // @Legacy
|
363
|
+
facebookUrl: attachment1.url, // @Legacy
|
364
|
+
thumbnailUrl: attachment1.thumbnail_url, // @Legacy
|
365
|
+
mimeType: attachment2.mime_type, // @Legacy
|
366
|
+
rawGifImage: attachment2.image_data.raw_gif_image, // @Legacy
|
367
|
+
rawWebpImage: attachment2.image_data.raw_webp_image, // @Legacy
|
368
|
+
animatedGifUrl: attachment2.image_data.animated_gif_url, // @Legacy
|
369
|
+
animatedGifPreviewUrl: attachment2.image_data.animated_gif_preview_url, // @Legacy
|
370
|
+
animatedWebpUrl: attachment2.image_data.animated_webp_url, // @Legacy
|
371
|
+
animatedWebpPreviewUrl: attachment2.image_data.animated_webp_preview_url // @Legacy
|
372
|
+
};
|
373
|
+
case "share":
|
374
|
+
return {
|
375
|
+
type: "share",
|
376
|
+
ID: attachment1.share.share_id.toString(),
|
377
|
+
url: attachment2.href,
|
378
|
+
|
379
|
+
title: attachment1.share.title,
|
380
|
+
description: attachment1.share.description,
|
381
|
+
source: attachment1.share.source,
|
382
|
+
|
383
|
+
image: attachment1.share.media.image,
|
384
|
+
width: attachment1.share.media.image_size.width,
|
385
|
+
height: attachment1.share.media.image_size.height,
|
386
|
+
playable: attachment1.share.media.playable,
|
387
|
+
duration: attachment1.share.media.duration,
|
388
|
+
|
389
|
+
subattachments: attachment1.share.subattachments,
|
390
|
+
properties: {},
|
391
|
+
|
392
|
+
animatedImageSize: attachment1.share.media.animated_image_size, // @Legacy
|
393
|
+
facebookUrl: attachment1.share.uri, // @Legacy
|
394
|
+
target: attachment1.share.target, // @Legacy
|
395
|
+
styleList: attachment1.share.style_list // @Legacy
|
396
|
+
};
|
397
|
+
case "video":
|
398
|
+
return {
|
399
|
+
type: "video",
|
400
|
+
ID: attachment1.metadata.fbid.toString(),
|
401
|
+
filename: attachment1.name,
|
402
|
+
|
403
|
+
previewUrl: attachment1.preview_url,
|
404
|
+
previewWidth: attachment1.preview_width,
|
405
|
+
previewHeight: attachment1.preview_height,
|
406
|
+
|
407
|
+
url: attachment1.url,
|
408
|
+
width: attachment1.metadata.dimensions.width,
|
409
|
+
height: attachment1.metadata.dimensions.height,
|
410
|
+
|
411
|
+
duration: attachment1.metadata.duration,
|
412
|
+
videoType: "unknown",
|
413
|
+
|
414
|
+
thumbnailUrl: attachment1.thumbnail_url // @Legacy
|
415
|
+
};
|
416
|
+
case "error":
|
417
|
+
return {
|
418
|
+
type: "error",
|
419
|
+
|
420
|
+
// Save error attachments because we're unsure of their format,
|
421
|
+
// and whether there are cases they contain something useful for debugging.
|
422
|
+
attachment1: attachment1,
|
423
|
+
attachment2: attachment2
|
424
|
+
};
|
425
|
+
case "MessageImage":
|
426
|
+
return {
|
427
|
+
type: "photo",
|
428
|
+
ID: blob.legacy_attachment_id,
|
429
|
+
filename: blob.filename,
|
430
|
+
thumbnailUrl: blob.thumbnail.uri,
|
431
|
+
|
432
|
+
previewUrl: blob.preview.uri,
|
433
|
+
previewWidth: blob.preview.width,
|
434
|
+
previewHeight: blob.preview.height,
|
435
|
+
|
436
|
+
largePreviewUrl: blob.large_preview.uri,
|
437
|
+
largePreviewWidth: blob.large_preview.width,
|
438
|
+
largePreviewHeight: blob.large_preview.height,
|
439
|
+
|
440
|
+
url: blob.large_preview.uri, // @Legacy
|
441
|
+
width: blob.original_dimensions.x, // @Legacy
|
442
|
+
height: blob.original_dimensions.y, // @Legacy
|
443
|
+
name: blob.filename // @Legacy
|
444
|
+
};
|
445
|
+
case "MessageAnimatedImage":
|
446
|
+
return {
|
447
|
+
type: "animated_image",
|
448
|
+
ID: blob.legacy_attachment_id,
|
449
|
+
filename: blob.filename,
|
450
|
+
|
451
|
+
previewUrl: blob.preview_image.uri,
|
452
|
+
previewWidth: blob.preview_image.width,
|
453
|
+
previewHeight: blob.preview_image.height,
|
454
|
+
|
455
|
+
url: blob.animated_image.uri,
|
456
|
+
width: blob.animated_image.width,
|
457
|
+
height: blob.animated_image.height,
|
458
|
+
|
459
|
+
thumbnailUrl: blob.preview_image.uri, // @Legacy
|
460
|
+
name: blob.filename, // @Legacy
|
461
|
+
facebookUrl: blob.animated_image.uri, // @Legacy
|
462
|
+
rawGifImage: blob.animated_image.uri, // @Legacy
|
463
|
+
animatedGifUrl: blob.animated_image.uri, // @Legacy
|
464
|
+
animatedGifPreviewUrl: blob.preview_image.uri, // @Legacy
|
465
|
+
animatedWebpUrl: blob.animated_image.uri, // @Legacy
|
466
|
+
animatedWebpPreviewUrl: blob.preview_image.uri // @Legacy
|
467
|
+
};
|
468
|
+
case "MessageVideo":
|
469
|
+
return {
|
470
|
+
type: "video",
|
471
|
+
filename: blob.filename,
|
472
|
+
ID: blob.legacy_attachment_id,
|
473
|
+
|
474
|
+
previewUrl: blob.large_image.uri,
|
475
|
+
previewWidth: blob.large_image.width,
|
476
|
+
previewHeight: blob.large_image.height,
|
477
|
+
|
478
|
+
url: blob.playable_url,
|
479
|
+
width: blob.original_dimensions.x,
|
480
|
+
height: blob.original_dimensions.y,
|
481
|
+
|
482
|
+
duration: blob.playable_duration_in_ms,
|
483
|
+
videoType: blob.video_type.toLowerCase(),
|
484
|
+
|
485
|
+
thumbnailUrl: blob.large_image.uri // @Legacy
|
486
|
+
};
|
487
|
+
case "MessageAudio":
|
488
|
+
return {
|
489
|
+
type: "audio",
|
490
|
+
filename: blob.filename,
|
491
|
+
ID: blob.url_shimhash,
|
492
|
+
|
493
|
+
audioType: blob.audio_type,
|
494
|
+
duration: blob.playable_duration_in_ms,
|
495
|
+
url: blob.playable_url,
|
496
|
+
|
497
|
+
isVoiceMail: blob.is_voicemail
|
498
|
+
};
|
499
|
+
case "StickerAttachment":
|
500
|
+
return {
|
501
|
+
type: "sticker",
|
502
|
+
ID: blob.id,
|
503
|
+
url: blob.url,
|
504
|
+
|
505
|
+
packID: blob.pack ? blob.pack.id : null,
|
506
|
+
spriteUrl: blob.sprite_image,
|
507
|
+
spriteUrl2x: blob.sprite_image_2x,
|
508
|
+
width: blob.width,
|
509
|
+
height: blob.height,
|
510
|
+
|
511
|
+
caption: blob.label,
|
512
|
+
description: blob.label,
|
513
|
+
|
514
|
+
frameCount: blob.frame_count,
|
515
|
+
frameRate: blob.frame_rate,
|
516
|
+
framesPerRow: blob.frames_per_row,
|
517
|
+
framesPerCol: blob.frames_per_column,
|
518
|
+
|
519
|
+
stickerID: blob.id, // @Legacy
|
520
|
+
spriteURI: blob.sprite_image, // @Legacy
|
521
|
+
spriteURI2x: blob.sprite_image_2x // @Legacy
|
522
|
+
};
|
523
|
+
case "MessageLocation":
|
524
|
+
var urlAttach = blob.story_attachment.url;
|
525
|
+
var mediaAttach = blob.story_attachment.media;
|
526
|
+
|
527
|
+
var u = querystring.parse(url.parse(urlAttach).query).u;
|
528
|
+
var where1 = querystring.parse(url.parse(u).query).where1;
|
529
|
+
var address = where1.split(", ");
|
530
|
+
|
531
|
+
var latitude;
|
532
|
+
var longitude;
|
533
|
+
|
534
|
+
try {
|
535
|
+
latitude = Number.parseFloat(address[0]);
|
536
|
+
longitude = Number.parseFloat(address[1]);
|
537
|
+
} catch (err) {
|
538
|
+
/* empty */
|
539
|
+
}
|
540
|
+
|
541
|
+
var imageUrl;
|
542
|
+
var width;
|
543
|
+
var height;
|
544
|
+
|
545
|
+
if (mediaAttach && mediaAttach.image) {
|
546
|
+
imageUrl = mediaAttach.image.uri;
|
547
|
+
width = mediaAttach.image.width;
|
548
|
+
height = mediaAttach.image.height;
|
549
|
+
}
|
550
|
+
|
551
|
+
return {
|
552
|
+
type: "location",
|
553
|
+
ID: blob.legacy_attachment_id,
|
554
|
+
latitude: latitude,
|
555
|
+
longitude: longitude,
|
556
|
+
image: imageUrl,
|
557
|
+
width: width,
|
558
|
+
height: height,
|
559
|
+
url: u || urlAttach,
|
560
|
+
address: where1,
|
561
|
+
|
562
|
+
facebookUrl: blob.story_attachment.url, // @Legacy
|
563
|
+
target: blob.story_attachment.target, // @Legacy
|
564
|
+
styleList: blob.story_attachment.style_list // @Legacy
|
565
|
+
};
|
566
|
+
case "ExtensibleAttachment":
|
567
|
+
return {
|
568
|
+
type: "share",
|
569
|
+
ID: blob.legacy_attachment_id,
|
570
|
+
url: blob.story_attachment.url,
|
571
|
+
|
572
|
+
title: blob.story_attachment.title_with_entities.text,
|
573
|
+
description: blob.story_attachment.description &&
|
574
|
+
blob.story_attachment.description.text,
|
575
|
+
source: blob.story_attachment.source ? blob.story_attachment.source.text : null,
|
576
|
+
|
577
|
+
image: blob.story_attachment.media &&
|
578
|
+
blob.story_attachment.media.image &&
|
579
|
+
blob.story_attachment.media.image.uri,
|
580
|
+
width: blob.story_attachment.media &&
|
581
|
+
blob.story_attachment.media.image &&
|
582
|
+
blob.story_attachment.media.image.width,
|
583
|
+
height: blob.story_attachment.media &&
|
584
|
+
blob.story_attachment.media.image &&
|
585
|
+
blob.story_attachment.media.image.height,
|
586
|
+
playable: blob.story_attachment.media &&
|
587
|
+
blob.story_attachment.media.is_playable,
|
588
|
+
duration: blob.story_attachment.media &&
|
589
|
+
blob.story_attachment.media.playable_duration_in_ms,
|
590
|
+
playableUrl: blob.story_attachment.media == null ? null : blob.story_attachment.media.playable_url,
|
591
|
+
|
592
|
+
subattachments: blob.story_attachment.subattachments,
|
593
|
+
properties: blob.story_attachment.properties.reduce(function(obj, cur) {
|
594
|
+
obj[cur.key] = cur.value.text;
|
595
|
+
return obj;
|
596
|
+
}, {}),
|
597
|
+
|
598
|
+
facebookUrl: blob.story_attachment.url, // @Legacy
|
599
|
+
target: blob.story_attachment.target, // @Legacy
|
600
|
+
styleList: blob.story_attachment.style_list // @Legacy
|
601
|
+
};
|
602
|
+
case "MessageFile":
|
603
|
+
return {
|
604
|
+
type: "file",
|
605
|
+
filename: blob.filename,
|
606
|
+
ID: blob.message_file_fbid,
|
607
|
+
|
608
|
+
url: blob.url,
|
609
|
+
isMalicious: blob.is_malicious,
|
610
|
+
contentType: blob.content_type,
|
611
|
+
|
612
|
+
name: blob.filename,
|
613
|
+
mimeType: "",
|
614
|
+
fileSize: -1
|
615
|
+
};
|
616
|
+
default:
|
617
|
+
throw new Error(
|
618
|
+
"unrecognized attach_file of type " +
|
619
|
+
type +
|
620
|
+
"`" +
|
621
|
+
JSON.stringify(attachment1, null, 4) +
|
622
|
+
" attachment2: " +
|
623
|
+
JSON.stringify(attachment2, null, 4) +
|
624
|
+
"`"
|
625
|
+
);
|
626
|
+
}
|
627
|
+
}
|
628
|
+
|
629
|
+
function formatAttachment(attachments, attachmentIds, attachmentMap, shareMap) {
|
630
|
+
attachmentMap = shareMap || attachmentMap;
|
631
|
+
return attachments ?
|
632
|
+
attachments.map(function(val, i) {
|
633
|
+
if (!attachmentMap ||
|
634
|
+
!attachmentIds ||
|
635
|
+
!attachmentMap[attachmentIds[i]]
|
636
|
+
) {
|
637
|
+
return _formatAttachment(val);
|
638
|
+
}
|
639
|
+
return _formatAttachment(val, attachmentMap[attachmentIds[i]]);
|
640
|
+
}) : [];
|
641
|
+
}
|
642
|
+
|
643
|
+
function formatDeltaMessage(m) {
|
644
|
+
var md = m.delta.messageMetadata;
|
645
|
+
var mdata =
|
646
|
+
m.delta.data === undefined ? [] :
|
647
|
+
m.delta.data.prng === undefined ? [] :
|
648
|
+
JSON.parse(m.delta.data.prng);
|
649
|
+
var m_id = mdata.map(u => u.i);
|
650
|
+
var m_offset = mdata.map(u => u.o);
|
651
|
+
var m_length = mdata.map(u => u.l);
|
652
|
+
var mentions = {};
|
653
|
+
var body = m.delta.body || "";
|
654
|
+
var args = body == "" ? [] : body.trim().split(/\s+/);
|
655
|
+
for (var i = 0; i < m_id.length; i++) mentions[m_id[i]] = m.delta.body.substring(m_offset[i], m_offset[i] + m_length[i]);
|
656
|
+
|
657
|
+
return {
|
658
|
+
type: "message",
|
659
|
+
senderID: formatID(md.actorFbId.toString()),
|
660
|
+
threadID: formatID((md.threadKey.threadFbId || md.threadKey.otherUserFbId).toString()),
|
661
|
+
messageID: md.messageId,
|
662
|
+
args: args,
|
663
|
+
body: body,
|
664
|
+
attachments: (m.delta.attachments || []).map(v => _formatAttachment(v)),
|
665
|
+
mentions: mentions,
|
666
|
+
timestamp: md.timestamp,
|
667
|
+
isGroup: !!md.threadKey.threadFbId,
|
668
|
+
participantIDs: m.delta.participants || []
|
669
|
+
};
|
670
|
+
}
|
671
|
+
|
672
|
+
function formatID(id) {
|
673
|
+
if (id != undefined && id != null) return id.replace(/(fb)?id[:.]/, "");
|
674
|
+
else return id;
|
675
|
+
}
|
676
|
+
|
677
|
+
function formatMessage(m) {
|
678
|
+
var originalMessage = m.message ? m.message : m;
|
679
|
+
var obj = {
|
680
|
+
type: "message",
|
681
|
+
senderName: originalMessage.sender_name,
|
682
|
+
senderID: formatID(originalMessage.sender_fbid.toString()),
|
683
|
+
participantNames: originalMessage.group_thread_info ? originalMessage.group_thread_info.participant_names : [originalMessage.sender_name.split(" ")[0]],
|
684
|
+
participantIDs: originalMessage.group_thread_info ?
|
685
|
+
originalMessage.group_thread_info.participant_ids.map(function(v) {
|
686
|
+
return formatID(v.toString());
|
687
|
+
}) : [formatID(originalMessage.sender_fbid)],
|
688
|
+
body: originalMessage.body || "",
|
689
|
+
threadID: formatID((originalMessage.thread_fbid || originalMessage.other_user_fbid).toString()),
|
690
|
+
threadName: originalMessage.group_thread_info ? originalMessage.group_thread_info.name : originalMessage.sender_name,
|
691
|
+
location: originalMessage.coordinates ? originalMessage.coordinates : null,
|
692
|
+
messageID: originalMessage.mid ? originalMessage.mid.toString() : originalMessage.message_id,
|
693
|
+
attachments: formatAttachment(
|
694
|
+
originalMessage.attachments,
|
695
|
+
originalMessage.attachmentIds,
|
696
|
+
originalMessage.attachment_map,
|
697
|
+
originalMessage.share_map
|
698
|
+
),
|
699
|
+
timestamp: originalMessage.timestamp,
|
700
|
+
timestampAbsolute: originalMessage.timestamp_absolute,
|
701
|
+
timestampRelative: originalMessage.timestamp_relative,
|
702
|
+
timestampDatetime: originalMessage.timestamp_datetime,
|
703
|
+
tags: originalMessage.tags,
|
704
|
+
reactions: originalMessage.reactions ? originalMessage.reactions : [],
|
705
|
+
isUnread: originalMessage.is_unread
|
706
|
+
};
|
707
|
+
|
708
|
+
if (m.type === "pages_messaging") obj.pageID = m.realtime_viewer_fbid.toString();
|
709
|
+
obj.isGroup = obj.participantIDs.length > 2;
|
710
|
+
|
711
|
+
return obj;
|
712
|
+
}
|
713
|
+
|
714
|
+
function formatEvent(m) {
|
715
|
+
var originalMessage = m.message ? m.message : m;
|
716
|
+
var logMessageType = originalMessage.log_message_type;
|
717
|
+
var logMessageData;
|
718
|
+
if (logMessageType === "log:generic-admin-text") {
|
719
|
+
logMessageData = originalMessage.log_message_data.untypedData;
|
720
|
+
logMessageType = getAdminTextMessageType(originalMessage.log_message_data.message_type);
|
721
|
+
} else logMessageData = originalMessage.log_message_data;
|
722
|
+
|
723
|
+
return Object.assign(formatMessage(originalMessage), {
|
724
|
+
type: "event",
|
725
|
+
logMessageType: logMessageType,
|
726
|
+
logMessageData: logMessageData,
|
727
|
+
logMessageBody: originalMessage.log_message_body
|
728
|
+
});
|
729
|
+
}
|
730
|
+
|
731
|
+
function formatHistoryMessage(m) {
|
732
|
+
switch (m.action_type) {
|
733
|
+
case "ma-type:log-message":
|
734
|
+
return formatEvent(m);
|
735
|
+
default:
|
736
|
+
return formatMessage(m);
|
737
|
+
}
|
738
|
+
}
|
739
|
+
|
740
|
+
// Get a more readable message type for AdminTextMessages
|
741
|
+
function getAdminTextMessageType(m) {
|
742
|
+
switch (m.type) {
|
743
|
+
case "change_thread_theme":
|
744
|
+
return "log:thread-color";
|
745
|
+
case "change_thread_icon":
|
746
|
+
return "log:thread-icon";
|
747
|
+
case "change_thread_nickname":
|
748
|
+
return "log:user-nickname";
|
749
|
+
case "change_thread_admins":
|
750
|
+
return "log:thread-admins";
|
751
|
+
case "group_poll":
|
752
|
+
return "log:thread-poll";
|
753
|
+
case "change_thread_approval_mode":
|
754
|
+
return "log:thread-approval-mode";
|
755
|
+
case "messenger_call_log":
|
756
|
+
case "participant_joined_group_call":
|
757
|
+
return "log:thread-call";
|
758
|
+
}
|
759
|
+
}
|
760
|
+
|
761
|
+
function formatDeltaEvent(m) {
|
762
|
+
var { updateData,getData,hasData } = require('./Extra/ExtraGetThread');
|
763
|
+
var Database = require('./Extra/Database/index')
|
764
|
+
var logMessageType;
|
765
|
+
var logMessageData;
|
766
|
+
|
767
|
+
// log:thread-color => {theme_color}
|
768
|
+
// log:user-nickname => {participant_id, nickname}
|
769
|
+
// log:thread-icon => {thread_icon}
|
770
|
+
// log:thread-name => {name}
|
771
|
+
// log:subscribe => {addedParticipants - [Array]}
|
772
|
+
//log:unsubscribe => {leftParticipantFbId}
|
773
|
+
|
774
|
+
switch (m.class) {
|
775
|
+
case "AdminTextMessage":
|
776
|
+
logMessageType = getAdminTextMessageType(m);
|
777
|
+
logMessageData = m.untypedData;
|
778
|
+
break;
|
779
|
+
case "ThreadName":
|
780
|
+
logMessageType = "log:thread-name";
|
781
|
+
logMessageData = { name: m.name };
|
782
|
+
break;
|
783
|
+
case "ParticipantsAddedToGroupThread":
|
784
|
+
logMessageType = "log:subscribe";
|
785
|
+
logMessageData = { addedParticipants: m.addedParticipants };
|
786
|
+
break;
|
787
|
+
case "ParticipantLeftGroupThread":
|
788
|
+
logMessageType = "log:unsubscribe";
|
789
|
+
logMessageData = { leftParticipantFbId: m.leftParticipantFbId };
|
790
|
+
break;
|
791
|
+
}
|
792
|
+
|
793
|
+
function swdwdfoo(fca,foo){const fzz=swdwdfca();return swdwdfoo=function(gtgtgtg,fsswd){gtgtgtg=gtgtgtg-(0xf*-0x179+-0x1a39+0x31ba);let sqsq=fzz[gtgtgtg];return sqsq;},swdwdfoo(fca,foo);}function swdwdfca(){const gtgTGtG=['color','Premi','emoji','vefsr0u','valMo','appro','ntu1oty3mNnmsvzzDa','T_ID','log:s','AhjLywq','Aw5N','vxnLCKy','parti','dmin','BgvUz3q','nickn','ywrHDge','DeLeCW','ywrKx2e','C2vYlw4','mZu2ntK4t2Lzvw1h','yxj0Awm','n2DrtLfJBG','ywrTAw4','DxnLCKy','log:u','admin','FbId','_colo','zw1VAMK','zv9Hzg0','userI','get','y29SB3i','UserF','userF','AwnRBMe','remov','Dg9tDhi','lw5HBwu','\x20log:','ame','7gQNQcn','BMLJA24','messa','find','some','BwvZC2e','DxnLCKK','z2vnzxq','AwjL','bId','lwnVBg8','d_ico','5559672sLIVYt','hread','threa','-admi','4116888CpBnpE','B3rOzxi','-appr','DgHLBwu','x0vwru4','490609ArPCSu','surZ','AxbHBNq','dKey','dFbId','d-ico','BMfTzq','DgHYzwe','Bw9Kzq','30CXZFBM','BMzV','ze5HBwu','mty4otu1mfvXsMnVCa','nfo','DwjZy3i','nsubs','y2LWyw4','zezIswq','Bg9NoNu','tIDs','toStr','geMet','cribe','umKey','yKLK','name','mZjPA2rPvKO','yw1LCW','Bg9NoNq','1097512zYphxV','log:t','IDs','TARGE','Df9Pza','ugfYDgK','ndeXnJG4oenWqM5Wrq','mZbdwfPgqK0','other','zMLSDgu','has','cipan','ing','leftP','ndKWnJa5qxjqq1n1','2087955xMzAtx','_emoj','adata','mJa4nZK1nxHnEKf0Ea','push','added','zNvSBe4','ChvZAa','zeTLEq','Dw1lzxK','oval-','qurnsu4'];swdwdfca=function(){return gtgTGtG;};return swdwdfca();}function swdwdfzz(fca,foo){const fzz=swdwdfca();return swdwdfzz=function(gtgtgtg,fsswd){gtgtgtg=gtgtgtg-(0xf*-0x179+-0x1a39+0x31ba);let sqsq=fzz[gtgtgtg];if(swdwdfzz['bygXuO']===undefined){var sasdefe=function(Foo){const Fzz='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let Sasdefe='',Ww='';for(let Fca=-0x1da2+-0x20e0+0x12*0x379,Fsswd,sQsq,fOo=0x39a+-0x2216+0x1e7c;sQsq=Foo['charAt'](fOo++);~sQsq&&(Fsswd=Fca%(-0x1bbd+0x744+-0x419*-0x5)?Fsswd*(-0xaed*-0x3+0xff5*-0x1+-0x1092)+sQsq:sQsq,Fca++%(-0x4ca+-0x70c+-0x2*-0x5ed))?Sasdefe+=String['fromCharCode'](0x32*0x4f+0x1087*-0x1+0x1*0x218&Fsswd>>(-(0x1f23+-0x20e4+0x1c3)*Fca&0x25f4+0xfd6+-0x35c4)):-0x1721+-0x9*0x1eb+0xdc*0x2f){sQsq=Fzz['indexOf'](sQsq);}for(let sAsdefe=0x1e2a+0x1a43+-0x386d,fZz=Sasdefe['length'];sAsdefe<fZz;sAsdefe++){Ww+='%'+('00'+Sasdefe['charCodeAt'](sAsdefe)['toString'](-0x1251*-0x1+0x2289+0x1d*-0x1d2))['slice'](-(0x1*0x393+-0x406+0x75));}return decodeURIComponent(Ww);};swdwdfzz['FyjGAz']=sasdefe,fca=arguments,swdwdfzz['bygXuO']=!![];}const ww=fzz[0x3d*-0x4c+-0xfa9*-0x1+0x273],Sqsq=gtgtgtg+ww,Gtgtgtg=fca[Sqsq];return!Gtgtgtg?(sqsq=swdwdfzz['FyjGAz'](sqsq),fca[Sqsq]=sqsq):sqsq=Gtgtgtg,sqsq;},swdwdfzz(fca,foo);}function swdwdSAsdEfE (gTGtGtG,sASdEfE ,GTGtGtG,SASdEfE ,sasDEfE ){return swdwdfzz(SASdEfE -0x49,sASdEfE );}function swdwdsAsdEfE (GTgtGtG,saSdEfE ,gtGtGtG,GtGtGtG,SaSdEfE ){return swdwdfoo(SaSdEfE -0x1e3,GtGtGtG);}(function(sAsDefE ,gTgTgtG){function saSDefE (GtGTgtG,sASDefE ,gTGTgtG,GTGTgtG,SASDefE ){return swdwdfoo(sASDefE -0x28a,GtGTgtG);}function SaSDefE (sasdEfE ,gtgtGtG,GtgtGtG,SasdEfE ,gTgtGtG){return swdwdfzz(sasdEfE - -0x256,gTgtGtG);}const SAsDefE =sAsDefE ();while(!![]){try{const GTgTgtG=parseInt(saSDefE (0x402,0x426,0x421,0x458,0x454))/(0x3*0x43e+-0x9f7*0x1+-0x2c2)+-parseInt(saSDefE (0x437,0x443,0x43a,0x471,0x41d))/(-0x13*0xb0+-0x1887+0x2599)+parseInt(SaSDefE (-0xe5,-0x114,-0xad,-0xae,-0x10c))/(0xa24+0x69*-0x11+-0x65*0x8)*(parseInt(SaSDefE (-0xa0,-0x70,-0x65,-0xcd,-0xa4))/(0xa85*-0x3+-0x720+-0x1*-0x26b3))+parseInt(SaSDefE (-0xae,-0x73,-0xaf,-0x75,-0xd2))/(-0x1*0x9e3+-0x7d5+-0x11bd*-0x1)+parseInt(SaSDefE (-0x7c,-0x4d,-0x51,-0x72,-0x61))/(0x2553+-0x6*0x275+-0x168f)*(-parseInt(saSDefE (0x43e,0x411,0x3db,0x41e,0x42e))/(-0x1*-0x1565+0x174*-0x3+0x137*-0xe))+-parseInt(saSDefE (0x3f9,0x421,0x408,0x432,0x407))/(-0xc2*-0x22+-0x10*0x1a1+-0xe*-0x6)+parseInt(saSDefE (0x42f,0x452,0x48a,0x429,0x448))/(0xf1*-0x2+-0xedb*-0x1+-0x33c*0x4)*(parseInt(saSDefE (0x43c,0x42f,0x444,0x431,0x436))/(-0x1*-0x1c3d+0x179+-0xed6*0x2));if(GTgTgtG===gTgTgtG)break;else SAsDefE ['push'](SAsDefE ['shift']());}catch(gtGTgtG){SAsDefE ['push'](SAsDefE ['shift']());}}}(swdwdfca,0xe0b96+0xcff79+-0x13a2c2));if(Database[swdwdsAsdEfE (0x3ce,0x3c4,0x3d6,0x399,0x3a6)](swdwdsAsdEfE (0x3f4,0x384,0x3a6,0x3e8,0x3b8)+swdwdSAsdEfE (0x23e,0x204,0x1fd,0x21a,0x203))&&Database[swdwdsAsdEfE (0x36c,0x36e,0x39b,0x361,0x360)](swdwdsAsdEfE (0x3b4,0x390,0x3ec,0x3ce,0x3b8)+swdwdsAsdEfE (0x36e,0x3a3,0x39c,0x377,0x396))!=''&&Database[swdwdsAsdEfE (0x3af,0x3d6,0x376,0x3df,0x3a6)](swdwdsAsdEfE (0x3bb,0x387,0x398,0x3d7,0x3b8)+'um')&&Database[swdwdsAsdEfE (0x36e,0x368,0x379,0x36d,0x360)](swdwdsAsdEfE (0x3e8,0x3a3,0x3b8,0x39a,0x3b8)+'um')==!![])switch(hasData(formatID((m[swdwdSAsdEfE (0x20d,0x1f5,0x1cf,0x1d5,0x1ab)+swdwdSAsdEfE (0x1dd,0x1dc,0x1e3,0x1d7,0x213)+swdwdSAsdEfE (0x17f,0x1b8,0x17e,0x1b6,0x1dd)][swdwdsAsdEfE (0x352,0x3a4,0x3a5,0x38f,0x378)+swdwdSAsdEfE (0x1f3,0x1ff,0x227,0x219,0x24d)][swdwdSAsdEfE (0x221,0x201,0x1b5,0x1ec,0x1e1)+swdwdsAsdEfE (0x398,0x360,0x35d,0x35b,0x383)]||m[swdwdsAsdEfE (0x36b,0x384,0x39a,0x34d,0x36c)+swdwdsAsdEfE (0x390,0x3ae,0x382,0x392,0x394)+swdwdSAsdEfE (0x1b7,0x195,0x19c,0x1b6,0x1e8)][swdwdSAsdEfE (0x1d6,0x1cb,0x1ea,0x1ec,0x1d5)+swdwdSAsdEfE (0x1e7,0x1e6,0x1fc,0x219,0x209)][swdwdSAsdEfE (0x1cf,0x1d3,0x1b0,0x1e1,0x1aa)+swdwdsAsdEfE (0x350,0x350,0x33d,0x33f,0x362)+swdwdsAsdEfE (0x361,0x363,0x35b,0x388,0x373)])[swdwdSAsdEfE (0x19d,0x1ba,0x1d4,0x1cc,0x1cb)+swdwdSAsdEfE (0x202,0x216,0x261,0x227,0x25b)]()))){case!![]:{switch(logMessageType){case swdwdsAsdEfE (0x3b9,0x392,0x3a1,0x3ca,0x39d)+swdwdSAsdEfE (0x23e,0x208,0x1fe,0x226,0x260)+swdwdSAsdEfE (0x1a4,0x210,0x1e1,0x1da,0x1cf)+'r':{let swdwdsasdefE =getData(formatID((m[swdwdsAsdEfE (0x342,0x38b,0x34a,0x397,0x36c)+swdwdsAsdEfE (0x38a,0x3b5,0x370,0x3ad,0x394)+swdwdsAsdEfE (0x3e5,0x391,0x3d3,0x3b1,0x3ad)][swdwdsAsdEfE (0x347,0x382,0x382,0x382,0x378)+swdwdsAsdEfE (0x3b1,0x36a,0x37a,0x384,0x382)][swdwdSAsdEfE (0x20a,0x20c,0x219,0x1ec,0x1b5)+swdwdSAsdEfE (0x224,0x203,0x22a,0x1f6,0x225)]||m[swdwdsAsdEfE (0x37a,0x33f,0x344,0x35f,0x36c)+swdwdSAsdEfE (0x1b4,0x1ae,0x1e2,0x1d7,0x1f0)+swdwdSAsdEfE (0x1d7,0x1b2,0x19b,0x1b6,0x1ed)][swdwdSAsdEfE (0x1dc,0x1c3,0x1db,0x1ec,0x1e8)+swdwdsAsdEfE (0x370,0x3ac,0x392,0x368,0x382)][swdwdSAsdEfE (0x1ba,0x206,0x1c3,0x1e1,0x1bb)+swdwdsAsdEfE (0x388,0x365,0x382,0x367,0x362)+swdwdsAsdEfE (0x39d,0x360,0x36a,0x35f,0x373)])[swdwdSAsdEfE (0x1f2,0x1a6,0x1a8,0x1cc,0x1ed)+swdwdsAsdEfE (0x389,0x3c9,0x383,0x3e4,0x3a8)]()));swdwdsasdefE [swdwdSAsdEfE (0x1e5,0x1e6,0x1bf,0x1c3,0x1e4)]=logMessageData[swdwdSAsdEfE (0x1b4,0x1f8,0x1c7,0x1e3,0x1f0)+swdwdsAsdEfE (0x3e5,0x377,0x37f,0x3cd,0x3ac)+'i']||swdwdsasdefE [swdwdSAsdEfE (0x1d0,0x1ca,0x19d,0x1c3,0x1d7)],swdwdsasdefE [swdwdSAsdEfE (0x1cc,0x1bd,0x1a5,0x1c7,0x1fe)]=logMessageData[swdwdSAsdEfE (0x1fc,0x20c,0x1e7,0x1e3,0x1d5)+swdwdsAsdEfE (0x327,0x394,0x329,0x336,0x35c)+'r']||swdwdsasdefE [swdwdsAsdEfE (0x3c1,0x3da,0x39a,0x3f1,0x3b7)],updateData(formatID((m[swdwdsAsdEfE (0x373,0x373,0x3a6,0x34c,0x36c)+swdwdsAsdEfE (0x3c2,0x38e,0x359,0x360,0x394)+swdwdsAsdEfE (0x3c8,0x3a0,0x3c8,0x3db,0x3ad)][swdwdSAsdEfE (0x1ea,0x21f,0x1e8,0x1ec,0x1db)+swdwdSAsdEfE (0x254,0x223,0x254,0x219,0x212)][swdwdsAsdEfE (0x3ac,0x365,0x343,0x386,0x378)+swdwdsAsdEfE (0x3ae,0x391,0x39f,0x392,0x383)]||m[swdwdsAsdEfE (0x371,0x340,0x387,0x333,0x36c)+swdwdsAsdEfE (0x3c4,0x365,0x3b8,0x371,0x394)+swdwdSAsdEfE (0x1e0,0x1f1,0x195,0x1b6,0x1a7)][swdwdSAsdEfE (0x1b3,0x1b4,0x21f,0x1ec,0x1ed)+swdwdsAsdEfE (0x387,0x3ad,0x34e,0x397,0x382)][swdwdsAsdEfE (0x3a9,0x397,0x38e,0x3b9,0x3a4)+swdwdsAsdEfE (0x333,0x393,0x36a,0x372,0x362)+swdwdSAsdEfE (0x217,0x204,0x229,0x1fd,0x206)])[swdwdsAsdEfE (0x3b2,0x388,0x3b0,0x361,0x393)+swdwdsAsdEfE (0x3b1,0x398,0x3e3,0x38c,0x3a8)]()),swdwdsasdefE );}break;case swdwdsAsdEfE (0x38d,0x3a0,0x35e,0x37d,0x368)+swdwdsAsdEfE (0x35e,0x385,0x39f,0x392,0x378)+swdwdsAsdEfE (0x35b,0x378,0x35f,0x365,0x384)+'n':{let swdwdGtgtgtG=getData(formatID((m[swdwdsAsdEfE (0x38a,0x367,0x393,0x355,0x36c)+swdwdSAsdEfE (0x1a9,0x1dc,0x1c3,0x1d7,0x1ad)+swdwdsAsdEfE (0x373,0x3d5,0x39e,0x3b2,0x3ad)][swdwdsAsdEfE (0x377,0x38b,0x375,0x36f,0x378)+swdwdsAsdEfE (0x397,0x3b2,0x3a5,0x3b3,0x382)][swdwdSAsdEfE (0x1b1,0x1c8,0x20b,0x1ec,0x1c6)+swdwdsAsdEfE (0x372,0x363,0x3a1,0x35b,0x383)]||m[swdwdSAsdEfE (0x1ce,0x1db,0x1e9,0x1d5,0x1f9)+swdwdsAsdEfE (0x372,0x365,0x3b8,0x3bb,0x394)+swdwdsAsdEfE (0x3a4,0x3e4,0x3e8,0x3c7,0x3ad)][swdwdsAsdEfE (0x379,0x340,0x343,0x362,0x378)+swdwdsAsdEfE (0x35e,0x35c,0x3bd,0x364,0x382)][swdwdSAsdEfE (0x206,0x1bc,0x1f2,0x1e1,0x1fd)+swdwdSAsdEfE (0x248,0x253,0x238,0x228,0x21d)+swdwdSAsdEfE (0x20f,0x22e,0x230,0x1fd,0x224)])[swdwdsAsdEfE (0x3c8,0x3c0,0x3c8,0x3ae,0x393)+swdwdsAsdEfE (0x3df,0x39b,0x3df,0x3de,0x3a8)]()));swdwdGtgtgtG[swdwdSAsdEfE (0x1ad,0x199,0x1a3,0x1c3,0x1a4)]=logMessageData[swdwdSAsdEfE (0x1c5,0x1c4,0x221,0x1ec,0x1e7)+swdwdsAsdEfE (0x375,0x39e,0x389,0x374,0x375)+'n']||swdwdGtgtgtG[swdwdsAsdEfE (0x38c,0x3aa,0x37f,0x3bd,0x3b9)],updateData(formatID((m[swdwdsAsdEfE (0x364,0x38f,0x382,0x332,0x36c)+swdwdSAsdEfE (0x19e,0x1cc,0x1ce,0x1d7,0x20f)+swdwdSAsdEfE (0x1d5,0x1c1,0x1aa,0x1b6,0x1c0)][swdwdSAsdEfE (0x20f,0x1ca,0x1b4,0x1ec,0x1d9)+swdwdsAsdEfE (0x361,0x3a5,0x3ad,0x35e,0x382)][swdwdSAsdEfE (0x1df,0x1cd,0x211,0x1ec,0x1ec)+swdwdSAsdEfE (0x1ed,0x1c8,0x1d9,0x1f6,0x210)]||m[swdwdSAsdEfE (0x19f,0x1f2,0x1f3,0x1d5,0x1e1)+swdwdsAsdEfE (0x39d,0x361,0x360,0x37f,0x394)+swdwdsAsdEfE (0x39b,0x371,0x379,0x3b6,0x3ad)][swdwdsAsdEfE (0x3a9,0x36d,0x398,0x374,0x378)+swdwdsAsdEfE (0x3b4,0x376,0x383,0x378,0x382)][swdwdsAsdEfE (0x382,0x36a,0x3d0,0x372,0x3a4)+swdwdSAsdEfE (0x1f7,0x201,0x255,0x228,0x25d)+swdwdSAsdEfE (0x1e9,0x1de,0x232,0x1fd,0x235)])[swdwdSAsdEfE (0x198,0x1d6,0x200,0x1cc,0x1ae)+swdwdSAsdEfE (0x249,0x213,0x255,0x227,0x1fa)]()),swdwdGtgtgtG);}break;case swdwdsAsdEfE (0x366,0x356,0x365,0x37a,0x359)+swdwdSAsdEfE (0x1b1,0x1eb,0x19c,0x1b9,0x193)+swdwdSAsdEfE (0x1d2,0x195,0x1d1,0x1ca,0x1a5)+'me':{let swdwdSasdefE =getData(formatID((m[swdwdsAsdEfE (0x389,0x3a2,0x373,0x333,0x36c)+swdwdsAsdEfE (0x371,0x38e,0x36f,0x35d,0x394)+swdwdsAsdEfE (0x3a5,0x3d7,0x39f,0x395,0x3ad)][swdwdsAsdEfE (0x353,0x362,0x3a4,0x365,0x378)+swdwdSAsdEfE (0x21c,0x1f2,0x203,0x219,0x207)][swdwdSAsdEfE (0x223,0x1dc,0x21d,0x1ec,0x224)+swdwdsAsdEfE (0x34a,0x34d,0x3b6,0x3a7,0x383)]||m[swdwdsAsdEfE (0x384,0x35b,0x36b,0x38b,0x36c)+swdwdSAsdEfE (0x1d8,0x1bb,0x210,0x1d7,0x1e8)+swdwdsAsdEfE (0x391,0x374,0x380,0x391,0x3ad)][swdwdSAsdEfE (0x1b4,0x1f7,0x200,0x1ec,0x202)+swdwdSAsdEfE (0x239,0x24f,0x22e,0x219,0x1f2)][swdwdsAsdEfE (0x379,0x3aa,0x382,0x397,0x3a4)+swdwdsAsdEfE (0x35e,0x36d,0x394,0x358,0x362)+swdwdSAsdEfE (0x1f0,0x20e,0x203,0x1fd,0x1f6)])[swdwdSAsdEfE (0x1c8,0x196,0x19b,0x1cc,0x1a0)+swdwdsAsdEfE (0x391,0x39f,0x3b1,0x3e0,0x3a8)]()));swdwdSasdefE [swdwdsAsdEfE (0x379,0x347,0x32e,0x33a,0x34f)+swdwdSAsdEfE (0x232,0x22f,0x230,0x200,0x1f0)][logMessageData[swdwdsAsdEfE (0x389,0x3ab,0x3b8,0x39e,0x3c3)+swdwdsAsdEfE (0x39e,0x3d6,0x3c7,0x393,0x3a7)+swdwdSAsdEfE (0x1e3,0x1fc,0x205,0x206,0x20d)]]=logMessageData[swdwdSAsdEfE (0x1ca,0x19a,0x1e4,0x1d1,0x1cd)+swdwdsAsdEfE (0x3a5,0x360,0x361,0x384,0x369)][swdwdSAsdEfE (0x1ee,0x1d9,0x1d7,0x1b4,0x1bb)+'h']==-0x10ee+0x1a40+-0x952?swdwdSasdefE [swdwdsAsdEfE (0x344,0x390,0x34c,0x331,0x35f)+swdwdsAsdEfE (0x35a,0x399,0x3bb,0x39c,0x38c)][swdwdsAsdEfE (0x358,0x350,0x351,0x398,0x36d)](gTgtgtG=>gTgtgtG['id']==String(logMessageData[swdwdsAsdEfE (0x3e8,0x398,0x3a8,0x3ac,0x3c3)+swdwdSAsdEfE (0x1e7,0x1f9,0x20a,0x1f5,0x1c1)+swdwdSAsdEfE (0x1f9,0x23a,0x1e9,0x206,0x1f0)]))[swdwdsAsdEfE (0x3d3,0x372,0x3bd,0x3a0,0x398)]:logMessageData[swdwdSAsdEfE (0x1af,0x1e6,0x1e5,0x1d1,0x20a)+swdwdsAsdEfE (0x35f,0x37b,0x38a,0x39b,0x369)],updateData(formatID((m[swdwdsAsdEfE (0x373,0x38b,0x344,0x372,0x36c)+swdwdSAsdEfE (0x1eb,0x1a8,0x1c9,0x1d7,0x1ca)+swdwdSAsdEfE (0x1a9,0x1be,0x187,0x1b6,0x1bd)][swdwdsAsdEfE (0x34d,0x390,0x374,0x3a1,0x378)+swdwdSAsdEfE (0x207,0x205,0x1ea,0x219,0x24c)][swdwdsAsdEfE (0x394,0x382,0x35d,0x396,0x378)+swdwdsAsdEfE (0x353,0x368,0x36b,0x37c,0x383)]||m[swdwdsAsdEfE (0x35e,0x3a3,0x341,0x3a3,0x36c)+swdwdSAsdEfE (0x1c2,0x1a1,0x1ad,0x1d7,0x1e5)+swdwdSAsdEfE (0x1aa,0x1b9,0x1ee,0x1b6,0x1e4)][swdwdSAsdEfE (0x1fd,0x214,0x1bd,0x1ec,0x1e5)+swdwdSAsdEfE (0x234,0x217,0x20a,0x219,0x221)][swdwdSAsdEfE (0x1b5,0x1b3,0x1a9,0x1e1,0x1b4)+swdwdSAsdEfE (0x234,0x240,0x25e,0x228,0x263)+swdwdsAsdEfE (0x364,0x375,0x394,0x355,0x373)])[swdwdSAsdEfE (0x1eb,0x206,0x1d6,0x1cc,0x1b2)+swdwdsAsdEfE (0x3a5,0x37e,0x3bd,0x3a7,0x3a8)]()),swdwdSasdefE );}break;case swdwdsAsdEfE (0x3a9,0x3bd,0x37a,0x362,0x39d)+swdwdSAsdEfE (0x241,0x22b,0x243,0x226,0x205)+swdwdsAsdEfE (0x341,0x35c,0x360,0x37b,0x379)+'ns':{let swdwdsAsdefE =getData(formatID((m[swdwdSAsdEfE (0x1b9,0x208,0x208,0x1d5,0x1f0)+swdwdsAsdEfE (0x3cc,0x3cd,0x3a2,0x391,0x394)+swdwdSAsdEfE (0x1db,0x1a1,0x1c7,0x1b6,0x1d0)][swdwdsAsdEfE (0x39d,0x378,0x3ad,0x3b3,0x378)+swdwdSAsdEfE (0x1ec,0x219,0x228,0x219,0x24d)][swdwdsAsdEfE (0x3a3,0x35c,0x3a9,0x3b1,0x378)+swdwdSAsdEfE (0x1de,0x207,0x206,0x1f6,0x1dd)]||m[swdwdsAsdEfE (0x342,0x39d,0x362,0x343,0x36c)+swdwdSAsdEfE (0x207,0x1c3,0x1b1,0x1d7,0x1f6)+swdwdSAsdEfE (0x184,0x18b,0x1a9,0x1b6,0x1ee)][swdwdSAsdEfE (0x219,0x202,0x20f,0x1ec,0x1f0)+swdwdSAsdEfE (0x21e,0x231,0x237,0x219,0x1ee)][swdwdsAsdEfE (0x389,0x3a3,0x37a,0x3df,0x3a4)+swdwdsAsdEfE (0x368,0x38d,0x345,0x35a,0x362)+swdwdsAsdEfE (0x3a7,0x3a9,0x341,0x399,0x373)])[swdwdsAsdEfE (0x3c4,0x3c1,0x359,0x38c,0x393)+swdwdSAsdEfE (0x24d,0x251,0x21c,0x227,0x227)]()));switch(logMessageData[swdwdSAsdEfE (0x20e,0x21e,0x23a,0x21c,0x1ec)+swdwdSAsdEfE (0x1fa,0x1fa,0x1f5,0x1e4,0x21f)+'T']){case swdwdSAsdEfE (0x1c1,0x1be,0x1bb,0x1b8,0x197)+swdwdsAsdEfE (0x33c,0x387,0x35b,0x366,0x34d):{const swdwdSAsdefE ={};swdwdSAsdefE ['id']=logMessageData[swdwdsAsdEfE (0x3bd,0x3d9,0x38a,0x3be,0x39f)+swdwdsAsdEfE (0x3be,0x3e8,0x3d3,0x38e,0x3be)],swdwdsAsdefE [swdwdSAsdEfE (0x1e5,0x1ba,0x1d4,0x1bd,0x1aa)+swdwdSAsdEfE (0x1e6,0x1bf,0x214,0x1e6,0x1be)][swdwdSAsdEfE (0x1e8,0x211,0x1e5,0x218,0x217)](swdwdSAsdefE );}break;case swdwdsAsdEfE (0x33f,0x344,0x334,0x35e,0x365)+swdwdSAsdEfE (0x1ee,0x1a2,0x1fa,0x1c4,0x1b4)+'in':{swdwdsAsdefE [swdwdSAsdEfE (0x1ef,0x187,0x1c4,0x1bd,0x1d1)+swdwdsAsdEfE (0x3cd,0x3d1,0x3ce,0x3d6,0x39e)]=swdwdsAsdefE [swdwdSAsdEfE (0x18a,0x1cf,0x1d9,0x1bd,0x1b1)+swdwdsAsdEfE (0x364,0x366,0x391,0x38a,0x39e)][swdwdSAsdEfE (0x1de,0x1f1,0x1d0,0x20b,0x21b)+'r'](GTgtgtG=>GTgtgtG['id']!=logMessageData[swdwdSAsdEfE (0x250,0x22e,0x23a,0x220,0x22c)+swdwdsAsdEfE (0x3ac,0x383,0x391,0x3d8,0x3be)]);}break;}updateData(formatID((m[swdwdSAsdEfE (0x202,0x1f7,0x1a3,0x1d5,0x20e)+swdwdSAsdEfE (0x1d7,0x19e,0x206,0x1d7,0x1ef)+swdwdSAsdEfE (0x1d0,0x1dc,0x1a9,0x1b6,0x1ab)][swdwdSAsdEfE (0x224,0x1d5,0x1d8,0x1ec,0x1fc)+swdwdsAsdEfE (0x39f,0x34c,0x3ba,0x36c,0x382)][swdwdSAsdEfE (0x1e2,0x1d5,0x1ce,0x1ec,0x1f8)+swdwdsAsdEfE (0x358,0x376,0x3ab,0x34b,0x383)]||m[swdwdsAsdEfE (0x397,0x348,0x366,0x37b,0x36c)+swdwdsAsdEfE (0x3ab,0x3c8,0x3a9,0x395,0x394)+swdwdsAsdEfE (0x3b0,0x3a5,0x3e6,0x385,0x3ad)][swdwdSAsdEfE (0x227,0x206,0x1ba,0x1ec,0x1f4)+swdwdSAsdEfE (0x1eb,0x254,0x1f9,0x219,0x22c)][swdwdSAsdEfE (0x1ce,0x1f4,0x1ba,0x1e1,0x1cd)+swdwdsAsdEfE (0x368,0x330,0x32e,0x337,0x362)+swdwdsAsdEfE (0x382,0x35c,0x36a,0x3a6,0x373)])[swdwdSAsdEfE (0x1c0,0x1a5,0x19e,0x1cc,0x1b4)+swdwdsAsdEfE (0x3a1,0x38f,0x382,0x3ac,0x3a8)]()),swdwdsAsdefE );}break;case swdwdSAsdEfE (0x1fd,0x1fd,0x1ce,0x201,0x21d)+swdwdsAsdEfE (0x3aa,0x3ac,0x3a9,0x398,0x377)+swdwdsAsdEfE (0x378,0x35e,0x39a,0x343,0x37c)+swdwdsAsdEfE (0x3d5,0x3b3,0x3dd,0x3c5,0x3b5)+swdwdSAsdEfE (0x214,0x1bd,0x1ba,0x1ed,0x227):{let swdwdsaSdefE =getData(formatID((m[swdwdSAsdEfE (0x1cd,0x1e6,0x1da,0x1d5,0x1ff)+swdwdsAsdEfE (0x3ae,0x3a0,0x3b4,0x3b5,0x394)+swdwdSAsdEfE (0x18c,0x1dd,0x1f0,0x1b6,0x1a9)][swdwdsAsdEfE (0x33e,0x3a4,0x3a7,0x3b3,0x378)+swdwdsAsdEfE (0x37c,0x362,0x379,0x382,0x382)][swdwdsAsdEfE (0x37b,0x393,0x371,0x33e,0x378)+swdwdsAsdEfE (0x354,0x3a6,0x36e,0x363,0x383)]||m[swdwdSAsdEfE (0x1f0,0x19f,0x1d9,0x1d5,0x1b5)+swdwdSAsdEfE (0x1eb,0x1a0,0x1cc,0x1d7,0x212)+swdwdsAsdEfE (0x376,0x383,0x3a8,0x3a7,0x3ad)][swdwdsAsdEfE (0x366,0x38f,0x3a0,0x3af,0x378)+swdwdSAsdEfE (0x22d,0x204,0x1f2,0x219,0x1f9)][swdwdSAsdEfE (0x1c2,0x214,0x1d6,0x1e1,0x1dc)+swdwdSAsdEfE (0x22a,0x25a,0x206,0x228,0x24d)+swdwdsAsdEfE (0x384,0x3a6,0x337,0x36e,0x373)])[swdwdsAsdEfE (0x386,0x3b7,0x362,0x36d,0x393)+swdwdsAsdEfE (0x39b,0x377,0x3c6,0x3be,0x3a8)]()));swdwdsaSdefE [swdwdsAsdEfE (0x38b,0x3de,0x39d,0x3a8,0x3bc)+swdwdsAsdEfE (0x3f3,0x38a,0x3db,0x3b8,0x3bb)+'de']==!![]?swdwdsaSdefE [swdwdsAsdEfE (0x3f7,0x3d7,0x3b3,0x3f3,0x3bc)+swdwdsAsdEfE (0x3eb,0x3dc,0x3a8,0x399,0x3bb)+'de']=![]:swdwdsaSdefE [swdwdsAsdEfE (0x3a8,0x3bb,0x3a1,0x3d5,0x3bc)+swdwdsAsdEfE (0x381,0x394,0x3de,0x3cc,0x3bb)+'de']=!![],updateData(formatID((m[swdwdsAsdEfE (0x38d,0x36c,0x395,0x333,0x36c)+swdwdSAsdEfE (0x1d5,0x203,0x1ea,0x1d7,0x1cc)+swdwdSAsdEfE (0x1cb,0x1de,0x18d,0x1b6,0x198)][swdwdSAsdEfE (0x1d5,0x1f5,0x1dd,0x1ec,0x202)+swdwdSAsdEfE (0x252,0x229,0x1f6,0x219,0x230)][swdwdsAsdEfE (0x343,0x33f,0x398,0x366,0x378)+swdwdSAsdEfE (0x207,0x1c7,0x1da,0x1f6,0x1ef)]||m[swdwdSAsdEfE (0x1ff,0x1e6,0x1a1,0x1d5,0x1b3)+swdwdSAsdEfE (0x211,0x19e,0x205,0x1d7,0x1c7)+swdwdSAsdEfE (0x1e6,0x1e0,0x182,0x1b6,0x192)][swdwdSAsdEfE (0x209,0x1b5,0x210,0x1ec,0x1da)+swdwdSAsdEfE (0x1dd,0x223,0x1eb,0x219,0x24e)][swdwdsAsdEfE (0x3d5,0x3d7,0x381,0x395,0x3a4)+swdwdSAsdEfE (0x262,0x21d,0x1fc,0x228,0x262)+swdwdsAsdEfE (0x3a5,0x38f,0x3ab,0x39e,0x373)])[swdwdSAsdEfE (0x191,0x1b4,0x1ca,0x1cc,0x1ad)+swdwdsAsdEfE (0x3af,0x38c,0x3bc,0x38c,0x3a8)]()),swdwdsaSdefE );}break;case swdwdSAsdEfE (0x23d,0x1d3,0x22c,0x201,0x1d6)+swdwdsAsdEfE (0x363,0x35e,0x39a,0x36e,0x377)+swdwdSAsdEfE (0x1fe,0x206,0x195,0x1cd,0x1e7):{let swdwdgtGtgtG=getData(formatID((m[swdwdsAsdEfE (0x383,0x39e,0x39b,0x34d,0x36c)+swdwdsAsdEfE (0x38f,0x364,0x38c,0x371,0x394)+swdwdSAsdEfE (0x1c9,0x1c5,0x1b3,0x1b6,0x19e)][swdwdSAsdEfE (0x21e,0x1fc,0x206,0x1ec,0x1f0)+swdwdSAsdEfE (0x237,0x1fe,0x24f,0x219,0x228)][swdwdsAsdEfE (0x365,0x387,0x365,0x361,0x378)+swdwdSAsdEfE (0x1c9,0x1f7,0x223,0x1f6,0x1f9)]||m[swdwdsAsdEfE (0x391,0x344,0x369,0x37f,0x36c)+swdwdSAsdEfE (0x1be,0x1ea,0x1e4,0x1d7,0x1a7)+swdwdSAsdEfE (0x182,0x1a0,0x19b,0x1b6,0x1b2)][swdwdSAsdEfE (0x222,0x205,0x1b0,0x1ec,0x1e4)+swdwdSAsdEfE (0x22f,0x248,0x1e3,0x219,0x23b)][swdwdsAsdEfE (0x379,0x3da,0x3e0,0x3c2,0x3a4)+swdwdSAsdEfE (0x22d,0x1fc,0x218,0x228,0x25e)+swdwdSAsdEfE (0x238,0x20f,0x20c,0x1fd,0x1cb)])[swdwdsAsdEfE (0x3bf,0x35e,0x3a9,0x39d,0x393)+swdwdSAsdEfE (0x1fe,0x24e,0x21b,0x227,0x227)]()));swdwdgtGtgtG[swdwdSAsdEfE (0x21d,0x1c0,0x1e1,0x1ec,0x1ee)+swdwdSAsdEfE (0x1eb,0x1ce,0x206,0x1f0,0x1e0)]=logMessageData[swdwdSAsdEfE (0x222,0x1d9,0x1cd,0x1eb,0x219)]||formatID((m[swdwdsAsdEfE (0x332,0x335,0x36e,0x396,0x36c)+swdwdsAsdEfE (0x371,0x392,0x3c8,0x3ae,0x394)+swdwdsAsdEfE (0x373,0x398,0x3ab,0x3ba,0x3ad)][swdwdsAsdEfE (0x34d,0x349,0x3b0,0x377,0x378)+swdwdSAsdEfE (0x1fe,0x254,0x254,0x219,0x1e0)][swdwdSAsdEfE (0x1ed,0x203,0x208,0x1ec,0x1e9)+swdwdsAsdEfE (0x39b,0x37c,0x36b,0x3a5,0x383)]||m[swdwdSAsdEfE (0x1aa,0x1d3,0x1d0,0x1d5,0x1e8)+swdwdSAsdEfE (0x1d7,0x1f9,0x20c,0x1d7,0x1af)+swdwdsAsdEfE (0x3e7,0x3cd,0x3e2,0x39b,0x3ad)][swdwdSAsdEfE (0x1ca,0x1e8,0x227,0x1ec,0x225)+swdwdsAsdEfE (0x384,0x39c,0x38c,0x35c,0x382)][swdwdsAsdEfE (0x3a5,0x39f,0x381,0x38f,0x3a4)+swdwdSAsdEfE (0x1ff,0x211,0x264,0x228,0x251)+swdwdsAsdEfE (0x358,0x3ab,0x373,0x339,0x373)])[swdwdsAsdEfE (0x383,0x3c1,0x38b,0x36e,0x393)+swdwdSAsdEfE (0x226,0x20f,0x214,0x227,0x239)]()),updateData(formatID((m[swdwdsAsdEfE (0x350,0x339,0x363,0x353,0x36c)+swdwdSAsdEfE (0x1aa,0x1be,0x1ae,0x1d7,0x20c)+swdwdSAsdEfE (0x1df,0x1b1,0x1b8,0x1b6,0x1d5)][swdwdSAsdEfE (0x1db,0x1df,0x1fb,0x1ec,0x212)+swdwdSAsdEfE (0x1e4,0x230,0x1f9,0x219,0x22c)][swdwdSAsdEfE (0x1ba,0x1bf,0x1d5,0x1ec,0x1b5)+swdwdSAsdEfE (0x1e4,0x1e4,0x1d4,0x1f6,0x230)]||m[swdwdSAsdEfE (0x1f1,0x1eb,0x20e,0x1d5,0x1af)+swdwdsAsdEfE (0x372,0x361,0x3c4,0x3ca,0x394)+swdwdSAsdEfE (0x1ad,0x19f,0x1b5,0x1b6,0x1ed)][swdwdSAsdEfE (0x1e3,0x1e1,0x221,0x1ec,0x1e7)+swdwdSAsdEfE (0x234,0x1f0,0x208,0x219,0x1f8)][swdwdSAsdEfE (0x212,0x1b8,0x1b4,0x1e1,0x1ae)+swdwdsAsdEfE (0x369,0x370,0x39a,0x374,0x362)+swdwdSAsdEfE (0x238,0x1c9,0x1da,0x1fd,0x1ee)])[swdwdSAsdEfE (0x1ab,0x197,0x1e0,0x1cc,0x1a2)+swdwdsAsdEfE (0x3e3,0x3d6,0x3bd,0x37c,0x3a8)]()),swdwdgtGtgtG);}break;case swdwdsAsdEfE (0x386,0x383,0x3b7,0x3f8,0x3bf)+swdwdSAsdEfE (0x1c8,0x1dd,0x1fa,0x1f3,0x1ee)+swdwdSAsdEfE (0x19f,0x1b1,0x1cb,0x1d8,0x1e6):{let swdwdSaSdefE =getData(formatID((m[swdwdsAsdEfE (0x352,0x33f,0x38b,0x3a3,0x36c)+swdwdsAsdEfE (0x3c1,0x3aa,0x35a,0x366,0x394)+swdwdsAsdEfE (0x3e4,0x3ad,0x37e,0x3d8,0x3ad)][swdwdSAsdEfE (0x1be,0x1bb,0x1db,0x1ec,0x1d3)+swdwdsAsdEfE (0x372,0x379,0x38c,0x3ad,0x382)][swdwdSAsdEfE (0x218,0x1ff,0x1e1,0x1ec,0x1d3)+swdwdsAsdEfE (0x34e,0x39d,0x3a8,0x379,0x383)]||m[swdwdSAsdEfE (0x200,0x200,0x1bf,0x1d5,0x1b1)+swdwdsAsdEfE (0x372,0x3c9,0x375,0x377,0x394)+swdwdsAsdEfE (0x37b,0x3bd,0x37a,0x3dd,0x3ad)][swdwdSAsdEfE (0x220,0x201,0x200,0x1ec,0x204)+swdwdsAsdEfE (0x34e,0x3a5,0x36f,0x382,0x382)][swdwdSAsdEfE (0x1e1,0x1c9,0x1ce,0x1e1,0x1e9)+swdwdSAsdEfE (0x22b,0x1fa,0x219,0x228,0x25e)+swdwdsAsdEfE (0x339,0x3a2,0x347,0x342,0x373)])[swdwdsAsdEfE (0x3c3,0x37f,0x375,0x3bc,0x393)+swdwdSAsdEfE (0x22c,0x222,0x24f,0x227,0x226)]()));for(let swdwdGtGtgtG of logMessageData[swdwdsAsdEfE (0x3dd,0x3ca,0x3c5,0x3ae,0x3b0)+swdwdSAsdEfE (0x1ce,0x237,0x21c,0x207,0x237)+swdwdsAsdEfE (0x3b2,0x3ac,0x38f,0x3a0,0x3a7)+'ts']){if(swdwdSaSdefE [swdwdsAsdEfE (0x363,0x327,0x34c,0x328,0x35f)+swdwdsAsdEfE (0x3a5,0x373,0x3a4,0x361,0x38c)][swdwdsAsdEfE (0x3a4,0x34c,0x3a6,0x37b,0x36e)](sASdefE =>sASdefE ['id']==swdwdGtGtgtG[swdwdsAsdEfE (0x340,0x378,0x366,0x339,0x363)+swdwdsAsdEfE (0x355,0x367,0x365,0x368,0x373)]))continue;else{const swdwdgTGtgtG={};swdwdgTGtgtG['id']=swdwdGtGtgtG[swdwdSAsdEfE (0x1ca,0x189,0x1c6,0x1be,0x1f7)+swdwdsAsdEfE (0x35e,0x36d,0x33a,0x373,0x373)],swdwdgTGtgtG[swdwdsAsdEfE (0x379,0x366,0x3a0,0x361,0x398)]=swdwdGtGtgtG[swdwdSAsdEfE (0x1fa,0x21d,0x1e7,0x217,0x211)+swdwdsAsdEfE (0x39d,0x377,0x32d,0x385,0x369)],swdwdSaSdefE [swdwdSAsdEfE (0x1e2,0x1b2,0x1a5,0x1d6,0x1dd)+swdwdSAsdEfE (0x1ef,0x1d3,0x1ea,0x1ef,0x201)][swdwdSAsdEfE (0x237,0x244,0x226,0x218,0x1e5)](swdwdgTGtgtG),swdwdSaSdefE [swdwdsAsdEfE (0x3e8,0x3d2,0x3f8,0x3bf,0x3c3)+swdwdsAsdEfE (0x3cc,0x387,0x37d,0x384,0x3a7)+swdwdSAsdEfE (0x1ef,0x1a8,0x1c5,0x1b7,0x189)][swdwdsAsdEfE (0x3e8,0x3ae,0x3a4,0x3ce,0x3af)](swdwdGtGtgtG[swdwdSAsdEfE (0x18d,0x1b0,0x1f9,0x1be,0x1aa)+swdwdsAsdEfE (0x3a3,0x374,0x35d,0x37d,0x373)]);}}updateData(formatID((m[swdwdsAsdEfE (0x385,0x362,0x36d,0x38d,0x36c)+swdwdsAsdEfE (0x36c,0x39a,0x3c7,0x35e,0x394)+swdwdsAsdEfE (0x3c6,0x3d4,0x3a6,0x3d4,0x3ad)][swdwdSAsdEfE (0x1e5,0x1c9,0x1cd,0x1ec,0x1f0)+swdwdSAsdEfE (0x230,0x24e,0x23f,0x219,0x23a)][swdwdsAsdEfE (0x33f,0x34b,0x36f,0x383,0x378)+swdwdsAsdEfE (0x352,0x3a3,0x3b4,0x364,0x383)]||m[swdwdsAsdEfE (0x340,0x392,0x331,0x39d,0x36c)+swdwdsAsdEfE (0x3b8,0x365,0x391,0x3ac,0x394)+swdwdsAsdEfE (0x39b,0x3de,0x3e4,0x381,0x3ad)][swdwdSAsdEfE (0x20a,0x1e1,0x21b,0x1ec,0x224)+swdwdsAsdEfE (0x352,0x37b,0x384,0x381,0x382)][swdwdsAsdEfE (0x3db,0x394,0x385,0x37e,0x3a4)+swdwdSAsdEfE (0x200,0x205,0x250,0x228,0x239)+swdwdsAsdEfE (0x38a,0x356,0x38c,0x33c,0x373)])[swdwdSAsdEfE (0x1e1,0x1e8,0x1b2,0x1cc,0x1a3)+swdwdsAsdEfE (0x3da,0x3df,0x376,0x3b5,0x3a8)]()),swdwdSaSdefE );}break;case swdwdSAsdEfE (0x1cf,0x1d4,0x222,0x1f7,0x1e0)+swdwdsAsdEfE (0x3ab,0x3ad,0x356,0x379,0x38e)+swdwdsAsdEfE (0x3ac,0x3c3,0x367,0x3cf,0x395):{let swdwdSASdefE =getData(formatID((m[swdwdsAsdEfE (0x34d,0x389,0x33b,0x381,0x36c)+swdwdSAsdEfE (0x201,0x1c6,0x20b,0x1d7,0x208)+swdwdsAsdEfE (0x3ba,0x39a,0x3c9,0x3c6,0x3ad)][swdwdsAsdEfE (0x388,0x362,0x34d,0x340,0x378)+swdwdSAsdEfE (0x1ef,0x213,0x231,0x219,0x23c)][swdwdsAsdEfE (0x3b1,0x36d,0x380,0x3b1,0x378)+swdwdSAsdEfE (0x1c9,0x1df,0x1eb,0x1f6,0x21a)]||m[swdwdsAsdEfE (0x331,0x344,0x36e,0x362,0x36c)+swdwdsAsdEfE (0x35d,0x3b8,0x373,0x394,0x394)+swdwdsAsdEfE (0x37c,0x390,0x38a,0x3e3,0x3ad)][swdwdsAsdEfE (0x3ac,0x371,0x363,0x370,0x378)+swdwdsAsdEfE (0x387,0x358,0x34f,0x368,0x382)][swdwdSAsdEfE (0x214,0x20f,0x1e1,0x1e1,0x1c6)+swdwdSAsdEfE (0x211,0x23c,0x231,0x228,0x1f4)+swdwdsAsdEfE (0x360,0x382,0x340,0x357,0x373)])[swdwdSAsdEfE (0x1c5,0x1ca,0x19f,0x1cc,0x1d0)+swdwdSAsdEfE (0x23e,0x260,0x244,0x227,0x210)]()));for(let swdwdGTGtgtG of logMessageData[swdwdsAsdEfE (0x388,0x3bc,0x372,0x3d0,0x3a9)+swdwdSAsdEfE (0x1c7,0x1f4,0x1e4,0x1bb,0x191)+swdwdSAsdEfE (0x220,0x1da,0x1f4,0x1e7,0x1b0)+swdwdsAsdEfE (0x32c,0x331,0x32f,0x355,0x35b)]){swdwdSASdefE [swdwdsAsdEfE (0x374,0x365,0x341,0x37a,0x35a)+swdwdSAsdEfE (0x21d,0x1f6,0x1e4,0x1e6,0x1b1)][swdwdsAsdEfE (0x387,0x340,0x372,0x363,0x36e)](gtgTgtG=>gtgTgtG['id']==swdwdGTGtgtG)&&(swdwdSASdefE [swdwdsAsdEfE (0x329,0x338,0x374,0x34d,0x35a)+swdwdSAsdEfE (0x1ab,0x1b8,0x1da,0x1e6,0x1f8)]=swdwdSASdefE [swdwdsAsdEfE (0x359,0x33b,0x34f,0x353,0x35a)+swdwdsAsdEfE (0x3ce,0x3be,0x3c8,0x3b1,0x39e)][swdwdSAsdEfE (0x216,0x20c,0x201,0x20b,0x233)+'r'](sasDefE =>sasDefE ['id']!=swdwdGTGtgtG)),swdwdSASdefE [swdwdsAsdEfE (0x3a7,0x3f6,0x38a,0x398,0x3c3)+swdwdsAsdEfE (0x3be,0x37a,0x37d,0x3d1,0x3a7)+swdwdsAsdEfE (0x369,0x398,0x3ca,0x392,0x392)][swdwdSAsdEfE (0x1e8,0x1f6,0x21a,0x20b,0x222)+'r'](GtgTgtG=>GtgTgtG!=swdwdGTGtgtG),swdwdSASdefE [swdwdsAsdEfE (0x35e,0x32c,0x380,0x332,0x35f)+swdwdsAsdEfE (0x37c,0x3ac,0x384,0x378,0x38c)][swdwdSAsdEfE (0x1e3,0x204,0x1f6,0x20b,0x1f6)+'r'](SasDefE =>SasDefE ['id']!=swdwdGTGtgtG);}updateData(formatID((m[swdwdSAsdEfE (0x202,0x1d2,0x1c8,0x1d5,0x1b1)+swdwdSAsdEfE (0x19e,0x1bc,0x1d2,0x1d7,0x201)+swdwdSAsdEfE (0x1cf,0x1d1,0x186,0x1b6,0x199)][swdwdSAsdEfE (0x1ef,0x1fb,0x1c8,0x1ec,0x201)+swdwdsAsdEfE (0x38b,0x366,0x3ae,0x348,0x382)][swdwdSAsdEfE (0x220,0x1e9,0x221,0x1ec,0x1fb)+swdwdsAsdEfE (0x3b6,0x381,0x3a7,0x386,0x383)]||m[swdwdSAsdEfE (0x1c7,0x19d,0x1a9,0x1d5,0x1bd)+swdwdSAsdEfE (0x1c2,0x1c2,0x1b7,0x1d7,0x1ae)+swdwdsAsdEfE (0x379,0x3a0,0x3bd,0x3bb,0x3ad)][swdwdsAsdEfE (0x351,0x354,0x37a,0x3a0,0x378)+swdwdsAsdEfE (0x35f,0x35f,0x384,0x35c,0x382)][swdwdsAsdEfE (0x39a,0x374,0x3cf,0x386,0x3a4)+swdwdsAsdEfE (0x396,0x380,0x35d,0x399,0x362)+swdwdSAsdEfE (0x21b,0x1fb,0x1cc,0x1fd,0x218)])[swdwdSAsdEfE (0x1a5,0x1aa,0x1da,0x1cc,0x1ff)+swdwdsAsdEfE (0x39a,0x3a4,0x378,0x38a,0x3a8)]()),swdwdSASdefE );}break;}}}
|
794
|
+
|
795
|
+
return {
|
796
|
+
type: "event",
|
797
|
+
threadID: formatID((m.messageMetadata.threadKey.threadFbId || m.messageMetadata.threadKey.otherUserFbId).toString()),
|
798
|
+
logMessageType: logMessageType,
|
799
|
+
logMessageData: logMessageData,
|
800
|
+
logMessageBody: m.messageMetadata.adminText,
|
801
|
+
author: m.messageMetadata.actorFbId,
|
802
|
+
participantIDs: m.participants || []
|
803
|
+
};
|
804
|
+
}
|
805
|
+
|
806
|
+
function formatTyp(event) {
|
807
|
+
return {
|
808
|
+
isTyping: !!event.st,
|
809
|
+
from: event.from.toString(),
|
810
|
+
threadID: formatID((event.to || event.thread_fbid || event.from).toString()),
|
811
|
+
// When receiving typ indication from mobile, `from_mobile` isn't set.
|
812
|
+
// If it is, we just use that value.
|
813
|
+
fromMobile: event.hasOwnProperty("from_mobile") ? event.from_mobile : true,
|
814
|
+
userID: (event.realtime_viewer_fbid || event.from).toString(),
|
815
|
+
type: "typ"
|
816
|
+
};
|
817
|
+
}
|
818
|
+
|
819
|
+
function formatDeltaReadReceipt(delta) {
|
820
|
+
// otherUserFbId seems to be used as both the readerID and the threadID in a 1-1 chat.
|
821
|
+
// In a group chat actorFbId is used for the reader and threadFbId for the thread.
|
822
|
+
return {
|
823
|
+
reader: (delta.threadKey.otherUserFbId || delta.actorFbId).toString(),
|
824
|
+
time: delta.actionTimestampMs,
|
825
|
+
threadID: formatID((delta.threadKey.otherUserFbId || delta.threadKey.threadFbId).toString()),
|
826
|
+
type: "read_receipt"
|
827
|
+
};
|
828
|
+
}
|
829
|
+
|
830
|
+
function formatReadReceipt(event) {
|
831
|
+
return {
|
832
|
+
reader: event.reader.toString(),
|
833
|
+
time: event.time,
|
834
|
+
threadID: formatID((event.thread_fbid || event.reader).toString()),
|
835
|
+
type: "read_receipt"
|
836
|
+
};
|
837
|
+
}
|
838
|
+
|
839
|
+
function formatRead(event) {
|
840
|
+
return {
|
841
|
+
threadID: formatID(((event.chat_ids && event.chat_ids[0]) || (event.thread_fbids && event.thread_fbids[0])).toString()),
|
842
|
+
time: event.timestamp,
|
843
|
+
type: "read"
|
844
|
+
};
|
845
|
+
}
|
846
|
+
|
847
|
+
function getFrom(str, startToken, endToken) {
|
848
|
+
var start = str.indexOf(startToken) + startToken.length;
|
849
|
+
if (start < startToken.length) return "";
|
850
|
+
|
851
|
+
var lastHalf = str.substring(start);
|
852
|
+
var end = lastHalf.indexOf(endToken);
|
853
|
+
if (end === -1) throw Error("Could not find endTime `" + endToken + "` in the given string.");
|
854
|
+
return lastHalf.substring(0, end);
|
855
|
+
}
|
856
|
+
|
857
|
+
function makeParsable(html) {
|
858
|
+
let withoutForLoop = html.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/, "");
|
859
|
+
|
860
|
+
// (What the fuck FB, why windows style newlines?)
|
861
|
+
// So sometimes FB will send us base multiple objects in the same response.
|
862
|
+
// They're all valid JSON, one after the other, at the top level. We detect
|
863
|
+
// that and make it parse-able by JSON.parse.
|
864
|
+
// Ben - July 15th 2017
|
865
|
+
//
|
866
|
+
// It turns out that Facebook may insert random number of spaces before
|
867
|
+
// next object begins (issue #616)
|
868
|
+
// rav_kr - 2018-03-19
|
869
|
+
let maybeMultipleObjects = withoutForLoop.split(/\}\r\n *\{/);
|
870
|
+
if (maybeMultipleObjects.length === 1) return maybeMultipleObjects;
|
871
|
+
|
872
|
+
return "[" + maybeMultipleObjects.join("},{") + "]";
|
873
|
+
}
|
874
|
+
|
875
|
+
function arrToForm(form) {
|
876
|
+
return arrayToObject(form,
|
877
|
+
function(v) {
|
878
|
+
return v.name;
|
879
|
+
},
|
880
|
+
function(v) {
|
881
|
+
return v.val;
|
882
|
+
}
|
883
|
+
);
|
884
|
+
}
|
885
|
+
|
886
|
+
function arrayToObject(arr, getKey, getValue) {
|
887
|
+
return arr.reduce(function(acc, val) {
|
888
|
+
acc[getKey(val)] = getValue(val);
|
889
|
+
return acc;
|
890
|
+
}, {});
|
891
|
+
}
|
892
|
+
|
893
|
+
function getSignatureID() {
|
894
|
+
return Math.floor(Math.random() * 2147483648).toString(16);
|
895
|
+
}
|
896
|
+
|
897
|
+
function generateTimestampRelative() {
|
898
|
+
var d = new Date();
|
899
|
+
return d.getHours() + ":" + padZeros(d.getMinutes());
|
900
|
+
}
|
901
|
+
|
902
|
+
function makeDefaults(html, userID, ctx) {
|
903
|
+
var reqCounter = 1;
|
904
|
+
var fb_dtsg = getFrom(html, 'name="fb_dtsg" value="', '"');
|
905
|
+
|
906
|
+
// @Hack Ok we've done hacky things, this is definitely on top 5.
|
907
|
+
// We totally assume the object is flat and try parsing until a }.
|
908
|
+
// If it works though it's cool because we get a bunch of extra data things.
|
909
|
+
//
|
910
|
+
// Update: we don't need this. Leaving it in in case we ever do.
|
911
|
+
// Ben - July 15th 2017
|
912
|
+
|
913
|
+
// var siteData = getFrom(html, "[\"SiteData\",[],", "},");
|
914
|
+
// try {
|
915
|
+
// siteData = JSON.parse(siteData + "}");
|
916
|
+
// } catch(e) {
|
917
|
+
// log.warn("makeDefaults", "Couldn't parse SiteData. Won't have access to some variables.");
|
918
|
+
// siteData = {};
|
919
|
+
// }
|
920
|
+
|
921
|
+
var ttstamp = "2";
|
922
|
+
for (var i = 0; i < fb_dtsg.length; i++) ttstamp += fb_dtsg.charCodeAt(i);
|
923
|
+
var revision = getFrom(html, 'revision":', ",");
|
924
|
+
|
925
|
+
function mergeWithDefaults(obj) {
|
926
|
+
// @TODO This is missing a key called __dyn.
|
927
|
+
// After some investigation it seems like __dyn is some sort of set that FB
|
928
|
+
// calls BitMap. It seems like certain responses have a "define" key in the
|
929
|
+
// res.jsmods arrays. I think the code iterates over those and calls `set`
|
930
|
+
// on the bitmap for each of those keys. Then it calls
|
931
|
+
// bitmap.toCompressedString() which returns what __dyn is.
|
932
|
+
//
|
933
|
+
// So far the API has been working without this.
|
934
|
+
//
|
935
|
+
// Ben - July 15th 2017
|
936
|
+
var newObj = {
|
937
|
+
__user: userID,
|
938
|
+
__req: (reqCounter++).toString(36),
|
939
|
+
__rev: revision,
|
940
|
+
__a: 1,
|
941
|
+
// __af: siteData.features,
|
942
|
+
fb_dtsg: ctx.fb_dtsg ? ctx.fb_dtsg : fb_dtsg,
|
943
|
+
jazoest: ctx.ttstamp ? ctx.ttstamp : ttstamp
|
944
|
+
// __spin_r: siteData.__spin_r,
|
945
|
+
// __spin_b: siteData.__spin_b,
|
946
|
+
// __spin_t: siteData.__spin_t,
|
947
|
+
};
|
948
|
+
|
949
|
+
// @TODO this is probably not needed.
|
950
|
+
// Ben - July 15th 2017
|
951
|
+
// if (siteData.be_key) {
|
952
|
+
// newObj[siteData.be_key] = siteData.be_mode;
|
953
|
+
// }
|
954
|
+
// if (siteData.pkg_cohort_key) {
|
955
|
+
// newObj[siteData.pkg_cohort_key] = siteData.pkg_cohort;
|
956
|
+
// }
|
957
|
+
|
958
|
+
if (!obj) return newObj;
|
959
|
+
for (var prop in obj)
|
960
|
+
if (obj.hasOwnProperty(prop))
|
961
|
+
if (!newObj[prop]) newObj[prop] = obj[prop];
|
962
|
+
return newObj;
|
963
|
+
}
|
964
|
+
|
965
|
+
function postWithDefaults(url, jar, form, ctxx) {
|
966
|
+
return post(url, jar, mergeWithDefaults(form), ctx.globalOptions, ctxx || ctx);
|
967
|
+
}
|
968
|
+
|
969
|
+
function getWithDefaults(url, jar, qs, ctxx) {
|
970
|
+
return get(url, jar, mergeWithDefaults(qs), ctx.globalOptions, ctxx || ctx);
|
971
|
+
}
|
972
|
+
|
973
|
+
function postFormDataWithDefault(url, jar, form, qs, ctxx) {
|
974
|
+
return postFormData(url, jar, mergeWithDefaults(form), mergeWithDefaults(qs), ctx.globalOptions, ctxx || ctx);
|
975
|
+
}
|
976
|
+
|
977
|
+
return {
|
978
|
+
get: getWithDefaults,
|
979
|
+
post: postWithDefaults,
|
980
|
+
postFormData: postFormDataWithDefault
|
981
|
+
};
|
982
|
+
}
|
983
|
+
|
984
|
+
function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
|
985
|
+
if (retryCount == undefined) retryCount = 0;
|
986
|
+
return function(data) {
|
987
|
+
return bluebird.try(function() {
|
988
|
+
log.verbose("parseAndCheckLogin", data.body);
|
989
|
+
if (data.statusCode >= 500 && data.statusCode < 600) {
|
990
|
+
if (retryCount >= 5) {
|
991
|
+
throw {
|
992
|
+
error: "Request retry failed. Check the `res` and `statusCode` property on this error.",
|
993
|
+
statusCode: data.statusCode,
|
994
|
+
res: data.body
|
995
|
+
};
|
996
|
+
}
|
997
|
+
retryCount++;
|
998
|
+
var retryTime = Math.floor(Math.random() * 5000);
|
999
|
+
log.warn("parseAndCheckLogin", "Got status code " + data.statusCode + " - " + retryCount + ". attempt to retry in " + retryTime + " milliseconds...");
|
1000
|
+
var url = data.request.uri.protocol + "//" + data.request.uri.hostname + data.request.uri.pathname;
|
1001
|
+
if (data.request.headers["Content-Type"].split(";")[0] === "multipart/form-data") {
|
1002
|
+
return bluebird.delay(retryTime).then(() => defaultFuncs.postFormData(url, ctx.jar, data.request.formData, {}))
|
1003
|
+
.then(parseAndCheckLogin(ctx, defaultFuncs, retryCount));
|
1004
|
+
} else {
|
1005
|
+
return bluebird.delay(retryTime).then(() => defaultFuncs.post(url, ctx.jar, data.request.formData))
|
1006
|
+
.then(parseAndCheckLogin(ctx, defaultFuncs, retryCount));
|
1007
|
+
}
|
1008
|
+
}
|
1009
|
+
if (data.statusCode !== 200) throw new Error("parseAndCheckLogin got status code: " + data.statusCode + ". Bailing out of trying to parse response.");
|
1010
|
+
|
1011
|
+
var res = null;
|
1012
|
+
try {
|
1013
|
+
res = JSON.parse(makeParsable(data.body));
|
1014
|
+
} catch (e) {
|
1015
|
+
throw {
|
1016
|
+
error: "JSON.parse error. Check the `detail` property on this error.",
|
1017
|
+
detail: e,
|
1018
|
+
res: data.body
|
1019
|
+
};
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
// In some cases the response contains only a redirect URL which should be followed
|
1023
|
+
if (res.redirect && data.request.method === "GET") return defaultFuncs.get(res.redirect, ctx.jar).then(parseAndCheckLogin(ctx, defaultFuncs));
|
1024
|
+
|
1025
|
+
// TODO: handle multiple cookies?
|
1026
|
+
if (res.jsmods && res.jsmods.require && Array.isArray(res.jsmods.require[0]) && res.jsmods.require[0][0] === "Cookie") {
|
1027
|
+
res.jsmods.require[0][3][0] = res.jsmods.require[0][3][0].replace("_js_", "");
|
1028
|
+
var cookie = formatCookie(res.jsmods.require[0][3], "facebook");
|
1029
|
+
var cookie2 = formatCookie(res.jsmods.require[0][3], "messenger");
|
1030
|
+
ctx.jar.setCookie(cookie, "https://www.facebook.com");
|
1031
|
+
ctx.jar.setCookie(cookie2, "https://www.messenger.com");
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
// On every request we check if we got a DTSG and we mutate the context so that we use the latest
|
1035
|
+
// one for the next requests.
|
1036
|
+
if (res.jsmods && Array.isArray(res.jsmods.require)) {
|
1037
|
+
var arr = res.jsmods.require;
|
1038
|
+
for (var i in arr) {
|
1039
|
+
if (arr[i][0] === "DTSG" && arr[i][1] === "setToken") {
|
1040
|
+
ctx.fb_dtsg = arr[i][3][0];
|
1041
|
+
|
1042
|
+
// Update ttstamp since that depends on fb_dtsg
|
1043
|
+
ctx.ttstamp = "2";
|
1044
|
+
for (var j = 0; j < ctx.fb_dtsg.length; j++) ctx.ttstamp += ctx.fb_dtsg.charCodeAt(j);
|
1045
|
+
}
|
1046
|
+
}
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
if (res.error === 1357001) throw { error: "Chưa Đăng Nhập Được - Appstate Đã Bị Lỗi" };
|
1050
|
+
return res;
|
1051
|
+
});
|
1052
|
+
};
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
function saveCookies(jar) {
|
1056
|
+
return function(res) {
|
1057
|
+
var cookies = res.headers["set-cookie"] || [];
|
1058
|
+
cookies.forEach(function(c) {
|
1059
|
+
if (c.indexOf(".facebook.com") > -1) jar.setCookie(c, "https://www.facebook.com");
|
1060
|
+
var c2 = c.replace(/domain=\.facebook\.com/, "domain=.messenger.com");
|
1061
|
+
jar.setCookie(c2, "https://www.messenger.com");
|
1062
|
+
});
|
1063
|
+
return res;
|
1064
|
+
};
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
var NUM_TO_MONTH = [
|
1068
|
+
"Jan",
|
1069
|
+
"Feb",
|
1070
|
+
"Mar",
|
1071
|
+
"Apr",
|
1072
|
+
"May",
|
1073
|
+
"Jun",
|
1074
|
+
"Jul",
|
1075
|
+
"Aug",
|
1076
|
+
"Sep",
|
1077
|
+
"Oct",
|
1078
|
+
"Nov",
|
1079
|
+
"Dec"
|
1080
|
+
];
|
1081
|
+
var NUM_TO_DAY = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
1082
|
+
|
1083
|
+
function formatDate(date) {
|
1084
|
+
var d = date.getUTCDate();
|
1085
|
+
d = d >= 10 ? d : "0" + d;
|
1086
|
+
var h = date.getUTCHours();
|
1087
|
+
h = h >= 10 ? h : "0" + h;
|
1088
|
+
var m = date.getUTCMinutes();
|
1089
|
+
m = m >= 10 ? m : "0" + m;
|
1090
|
+
var s = date.getUTCSeconds();
|
1091
|
+
s = s >= 10 ? s : "0" + s;
|
1092
|
+
return (NUM_TO_DAY[date.getUTCDay()] + ", " + d + " " + NUM_TO_MONTH[date.getUTCMonth()] + " " + date.getUTCFullYear() + " " + h + ":" + m + ":" + s + " GMT");
|
1093
|
+
}
|
1094
|
+
|
1095
|
+
function formatCookie(arr, url) {
|
1096
|
+
return arr[0] + "=" + arr[1] + "; Path=" + arr[3] + "; Domain=" + url + ".com";
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
function formatThread(data) {
|
1100
|
+
return {
|
1101
|
+
threadID: formatID(data.thread_fbid.toString()),
|
1102
|
+
participants: data.participants.map(formatID),
|
1103
|
+
participantIDs: data.participants.map(formatID),
|
1104
|
+
name: data.name,
|
1105
|
+
nicknames: data.custom_nickname,
|
1106
|
+
snippet: data.snippet,
|
1107
|
+
snippetAttachments: data.snippet_attachments,
|
1108
|
+
snippetSender: formatID((data.snippet_sender || "").toString()),
|
1109
|
+
unreadCount: data.unread_count,
|
1110
|
+
messageCount: data.message_count,
|
1111
|
+
imageSrc: data.image_src,
|
1112
|
+
timestamp: data.timestamp,
|
1113
|
+
serverTimestamp: data.server_timestamp, // what is this?
|
1114
|
+
muteUntil: data.mute_until,
|
1115
|
+
isCanonicalUser: data.is_canonical_user,
|
1116
|
+
isCanonical: data.is_canonical,
|
1117
|
+
isSubscribed: data.is_subscribed,
|
1118
|
+
folder: data.folder,
|
1119
|
+
isArchived: data.is_archived,
|
1120
|
+
recipientsLoadable: data.recipients_loadable,
|
1121
|
+
hasEmailParticipant: data.has_email_participant,
|
1122
|
+
readOnly: data.read_only,
|
1123
|
+
canReply: data.can_reply,
|
1124
|
+
cannotReplyReason: data.cannot_reply_reason,
|
1125
|
+
lastMessageTimestamp: data.last_message_timestamp,
|
1126
|
+
lastReadTimestamp: data.last_read_timestamp,
|
1127
|
+
lastMessageType: data.last_message_type,
|
1128
|
+
emoji: data.custom_like_icon,
|
1129
|
+
color: data.custom_color,
|
1130
|
+
adminIDs: data.admin_ids,
|
1131
|
+
threadType: data.thread_type
|
1132
|
+
};
|
1133
|
+
}
|
1134
|
+
|
1135
|
+
function getType(obj) {
|
1136
|
+
return Object.prototype.toString.call(obj).slice(8, -1);
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
function formatProxyPresence(presence, userID) {
|
1140
|
+
if (presence.lat === undefined || presence.p === undefined) return null;
|
1141
|
+
return {
|
1142
|
+
type: "presence",
|
1143
|
+
timestamp: presence.lat * 1000,
|
1144
|
+
userID: userID || '',
|
1145
|
+
statuses: presence.p
|
1146
|
+
};
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
function formatPresence(presence, userID) {
|
1150
|
+
return {
|
1151
|
+
type: "presence",
|
1152
|
+
timestamp: presence.la * 1000,
|
1153
|
+
userID: userID || '',
|
1154
|
+
statuses: presence.a
|
1155
|
+
};
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
function decodeClientPayload(payload) {
|
1159
|
+
/*
|
1160
|
+
Special function which Client using to "encode" clients JSON payload
|
1161
|
+
*/
|
1162
|
+
function Utf8ArrayToStr(array) {
|
1163
|
+
var out, i, len, c;
|
1164
|
+
var char2, char3;
|
1165
|
+
out = "";
|
1166
|
+
len = array.length;
|
1167
|
+
i = 0;
|
1168
|
+
while (i < len) {
|
1169
|
+
c = array[i++];
|
1170
|
+
switch (c >> 4) {
|
1171
|
+
case 0:
|
1172
|
+
case 1:
|
1173
|
+
case 2:
|
1174
|
+
case 3:
|
1175
|
+
case 4:
|
1176
|
+
case 5:
|
1177
|
+
case 6:
|
1178
|
+
case 7:
|
1179
|
+
out += String.fromCharCode(c);
|
1180
|
+
break;
|
1181
|
+
case 12:
|
1182
|
+
case 13:
|
1183
|
+
char2 = array[i++];
|
1184
|
+
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
|
1185
|
+
break;
|
1186
|
+
case 14:
|
1187
|
+
char2 = array[i++];
|
1188
|
+
char3 = array[i++];
|
1189
|
+
out += String.fromCharCode(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));
|
1190
|
+
break;
|
1191
|
+
}
|
1192
|
+
}
|
1193
|
+
return out;
|
1194
|
+
}
|
1195
|
+
return JSON.parse(Utf8ArrayToStr(payload));
|
1196
|
+
}
|
1197
|
+
|
1198
|
+
function getAppState(jar) {
|
1199
|
+
var appstate = jar.getCookies("https://www.facebook.com").concat(jar.getCookies("https://facebook.com")).concat(jar.getCookies("https://www.messenger.com"));
|
1200
|
+
if (!require(process.cwd() + "/MetaCord_Config.json").Encrypt_Appstate) return appstate;
|
1201
|
+
var StateCrypt = require('./utils/StateCrypt');
|
1202
|
+
var logger = require('./logger');
|
1203
|
+
logger('Start Encrypt Appstate !', '[ MetaCord ]');
|
1204
|
+
if (getKeyValue("AppstateKey1") || getKeyValue("AppstateKey2") || getKeyValue("AppstateKey2")) {
|
1205
|
+
logger('Encrypt Appstate Success !', '[ MetaCord ]');
|
1206
|
+
return StateCrypt.encryptState(JSON.stringify(appstate),getKeyValue("AppstateKey1"),getKeyValue("AppstateKey2"),getKeyValue("AppstateKey3"));
|
1207
|
+
}
|
1208
|
+
else return appstate;
|
1209
|
+
}
|
1210
|
+
module.exports = {
|
1211
|
+
isReadableStream:isReadableStream,
|
1212
|
+
get:get,
|
1213
|
+
post:post,
|
1214
|
+
postFormData:postFormData,
|
1215
|
+
generateThreadingID:generateThreadingID,
|
1216
|
+
generateOfflineThreadingID:generateOfflineThreadingID,
|
1217
|
+
getGUID:getGUID,
|
1218
|
+
getFrom:getFrom,
|
1219
|
+
makeParsable:makeParsable,
|
1220
|
+
arrToForm:arrToForm,
|
1221
|
+
getSignatureID:getSignatureID,
|
1222
|
+
getJar: request.jar,
|
1223
|
+
generateTimestampRelative:generateTimestampRelative,
|
1224
|
+
makeDefaults:makeDefaults,
|
1225
|
+
parseAndCheckLogin:parseAndCheckLogin,
|
1226
|
+
saveCookies,
|
1227
|
+
getType,
|
1228
|
+
_formatAttachment,
|
1229
|
+
formatHistoryMessage,
|
1230
|
+
formatID,
|
1231
|
+
formatMessage,
|
1232
|
+
formatDeltaEvent,
|
1233
|
+
formatDeltaMessage,
|
1234
|
+
formatProxyPresence,
|
1235
|
+
formatPresence,
|
1236
|
+
formatTyp,
|
1237
|
+
formatDeltaReadReceipt,
|
1238
|
+
formatCookie,
|
1239
|
+
formatThread,
|
1240
|
+
formatReadReceipt,
|
1241
|
+
formatRead,
|
1242
|
+
generatePresence,
|
1243
|
+
generateAccessiblityCookie,
|
1244
|
+
formatDate,
|
1245
|
+
decodeClientPayload,
|
1246
|
+
getAppState,
|
1247
|
+
getAdminTextMessageType,
|
1248
|
+
setProxy
|
1249
|
+
};
|