@@ -21,10 +21,8 @@ export default {
2121 // });
2222 // return websocket_instant;
2323 // };
24-
2524 // window.WebSocket.prototype = WebSocketOrig.prototype;
2625 // window.WebSocket.prototype.constructor = window.WebSocket;
27-
2826 // window.addEventListener(
2927 // "message",
3028 // function (t) {
@@ -33,68 +31,128 @@ export default {
3331 // !1
3432 // );
3533
36- // console.log(window.__d);
37- // let emptyFunc = void 0;
38- // Object.defineProperty(window, "__d", {
39- // get: () => emptyFunc,
40- // set: (i) => {
41- // const c = new Proxy(i, {
42- // apply: async function (moduleName, dependencies, args) {
43- // console.log(arguments);
44- // // return moduleName(...args);
45- // return i.apply(this, arguments);
46- // },
47- // });
48- // emptyFunc = c;
49- // },
50- // });
34+ let emptyFunc = void 0 ;
35+ Object . defineProperty ( window , "__d" , {
36+ get : ( ) => emptyFunc ,
37+ set : ( i ) => {
38+ const c = new Proxy ( i , {
39+ apply : function ( target , thisArg , arg ) {
40+ console . log ( thisArg ) ;
41+ return target ( ...arg ) ;
42+ } ,
43+ } ) ;
44+ emptyFunc = c ;
45+ } ,
46+ } ) ;
5147 } ,
5248
5349 onDocumentIdle : ( ) => {
54- // MWV2ChatImage.bs
55- requireLazy ( [ "MWV2ChatUnsentMessage.bs" ] , ( MWV2ChatUnsentMessage ) => {
56- const MWV2ChatUnsentMessageOrig = MWV2ChatUnsentMessage . make ;
50+ // tất cả loại tin nhắn đều được bao bọc bởi:
51+ // MWPBaseMessage.bs
52+ // MWMessageListAttachment.bs
53+ // MWMessageListAttachmentContainer.bs
54+
55+ let key = "ufs_reveal_deleted_fb_messages" ;
56+ let savedMessages = JSON . parse ( localStorage . getItem ( key ) ?? "[]" ) ;
57+
58+ console . log (
59+ "Load " + savedMessages . length + " messages from localStorage."
60+ ) ;
5761
58- MWV2ChatUnsentMessage . make = function ( a ) {
59- if ( a ) {
60- let outgoing = a . outgoing ;
61- let {
62- isUnsent,
63- messageId,
64- threadKey,
65- offlineThreadingId,
66- displayedContentTypes,
67- senderId,
68- } = a . message ;
62+ requireLazy (
63+ [ "MWV2ChatUnsentMessage.bs" , "MWPBaseMessage.bs" , "MqttProtocolClient" ] ,
64+ ( MWV2ChatUnsentMessage , MWPBaseMessage , MqttProtocolClient ) => {
65+ // Override unsent message component
66+ const MWV2ChatUnsentMessageOrig = MWV2ChatUnsentMessage . make ;
67+ MWV2ChatUnsentMessage . make = function ( a ) {
68+ if ( a ) {
69+ let outgoing = a . outgoing ;
70+ let {
71+ isUnsent,
72+ messageId,
73+ threadKey,
74+ offlineThreadingId,
75+ displayedContentTypes,
76+ senderId,
77+ } = a . message ;
6978
70- if ( isUnsent ) {
71- threadKey =
72- UsefulScriptGlobalWebpageContext . Facebook . decodeArrId ( threadKey ) ;
73- senderId =
74- UsefulScriptGlobalWebpageContext . Facebook . decodeArrId ( senderId ) ;
79+ if ( isUnsent ) {
80+ threadKey =
81+ UsefulScriptGlobalWebpageContext . Facebook . decodeArrId (
82+ threadKey
83+ ) ;
84+ senderId =
85+ UsefulScriptGlobalWebpageContext . Facebook . decodeArrId ( senderId ) ;
7586
76- a . message . isUnsent = false ;
77- a . message . text = "[Hacked]: thu hồi nè" ;
87+ a . message . isUnsent = false ;
88+ a . message . text = "[Hacked]: thu hồi nè" ;
7889
79- console . log (
80- "Tin nhắn thu hồi từ " + senderId + " trong " + threadKey ,
81- a
82- ) ;
90+ console . log (
91+ "Tin nhắn thu hồi từ " + senderId + " trong " + threadKey ,
92+ a
93+ ) ;
94+ }
8395 }
84- }
85- return MWV2ChatUnsentMessageOrig . apply ( this , arguments ) ;
86- } ;
87- } ) ;
96+ return MWV2ChatUnsentMessageOrig . apply ( this , arguments ) ;
97+ } ;
98+
99+ // Listen for chat event
100+ const MqttProtocolClientOrig = MqttProtocolClient . prototype . publish ;
101+ MqttProtocolClient . prototype . publish = function ( ) {
102+ let b = arguments [ 1 ] ;
103+ console . log ( b ) ;
104+ // if (b && b.includes('\\\\\\"text\\\\\\":')) {
105+ // (function () {
106+ // b = JSON.parse(b);
107+ // if (!b || !b.payload) return;
108+ // let payload = JSON.parse(b.payload);
109+ // if (!payload || !payload.tasks) return;
110+
111+ // payload.tasks = payload.tasks.map((task) => {
112+ // let payload = JSON.parse(task.payload);
113+ // if (!payload || !payload.text) return task;
114+ // if (payload.text.length > 1 && payload.text[0] === ">") {
115+ // payload.text = encode(payload.text.substr(1));
116+ // }
117+ // task.payload = JSON.stringify(payload);
118+ // return task;
119+ // });
120+
121+ // b.payload = JSON.stringify(payload);
122+ // b = JSON.stringify(b);
123+ // })();
124+ // arguments[1] = b;
125+ // }
126+ return MqttProtocolClientOrig . apply ( this , arguments ) ;
127+ } ;
128+ }
129+ ) ;
88130
89131 // Test who is typing
132+ // MWChatTypingIndicator.bs
133+ // MWPTypingIndicators.bs
90134 requireLazy ( [ "LSUpdateTypingIndicator" ] , ( LSUpdateTypingIndicator ) => {
91- const LSUpdateTypingIndicatorOrig = LSUpdateTypingIndicator ;
92- console . log ( "abc" ) ;
135+ alert ( "abc" ) ;
136+ // const LSUpdateTypingIndicatorOrig = LSUpdateTypingIndicator;
137+
138+ // LSUpdateTypingIndicator = function () {
139+ // console.log(arguments);
140+ // return LSUpdateTypingIndicatorOrig.apply(this, arguments);
141+ // };
142+ } ) ;
93143
94- LSUpdateTypingIndicator = function ( ...args ) {
95- console . log ( args ) ;
96- return LSUpdateTypingIndicatorOrig . apply ( this , arguments ) ;
97- } ;
144+ let emptyFunc = void 0 ;
145+ Object . defineProperty ( window , "__d" , {
146+ get : ( ) => emptyFunc ,
147+ set : ( i ) => {
148+ const c = new Proxy ( i , {
149+ apply : function ( target , thisArg , arg ) {
150+ console . log ( thisArg ) ;
151+ return target ( ...arg ) ;
152+ } ,
153+ } ) ;
154+ emptyFunc = c ;
155+ } ,
98156 } ) ;
99157 } ,
100158} ;
0 commit comments