@dongdev/fca-unofficial 3.0.25 → 3.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +2 -0
- package/CHANGELOG.md +196 -190
- package/DOCS.md +3 -6
- package/Fca_Database/database.sqlite +0 -0
- package/LICENSE-MIT +1 -1
- package/README.md +1 -1
- package/index.d.ts +745 -746
- package/module/config.js +29 -33
- package/module/login.js +133 -136
- package/module/loginHelper.js +1240 -1048
- package/module/options.js +44 -45
- package/package.json +81 -82
- package/src/api/messaging/changeAdminStatus.js +56 -56
- package/src/api/messaging/changeGroupImage.js +2 -1
- package/src/api/messaging/changeThreadEmoji.js +47 -47
- package/src/api/messaging/createPoll.js +25 -25
- package/src/api/messaging/deleteMessage.js +110 -30
- package/src/api/messaging/forwardAttachment.js +28 -28
- package/src/api/messaging/removeUserFromGroup.js +28 -73
- package/src/api/messaging/sendMessage.js +15 -17
- package/src/api/messaging/sendTypingIndicator.js +23 -23
- package/src/api/messaging/setMessageReaction.js +57 -60
- package/src/api/messaging/setTitle.js +47 -47
- package/src/api/messaging/uploadAttachment.js +471 -73
- package/src/api/socket/core/connectMqtt.js +250 -250
- package/src/api/socket/core/emitAuth.js +1 -1
- package/src/api/socket/core/getSeqID.js +322 -40
- package/src/api/socket/core/parseDelta.js +368 -377
- package/src/api/socket/listenMqtt.js +371 -360
- package/src/utils/client.js +2 -312
- package/src/utils/cookies.js +68 -0
- package/src/utils/format.js +117 -90
- package/src/utils/loginParser.js +347 -0
- package/src/utils/messageFormat.js +1173 -0
- package/src/api/socket/core/markDelivery.js +0 -12
package/src/utils/format.js
CHANGED
|
@@ -41,10 +41,8 @@ var j = {
|
|
|
41
41
|
V: "%2c%22blc%22%3a0%2c%22snd%22%3a0%2c%22ct%22%3a",
|
|
42
42
|
W: "%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a",
|
|
43
43
|
X: "%2c%22ri%22%3a0%7d%2c%22state%22%3a%7b%22p%22%3a0%2c%22ut%22%3a1",
|
|
44
|
-
Y:
|
|
45
|
-
|
|
46
|
-
Z:
|
|
47
|
-
"%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"
|
|
44
|
+
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",
|
|
45
|
+
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",
|
|
48
46
|
};
|
|
49
47
|
(function () {
|
|
50
48
|
var l = [];
|
|
@@ -119,7 +117,8 @@ function formatDeltaEvent(m) {
|
|
|
119
117
|
coordinates:
|
|
120
118
|
m.attachments[0].mercury.extensible_attachment.story_attachment.target
|
|
121
119
|
.coordinate,
|
|
122
|
-
url: m.attachments[0].mercury.extensible_attachment.story_attachment
|
|
120
|
+
url: m.attachments[0].mercury.extensible_attachment.story_attachment
|
|
121
|
+
.url,
|
|
123
122
|
};
|
|
124
123
|
}
|
|
125
124
|
case "ApprovalQueue":
|
|
@@ -129,8 +128,8 @@ function formatDeltaEvent(m) {
|
|
|
129
128
|
action: m.action,
|
|
130
129
|
recipientFbId: m.recipientFbId,
|
|
131
130
|
requestSource: m.requestSource,
|
|
132
|
-
...m.messageMetadata
|
|
133
|
-
}
|
|
131
|
+
...m.messageMetadata,
|
|
132
|
+
},
|
|
134
133
|
};
|
|
135
134
|
}
|
|
136
135
|
return {
|
|
@@ -139,17 +138,16 @@ function formatDeltaEvent(m) {
|
|
|
139
138
|
(
|
|
140
139
|
m.messageMetadata.threadKey.threadFbId ||
|
|
141
140
|
m.messageMetadata.threadKey.otherUserFbId
|
|
142
|
-
).toString()
|
|
141
|
+
).toString(),
|
|
143
142
|
),
|
|
144
143
|
logMessageType: logMessageType,
|
|
145
144
|
logMessageData: logMessageData,
|
|
146
145
|
logMessageBody: m.messageMetadata.adminText,
|
|
147
146
|
author: m.messageMetadata.actorFbId,
|
|
148
|
-
participantIDs: (m?.participants || []).map(e => e.toString())
|
|
147
|
+
participantIDs: (m?.participants || []).map((e) => e.toString()),
|
|
149
148
|
};
|
|
150
149
|
}
|
|
151
150
|
|
|
152
|
-
|
|
153
151
|
function _formatAttachment(attachment1, attachment2) {
|
|
154
152
|
attachment2 = attachment2 || { id: "", image_data: {} };
|
|
155
153
|
attachment1 = attachment1.mercury ? attachment1.mercury : attachment1;
|
|
@@ -165,13 +163,25 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
165
163
|
attachment1.extensible_attachment.story_attachment.target &&
|
|
166
164
|
attachment1.extensible_attachment.story_attachment.target.__typename &&
|
|
167
165
|
attachment1.extensible_attachment.story_attachment.target.__typename ===
|
|
168
|
-
|
|
166
|
+
"MessageLocation"
|
|
169
167
|
)
|
|
170
168
|
type = "MessageLocation";
|
|
171
169
|
else type = "ExtensibleAttachment";
|
|
172
170
|
|
|
173
171
|
blob = attachment1.extensible_attachment;
|
|
174
172
|
}
|
|
173
|
+
|
|
174
|
+
// Add logic to extract Src or ThumbnailSrc from Payload.RealMetadata
|
|
175
|
+
if (blob && blob.real_metadata) {
|
|
176
|
+
const realMetadata = blob.real_metadata;
|
|
177
|
+
if (realMetadata.Src) {
|
|
178
|
+
attachment2.src = realMetadata.Src;
|
|
179
|
+
}
|
|
180
|
+
if (realMetadata.ThumbnailSrc) {
|
|
181
|
+
attachment2.thumbnailSrc = realMetadata.ThumbnailSrc;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
175
185
|
switch (type) {
|
|
176
186
|
case "sticker":
|
|
177
187
|
return {
|
|
@@ -195,7 +205,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
195
205
|
|
|
196
206
|
stickerID: attachment1.metadata.stickerID.toString(), // @Legacy
|
|
197
207
|
spriteURI: attachment1.metadata.spriteURI, // @Legacy
|
|
198
|
-
spriteURI2x: attachment1.metadata.spriteURI2x // @Legacy
|
|
208
|
+
spriteURI2x: attachment1.metadata.spriteURI2x, // @Legacy
|
|
199
209
|
};
|
|
200
210
|
case "file":
|
|
201
211
|
return {
|
|
@@ -209,7 +219,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
209
219
|
|
|
210
220
|
name: attachment1.name, // @Legacy
|
|
211
221
|
mimeType: attachment2.mime_type, // @Legacy
|
|
212
|
-
fileSize: attachment2.file_size // @Legacy
|
|
222
|
+
fileSize: attachment2.file_size, // @Legacy
|
|
213
223
|
};
|
|
214
224
|
case "photo":
|
|
215
225
|
return {
|
|
@@ -229,7 +239,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
229
239
|
url: attachment1.metadata.url, // @Legacy
|
|
230
240
|
width: attachment1.metadata.dimensions.split(",")[0], // @Legacy
|
|
231
241
|
height: attachment1.metadata.dimensions.split(",")[1], // @Legacy
|
|
232
|
-
name: attachment1.fileName // @Legacy
|
|
242
|
+
name: attachment1.fileName, // @Legacy
|
|
233
243
|
};
|
|
234
244
|
case "animated_image":
|
|
235
245
|
return {
|
|
@@ -254,7 +264,8 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
254
264
|
animatedGifUrl: attachment2.image_data.animated_gif_url, // @Legacy
|
|
255
265
|
animatedGifPreviewUrl: attachment2.image_data.animated_gif_preview_url, // @Legacy
|
|
256
266
|
animatedWebpUrl: attachment2.image_data.animated_webp_url, // @Legacy
|
|
257
|
-
animatedWebpPreviewUrl:
|
|
267
|
+
animatedWebpPreviewUrl:
|
|
268
|
+
attachment2.image_data.animated_webp_preview_url, // @Legacy
|
|
258
269
|
};
|
|
259
270
|
case "share":
|
|
260
271
|
return {
|
|
@@ -278,7 +289,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
278
289
|
animatedImageSize: attachment1.share.media.animated_image_size, // @Legacy
|
|
279
290
|
facebookUrl: attachment1.share.uri, // @Legacy
|
|
280
291
|
target: attachment1.share.target, // @Legacy
|
|
281
|
-
styleList: attachment1.share.style_list // @Legacy
|
|
292
|
+
styleList: attachment1.share.style_list, // @Legacy
|
|
282
293
|
};
|
|
283
294
|
case "video":
|
|
284
295
|
return {
|
|
@@ -297,13 +308,13 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
297
308
|
duration: attachment1.metadata.duration,
|
|
298
309
|
videoType: "unknown",
|
|
299
310
|
|
|
300
|
-
thumbnailUrl: attachment1.thumbnail_url // @Legacy
|
|
311
|
+
thumbnailUrl: attachment1.thumbnail_url, // @Legacy
|
|
301
312
|
};
|
|
302
313
|
case "error":
|
|
303
314
|
return {
|
|
304
315
|
type: "error",
|
|
305
316
|
attachment1: attachment1,
|
|
306
|
-
attachment2: attachment2
|
|
317
|
+
attachment2: attachment2,
|
|
307
318
|
};
|
|
308
319
|
case "MessageImage":
|
|
309
320
|
return {
|
|
@@ -323,7 +334,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
323
334
|
url: blob.large_preview.uri, // @Legacy
|
|
324
335
|
width: blob.original_dimensions.x, // @Legacy
|
|
325
336
|
height: blob.original_dimensions.y, // @Legacy
|
|
326
|
-
name: blob.filename // @Legacy
|
|
337
|
+
name: blob.filename, // @Legacy
|
|
327
338
|
};
|
|
328
339
|
case "MessageAnimatedImage":
|
|
329
340
|
return {
|
|
@@ -346,7 +357,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
346
357
|
animatedGifUrl: blob.animated_image.uri, // @Legacy
|
|
347
358
|
animatedGifPreviewUrl: blob.preview_image.uri, // @Legacy
|
|
348
359
|
animatedWebpUrl: blob.animated_image.uri, // @Legacy
|
|
349
|
-
animatedWebpPreviewUrl: blob.preview_image.uri // @Legacy
|
|
360
|
+
animatedWebpPreviewUrl: blob.preview_image.uri, // @Legacy
|
|
350
361
|
};
|
|
351
362
|
case "MessageVideo":
|
|
352
363
|
return {
|
|
@@ -365,7 +376,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
365
376
|
duration: blob.playable_duration_in_ms,
|
|
366
377
|
videoType: blob.video_type.toLowerCase(),
|
|
367
378
|
|
|
368
|
-
thumbnailUrl: blob.large_image.uri // @Legacy
|
|
379
|
+
thumbnailUrl: blob.large_image.uri, // @Legacy
|
|
369
380
|
};
|
|
370
381
|
case "MessageAudio":
|
|
371
382
|
return {
|
|
@@ -377,7 +388,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
377
388
|
duration: blob.playable_duration_in_ms,
|
|
378
389
|
url: blob.playable_url,
|
|
379
390
|
|
|
380
|
-
isVoiceMail: blob.is_voicemail
|
|
391
|
+
isVoiceMail: blob.is_voicemail,
|
|
381
392
|
};
|
|
382
393
|
case "StickerAttachment":
|
|
383
394
|
return {
|
|
@@ -401,7 +412,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
401
412
|
|
|
402
413
|
stickerID: blob.id, // @Legacy
|
|
403
414
|
spriteURI: blob.sprite_image, // @Legacy
|
|
404
|
-
spriteURI2x: blob.sprite_image_2x // @Legacy
|
|
415
|
+
spriteURI2x: blob.sprite_image_2x, // @Legacy
|
|
405
416
|
};
|
|
406
417
|
case "MessageLocation":
|
|
407
418
|
var urlAttach = blob.story_attachment.url;
|
|
@@ -444,7 +455,7 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
444
455
|
|
|
445
456
|
facebookUrl: blob.story_attachment.url, // @Legacy
|
|
446
457
|
target: blob.story_attachment.target, // @Legacy
|
|
447
|
-
styleList: blob.story_attachment.style_list // @Legacy
|
|
458
|
+
styleList: blob.story_attachment.style_list, // @Legacy
|
|
448
459
|
};
|
|
449
460
|
case "ExtensibleAttachment":
|
|
450
461
|
return {
|
|
@@ -486,16 +497,15 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
486
497
|
subattachments: blob.story_attachment.subattachments,
|
|
487
498
|
properties: blob.story_attachment.properties.reduce(function (
|
|
488
499
|
/** @type {{ [x: string]: any; }} */ obj,
|
|
489
|
-
/** @type {{ key: string | number; value: { text: any; }; }} */ cur
|
|
500
|
+
/** @type {{ key: string | number; value: { text: any; }; }} */ cur,
|
|
490
501
|
) {
|
|
491
502
|
obj[cur.key] = cur.value.text;
|
|
492
503
|
return obj;
|
|
493
|
-
},
|
|
494
|
-
{}),
|
|
504
|
+
}, {}),
|
|
495
505
|
|
|
496
506
|
facebookUrl: blob.story_attachment.url, // @Legacy
|
|
497
507
|
target: blob.story_attachment.target, // @Legacy
|
|
498
|
-
styleList: blob.story_attachment.style_list // @Legacy
|
|
508
|
+
styleList: blob.story_attachment.style_list, // @Legacy
|
|
499
509
|
};
|
|
500
510
|
case "MessageFile":
|
|
501
511
|
return {
|
|
@@ -509,17 +519,17 @@ function _formatAttachment(attachment1, attachment2) {
|
|
|
509
519
|
|
|
510
520
|
name: blob.filename,
|
|
511
521
|
mimeType: "",
|
|
512
|
-
fileSize: -1
|
|
522
|
+
fileSize: -1,
|
|
513
523
|
};
|
|
514
524
|
default:
|
|
515
525
|
throw new Error(
|
|
516
526
|
"unrecognized attach_file of type " +
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
527
|
+
type +
|
|
528
|
+
"`" +
|
|
529
|
+
JSON.stringify(attachment1, null, 4) +
|
|
530
|
+
" attachment2: " +
|
|
531
|
+
JSON.stringify(attachment2, null, 4) +
|
|
532
|
+
"`",
|
|
523
533
|
);
|
|
524
534
|
}
|
|
525
535
|
}
|
|
@@ -528,15 +538,15 @@ function formatAttachment(attachments, attachmentIds, attachmentMap, shareMap) {
|
|
|
528
538
|
attachmentMap = shareMap || attachmentMap;
|
|
529
539
|
return attachments
|
|
530
540
|
? attachments.map(function (i) {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
541
|
+
if (
|
|
542
|
+
!attachmentMap ||
|
|
543
|
+
!attachmentIds ||
|
|
544
|
+
!attachmentMap[attachmentIds[i]]
|
|
545
|
+
) {
|
|
546
|
+
return _formatAttachment(val);
|
|
547
|
+
}
|
|
548
|
+
return _formatAttachment(val, attachmentMap[attachmentIds[i]]);
|
|
549
|
+
})
|
|
540
550
|
: [];
|
|
541
551
|
}
|
|
542
552
|
|
|
@@ -566,7 +576,14 @@ function getMentionsFromDeltaMessage(m) {
|
|
|
566
576
|
return mentions;
|
|
567
577
|
}
|
|
568
578
|
var md = m.messageMetadata;
|
|
569
|
-
if (
|
|
579
|
+
if (
|
|
580
|
+
md &&
|
|
581
|
+
md.data &&
|
|
582
|
+
md.data.data &&
|
|
583
|
+
md.data.data.Gb &&
|
|
584
|
+
md.data.data.Gb.asMap &&
|
|
585
|
+
md.data.data.Gb.asMap.data
|
|
586
|
+
) {
|
|
570
587
|
var gbData = md.data.data.Gb.asMap.data;
|
|
571
588
|
for (var key in gbData) {
|
|
572
589
|
if (!Object.prototype.hasOwnProperty.call(gbData, key)) continue;
|
|
@@ -574,8 +591,14 @@ function getMentionsFromDeltaMessage(m) {
|
|
|
574
591
|
if (entry && entry.asMap && entry.asMap.data) {
|
|
575
592
|
var d = entry.asMap.data;
|
|
576
593
|
var id = d.id && d.id.asLong ? String(d.id.asLong) : null;
|
|
577
|
-
var offset = parseInt(
|
|
578
|
-
|
|
594
|
+
var offset = parseInt(
|
|
595
|
+
d.offset && d.offset.asLong ? d.offset.asLong : 0,
|
|
596
|
+
10,
|
|
597
|
+
);
|
|
598
|
+
var len = parseInt(
|
|
599
|
+
d.length && d.length.asLong ? d.length.asLong : 0,
|
|
600
|
+
10,
|
|
601
|
+
);
|
|
579
602
|
if (id != null) {
|
|
580
603
|
mentions[id] = body.substring(offset, offset + len);
|
|
581
604
|
}
|
|
@@ -594,19 +617,21 @@ function formatDeltaMessage(m) {
|
|
|
594
617
|
type: "message",
|
|
595
618
|
senderID: formatID(md.actorFbId.toString()),
|
|
596
619
|
threadID: formatID(
|
|
597
|
-
(md.threadKey.threadFbId || md.threadKey.otherUserFbId).toString()
|
|
620
|
+
(md.threadKey.threadFbId || md.threadKey.otherUserFbId).toString(),
|
|
598
621
|
),
|
|
599
622
|
messageID: md.messageId,
|
|
600
623
|
args: args,
|
|
601
624
|
body: body,
|
|
602
625
|
attachments: (m.attachments || []).map((/** @type {any} */ v) =>
|
|
603
|
-
_formatAttachment(v)
|
|
626
|
+
_formatAttachment(v),
|
|
604
627
|
),
|
|
605
628
|
mentions: mentions,
|
|
606
629
|
timestamp: md.timestamp,
|
|
607
630
|
isGroup: !!md.threadKey.threadFbId,
|
|
608
|
-
participantIDs: (m.participants || []).map((/** @type {any} */ p) =>
|
|
609
|
-
|
|
631
|
+
participantIDs: (m.participants || []).map((/** @type {any} */ p) =>
|
|
632
|
+
formatID(p.toString()),
|
|
633
|
+
),
|
|
634
|
+
isUnread: md.isUnread !== undefined ? md.isUnread : false,
|
|
610
635
|
};
|
|
611
636
|
}
|
|
612
637
|
|
|
@@ -628,15 +653,15 @@ function formatMessage(m) {
|
|
|
628
653
|
: [originalMessage.sender_name.split(" ")[0]],
|
|
629
654
|
participantIDs: originalMessage.group_thread_info
|
|
630
655
|
? originalMessage.group_thread_info.participant_ids.map(function (v) {
|
|
631
|
-
|
|
632
|
-
|
|
656
|
+
return formatID(v.toString());
|
|
657
|
+
})
|
|
633
658
|
: [formatID(originalMessage.sender_fbid)],
|
|
634
659
|
body: body,
|
|
635
660
|
args: args,
|
|
636
661
|
threadID: formatID(
|
|
637
662
|
(
|
|
638
663
|
originalMessage.thread_fbid || originalMessage.other_user_fbid
|
|
639
|
-
).toString()
|
|
664
|
+
).toString(),
|
|
640
665
|
),
|
|
641
666
|
threadName: originalMessage.group_thread_info
|
|
642
667
|
? originalMessage.group_thread_info.name
|
|
@@ -649,7 +674,7 @@ function formatMessage(m) {
|
|
|
649
674
|
originalMessage.attachments,
|
|
650
675
|
originalMessage.attachmentIds,
|
|
651
676
|
originalMessage.attachment_map,
|
|
652
|
-
originalMessage.share_map
|
|
677
|
+
originalMessage.share_map,
|
|
653
678
|
),
|
|
654
679
|
timestamp: originalMessage.timestamp,
|
|
655
680
|
timestampAbsolute: originalMessage.timestamp_absolute,
|
|
@@ -657,7 +682,7 @@ function formatMessage(m) {
|
|
|
657
682
|
timestampDatetime: originalMessage.timestamp_datetime,
|
|
658
683
|
tags: originalMessage.tags,
|
|
659
684
|
reactions: originalMessage.reactions ? originalMessage.reactions : [],
|
|
660
|
-
isUnread: originalMessage.is_unread
|
|
685
|
+
isUnread: originalMessage.is_unread,
|
|
661
686
|
};
|
|
662
687
|
if (m.type === "pages_messaging")
|
|
663
688
|
obj.pageID = m.realtime_viewer_fbid.toString();
|
|
@@ -672,14 +697,14 @@ function formatEvent(m) {
|
|
|
672
697
|
if (logMessageType === "log:generic-admin-text") {
|
|
673
698
|
logMessageData = originalMessage.log_message_data.untypedData;
|
|
674
699
|
logMessageType = getAdminTextMessageType(
|
|
675
|
-
originalMessage.log_message_data.message_type
|
|
700
|
+
originalMessage.log_message_data.message_type,
|
|
676
701
|
);
|
|
677
702
|
} else logMessageData = originalMessage.log_message_data;
|
|
678
703
|
return Object.assign(formatMessage(originalMessage), {
|
|
679
704
|
type: "event",
|
|
680
705
|
logMessageType: logMessageType,
|
|
681
706
|
logMessageData: logMessageData,
|
|
682
|
-
logMessageBody: originalMessage.log_message_body
|
|
707
|
+
logMessageBody: originalMessage.log_message_body,
|
|
683
708
|
});
|
|
684
709
|
}
|
|
685
710
|
|
|
@@ -697,9 +722,9 @@ function formatDeltaReadReceipt(delta) {
|
|
|
697
722
|
reader: (delta.threadKey.otherUserFbId || delta.actorFbId).toString(),
|
|
698
723
|
time: delta.actionTimestampMs,
|
|
699
724
|
threadID: formatID(
|
|
700
|
-
(delta.threadKey.otherUserFbId || delta.threadKey.threadFbId).toString()
|
|
725
|
+
(delta.threadKey.otherUserFbId || delta.threadKey.threadFbId).toString(),
|
|
701
726
|
),
|
|
702
|
-
type: "read_receipt"
|
|
727
|
+
type: "read_receipt",
|
|
703
728
|
};
|
|
704
729
|
}
|
|
705
730
|
|
|
@@ -732,7 +757,7 @@ function decodeClientPayload(payload) {
|
|
|
732
757
|
char2 = array[i++];
|
|
733
758
|
char3 = array[i++];
|
|
734
759
|
out += String.fromCharCode(
|
|
735
|
-
((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0)
|
|
760
|
+
((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0),
|
|
736
761
|
);
|
|
737
762
|
break;
|
|
738
763
|
}
|
|
@@ -747,15 +772,14 @@ function formatTyp(event) {
|
|
|
747
772
|
isTyping: !!event.st,
|
|
748
773
|
from: event.from.toString(),
|
|
749
774
|
threadID: formatID(
|
|
750
|
-
(event.to || event.thread_fbid || event.from).toString()
|
|
775
|
+
(event.to || event.thread_fbid || event.from).toString(),
|
|
751
776
|
),
|
|
752
777
|
fromMobile: event.hasOwnProperty("from_mobile") ? event.from_mobile : true,
|
|
753
778
|
userID: (event.realtime_viewer_fbid || event.from).toString(),
|
|
754
|
-
type: "typ"
|
|
779
|
+
type: "typ",
|
|
755
780
|
};
|
|
756
781
|
}
|
|
757
782
|
|
|
758
|
-
|
|
759
783
|
function formatThread(data) {
|
|
760
784
|
return {
|
|
761
785
|
threadID: formatID(data.thread_fbid.toString()),
|
|
@@ -787,7 +811,7 @@ function formatThread(data) {
|
|
|
787
811
|
emoji: data.custom_like_icon,
|
|
788
812
|
color: data.custom_color,
|
|
789
813
|
adminIDs: data.admin_ids,
|
|
790
|
-
threadType: data.thread_type
|
|
814
|
+
threadType: data.thread_type,
|
|
791
815
|
};
|
|
792
816
|
}
|
|
793
817
|
|
|
@@ -839,7 +863,7 @@ function presenceDecode(str) {
|
|
|
839
863
|
return decodeURIComponent(
|
|
840
864
|
str.replace(/[_A-Z]/g, function (/** @type {string | number} */ m) {
|
|
841
865
|
return j[m];
|
|
842
|
-
})
|
|
866
|
+
}),
|
|
843
867
|
);
|
|
844
868
|
}
|
|
845
869
|
|
|
@@ -859,12 +883,12 @@ function generatePresence(userID) {
|
|
|
859
883
|
uct2: time,
|
|
860
884
|
tr: null,
|
|
861
885
|
tw: Math.floor(Math.random() * 4294967295) + 1,
|
|
862
|
-
at: time
|
|
886
|
+
at: time,
|
|
863
887
|
},
|
|
864
888
|
ch: {
|
|
865
|
-
["p_" + userID]: 0
|
|
866
|
-
}
|
|
867
|
-
})
|
|
889
|
+
["p_" + userID]: 0,
|
|
890
|
+
},
|
|
891
|
+
}),
|
|
868
892
|
)
|
|
869
893
|
);
|
|
870
894
|
}
|
|
@@ -880,19 +904,22 @@ function generateAccessiblityCookie() {
|
|
|
880
904
|
kb: 0,
|
|
881
905
|
"kb-ts": time,
|
|
882
906
|
hcm: 0,
|
|
883
|
-
"hcm-ts": time
|
|
884
|
-
})
|
|
907
|
+
"hcm-ts": time,
|
|
908
|
+
}),
|
|
885
909
|
);
|
|
886
910
|
}
|
|
887
911
|
|
|
888
912
|
function getGUID() {
|
|
889
913
|
var sectionLength = Date.now();
|
|
890
|
-
var id = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
914
|
+
var id = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
|
|
915
|
+
/[xy]/g,
|
|
916
|
+
function (c) {
|
|
917
|
+
var r = Math.floor((sectionLength + Math.random() * 16) % 16);
|
|
918
|
+
sectionLength = Math.floor(sectionLength / 16);
|
|
919
|
+
var _guid = (c == "x" ? r : (r & 7) | 8).toString(16);
|
|
920
|
+
return _guid;
|
|
921
|
+
},
|
|
922
|
+
);
|
|
896
923
|
return id;
|
|
897
924
|
}
|
|
898
925
|
|
|
@@ -901,9 +928,9 @@ function formatDeltaReadReceipt(delta) {
|
|
|
901
928
|
reader: (delta.threadKey.otherUserFbId || delta.actorFbId).toString(),
|
|
902
929
|
time: delta.actionTimestampMs,
|
|
903
930
|
threadID: formatID(
|
|
904
|
-
(delta.threadKey.otherUserFbId || delta.threadKey.threadFbId).toString()
|
|
931
|
+
(delta.threadKey.otherUserFbId || delta.threadKey.threadFbId).toString(),
|
|
905
932
|
),
|
|
906
|
-
type: "read_receipt"
|
|
933
|
+
type: "read_receipt",
|
|
907
934
|
};
|
|
908
935
|
}
|
|
909
936
|
|
|
@@ -912,7 +939,7 @@ function formatReadReceipt(event) {
|
|
|
912
939
|
reader: event.reader.toString(),
|
|
913
940
|
time: event.time,
|
|
914
941
|
threadID: formatID((event.thread_fbid || event.reader).toString()),
|
|
915
|
-
type: "read_receipt"
|
|
942
|
+
type: "read_receipt",
|
|
916
943
|
};
|
|
917
944
|
}
|
|
918
945
|
|
|
@@ -922,10 +949,10 @@ function formatRead(event) {
|
|
|
922
949
|
(
|
|
923
950
|
(event.chat_ids && event.chat_ids[0]) ||
|
|
924
951
|
(event.thread_fbids && event.thread_fbids[0])
|
|
925
|
-
).toString()
|
|
952
|
+
).toString(),
|
|
926
953
|
),
|
|
927
954
|
time: event.timestamp,
|
|
928
|
-
type: "read"
|
|
955
|
+
type: "read",
|
|
929
956
|
};
|
|
930
957
|
}
|
|
931
958
|
|
|
@@ -937,7 +964,7 @@ function arrToForm(form) {
|
|
|
937
964
|
},
|
|
938
965
|
function (v) {
|
|
939
966
|
return v.val;
|
|
940
|
-
}
|
|
967
|
+
},
|
|
941
968
|
);
|
|
942
969
|
}
|
|
943
970
|
|
|
@@ -969,7 +996,7 @@ var NUM_TO_MONTH = [
|
|
|
969
996
|
"Sep",
|
|
970
997
|
"Oct",
|
|
971
998
|
"Nov",
|
|
972
|
-
"Dec"
|
|
999
|
+
"Dec",
|
|
973
1000
|
];
|
|
974
1001
|
var NUM_TO_DAY = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
975
1002
|
|
|
@@ -1012,7 +1039,7 @@ function formatProxyPresence(presence, userID) {
|
|
|
1012
1039
|
type: "presence",
|
|
1013
1040
|
timestamp: presence.lat * 1000,
|
|
1014
1041
|
userID: userID || "",
|
|
1015
|
-
statuses: presence.p
|
|
1042
|
+
statuses: presence.p,
|
|
1016
1043
|
};
|
|
1017
1044
|
}
|
|
1018
1045
|
|
|
@@ -1021,7 +1048,7 @@ function formatPresence(presence, userID) {
|
|
|
1021
1048
|
type: "presence",
|
|
1022
1049
|
timestamp: presence.la * 1000,
|
|
1023
1050
|
userID: userID || "",
|
|
1024
|
-
statuses: presence.a
|
|
1051
|
+
statuses: presence.a,
|
|
1025
1052
|
};
|
|
1026
1053
|
}
|
|
1027
1054
|
|
|
@@ -1075,7 +1102,7 @@ function getPaths(obj, parentPath = []) {
|
|
|
1075
1102
|
function cleanHTML(text) {
|
|
1076
1103
|
text = text.replace(
|
|
1077
1104
|
/(<br>)|(<\/?i>)|(<\/?em>)|(<\/?b>)|(!?~)|(&)|(')|(<)|(>)|(")/g,
|
|
1078
|
-
match => {
|
|
1105
|
+
(match) => {
|
|
1079
1106
|
switch (match) {
|
|
1080
1107
|
case "<br>":
|
|
1081
1108
|
return "\n";
|
|
@@ -1101,7 +1128,7 @@ function cleanHTML(text) {
|
|
|
1101
1128
|
case """:
|
|
1102
1129
|
return '"';
|
|
1103
1130
|
}
|
|
1104
|
-
}
|
|
1131
|
+
},
|
|
1105
1132
|
);
|
|
1106
1133
|
return text;
|
|
1107
1134
|
}
|
|
@@ -1143,5 +1170,5 @@ module.exports = {
|
|
|
1143
1170
|
getData_Path,
|
|
1144
1171
|
setData_Path,
|
|
1145
1172
|
getSignatureID,
|
|
1146
|
-
getCurrentTimestamp
|
|
1173
|
+
getCurrentTimestamp,
|
|
1147
1174
|
};
|