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