Skip to content

Commit d91e7e0

Browse files
committed
update
1 parent d38433d commit d91e7e0

File tree

7 files changed

+130
-19
lines changed

7 files changed

+130
-19
lines changed

popup/tabs.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ const tabs = [
9393
{
9494
...CATEGORY.facebook,
9595
scripts: [
96+
createTitle("--- Hot ---", "--- Nổi bật ---"),
9697
s.fb_revealDeletedMessages,
98+
s.fb_invisible_message,
99+
s.fb_moreReactionStory,
97100
s.fb_whoIsTyping,
101+
s.fb_messengerHistory,
98102
createTitle("--- UI ---", "--- Giao diện ---"),
99103
s.fb_toggleLight,
100104
s.fb_toggleNewFeed,
101-
s.fb_invisible_message,
102-
s.fb_moreReactionStory,
103105
createTitle("--- Download ---", "--- Tải xuống ---"),
104106
s.fb_downloadWatchingVideo,
105107
s.fb_storySaver,
@@ -110,6 +112,10 @@ const tabs = [
110112
createTitle("--- Bulk Download ---", "--- Tải hàng loạt ---"),
111113
s.fb_downloadAlbumMedia,
112114
s.fb_exportSaved,
115+
createTitle("--- Security ---", "--- Bảo mật ---"),
116+
s.fb_removeFbclid,
117+
s.fb_antiPhishing,
118+
s.anti_clickjacking,
113119
createTitle("--- Access Token ---", "--- Access Token ---"),
114120
s.fb_checkToken,
115121
s.fb_getTokenFfb,

scripts/content-scripts/scripts/ufs_global_webpage_context.js

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,30 @@ const UsefulScriptGlobalPageContext = {
132132
},
133133
},
134134
Facebook: {
135+
async fetchGraphQl(str, token) {
136+
var fb_dtsg = "fb_dtsg=" + encodeURIComponent(token);
137+
fb_dtsg += str.includes("variables")
138+
? "&" + str
139+
: "&q=" + encodeURIComponent(str);
140+
141+
let res = await fetch("https://www.facebook.com/api/graphql/", {
142+
body: fb_dtsg,
143+
method: "POST",
144+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
145+
credentials: "include",
146+
});
147+
148+
let json = await res.json();
149+
return json;
150+
},
135151
getUserAvatarFromUid(uid) {
136152
return (
137153
"https://graph.facebook.com/" +
138154
uid +
139155
"/picture?height=500&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662"
140156
);
141157
},
142-
getUserProfileDataFromUid: async (uid) => {
158+
async getUserInfoFromUid(uid) {
143159
const variables = {
144160
userID: uid,
145161
shouldDeferProfilePic: false,
@@ -173,10 +189,19 @@ const UsefulScriptGlobalPageContext = {
173189
alternateName: /"alternate_name":"(.*?)"/.exec(text)?.[1],
174190
};
175191
},
192+
async getUserInfo(uid, access_token) {
193+
var n =
194+
"https://graph.facebook.com/" +
195+
encodeURIComponent(uid) +
196+
"/?fields=name,picture&access_token=" +
197+
access_token;
198+
const e = await fetch(n);
199+
return await e.json();
200+
},
176201
decodeArrId(arrId) {
177202
return arrId[0] * 4294967296 + arrId[1];
178203
},
179-
getUidFromUrl: async (url) => {
204+
async getUidFromUrl(url) {
180205
let methods = [
181206
() => require("CometRouteStore").getRoute(url).rootView.props.userID,
182207
async () => {
@@ -245,9 +270,8 @@ const UsefulScriptGlobalPageContext = {
245270
}
246271
return null;
247272
},
248-
249273
// Source: https://pastebin.com/CNvUxpfc
250-
getStoryInfo: async (bucketID, fb_dtsg) => {
274+
async getStoryInfo(bucketID, fb_dtsg) {
251275
let body = new URLSearchParams();
252276
body.append("__a", 1);
253277
body.append("fb_dtsg", fb_dtsg);
@@ -360,6 +384,62 @@ const UsefulScriptGlobalPageContext = {
360384
// xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
361385
// xhr.send(body);
362386
},
387+
async unlikePage(pageId, user, fb_dtsg) {
388+
var f = new FormData();
389+
f.append("fbpage_id", pageId),
390+
f.append("add", false),
391+
f.append("reload", false),
392+
f.append("fan_origin", "page_timeline"),
393+
f.append("__user", user),
394+
f.append("__a", 1),
395+
f.append("fb_dtsg", fb_dtsg);
396+
await fetch("https://www.facebook.com/ajax/pages/fan_status.php?dpr=1", {
397+
method: "POST",
398+
credentials: "include",
399+
body: f,
400+
});
401+
},
402+
async leaveGroup(groupId, user, fb_dtsg) {
403+
var f = new FormData();
404+
f.append("fb_dtsg", fb_dtsg),
405+
f.append("confirmed", 1),
406+
f.append("__user", user),
407+
f.append("__a", 1);
408+
await fetch(
409+
"https://www.facebook.com/ajax/groups/membership/leave.php?group_id=" +
410+
groupId +
411+
"&dpr=1",
412+
{
413+
method: "POST",
414+
credentials: "include",
415+
body: f,
416+
}
417+
);
418+
},
419+
async removeFriendConfirm(friend_uid, user, fb_dtsg) {
420+
var f = new FormData();
421+
f.append("uid", friend_uid),
422+
f.append("unref", "bd_friends_tab"),
423+
f.append("floc", "friends_tab"),
424+
f.append("__user", user),
425+
f.append("__a", 1),
426+
f.append("fb_dtsg", fb_dtsg);
427+
await fetch(
428+
"https://www.facebook.com/ajax/ajax/profile/removefriendconfirm.php?dpr=1",
429+
{
430+
method: "POST",
431+
credentials: "include",
432+
body: f,
433+
}
434+
);
435+
},
436+
async messagesCount(token) {
437+
let res = await UsefulScriptGlobalPageContext.Facebook.fetchGraphQl(
438+
"viewer(){message_threads{count,nodes{customization_info{emoji,outgoing_bubble_color,participant_customizations{participant_id,nickname}},all_participants{nodes{messaging_actor{name,id,profile_picture}}},thread_type,name,messages_count,image,id}}}",
439+
token
440+
);
441+
return await res.json();
442+
},
363443
},
364444
};
365445
window.UsefulScriptGlobalPageContext = UsefulScriptGlobalPageContext;

scripts/fb_messengerHistory.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export default {
2+
icon: '<i class="fa-solid fa-clock-rotate-left fa-lg"></i>',
3+
name: {
4+
en: "Facebook messenger history",
5+
vi: "Facebook xem tin nhắn đầu tiên",
6+
},
7+
description: {
8+
en: "View first message in facebook messenger",
9+
vi: "Xem tin nhắn đầu tiên với bạn bè trong facebook messenger",
10+
},
11+
whiteList: ["https://*.facebook.com/*", "https://*.messenger.com/*"],
12+
13+
onClick: async () => {
14+
let uid = prompt("Nhâp uid của bạn bè:", "");
15+
let token = prompt("Nhập access token: ");
16+
17+
let res = await fetch(
18+
"https://graph.facebook.com/" + uid + "?fields=id&access_token=" + token
19+
);
20+
21+
console.log(await res.json());
22+
},
23+
};

scripts/fb_revealDeletedMessages.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,8 @@ export default {
117117
chats.push({
118118
type: window.UfsChatType.sticker,
119119
content: parse(
120-
all_strings[i + 6].match(/"playableUrl":"(.*?)"/)?.[1] ||
121-
all_strings[i + 6].match(/"previewUrl":"(.*?)"/)?.[1] ||
122-
all_strings[i + 9].match(/"previewUrl":"(.*?)"/)?.[1] ||
123-
""
120+
all_strings.join("").match(/"playableUrl":"(.*?)"/)?.[1] ||
121+
"-no data-"
124122
),
125123
id: all_strings[i + 1],
126124
});
@@ -284,6 +282,7 @@ export default {
284282
// MWPBaseMessage.bs
285283
// MWMessageListAttachment.bs
286284
// MWMessageListAttachmentContainer.bs
285+
// LSDeleteThenInsertThread
287286

288287
// TODO hiển thị đúng component react cho từng loại tin nhắn
289288
requireLazy(["MWV2ChatUnsentMessage.bs"], (MWV2ChatUnsentMessage) => {
@@ -327,12 +326,7 @@ export default {
327326

328327
onClick: () => {
329328
let len = window.ufs_rvdfm_all_msgs.length;
330-
if (!len)
331-
alert(
332-
"Chức năng chưa lưu được tin nhắn nào.\n" +
333-
"Hãy mở khung chat bất kỳ để chức năng tự động lưu tin nhắn giúp bạn.\n" +
334-
"Sau khi lưu, nếu có người thu hồi tin nhắn, chức năng sẽ lấy tin đã lưu hiển thị cho bạn xem."
335-
);
329+
if (!len) alert("Chức năng chưa lưu được tin nhắn nào.");
336330
else if (
337331
confirm(
338332
`Bạn có chắc muốn xóa tất cả ${len} tin nhắn` +

scripts/fb_videoDownloader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const shared = {
6262
b = d[a];
6363
f.push(
6464
null !== b && "object" == typeof b
65-
? stringifyVariables(b, g)
65+
? shared.stringifyVariables(b, g)
6666
: encodeURIComponent(g) + "=" + encodeURIComponent(b)
6767
);
6868
}

scripts/fb_whoIsTyping.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default {
2-
icon: '<i class="fa-regular fa-comment-dots fa-xl fa-lg"></i>',
2+
icon: '<i class="fa-regular fa-comment-dots fa-lg"></i>',
33
name: {
44
en: "Facebook - Who is typing to you?",
55
vi: "Facebook - Ai đang nhắn cho bạn?",
@@ -36,7 +36,7 @@ export default {
3636

3737
if (!(uid in window.ufs_whoIsTyping_Cached)) {
3838
let userData =
39-
await UsefulScriptGlobalPageContext.Facebook.getUserProfileDataFromUid(
39+
await UsefulScriptGlobalPageContext.Facebook.getUserInfoFromUid(
4040
uid
4141
);
4242
window.ufs_whoIsTyping_Cached[uid] = userData;

scripts/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ import fb_moreReactionStory from "./fb_moreReactionStory.js";
160160
import changeAudioOutput from "./changeAudioOutput.js";
161161
import docDownloader from "./docDownloader.js";
162162
import scribd_bypassPreview from "./scribd_bypassPreview.js";
163+
import anti_clickjacking from "./anti_clickjacking.js";
164+
import fb_antiPhishing from "./fb_antiPhishing.js";
165+
import fb_removeFbclid from "./fb_removeFbclid.js";
166+
import fb_messengerHistory from "./fb_messengerHistory.js";
163167

164168
// inject badges
165169
const allScripts = {
@@ -341,6 +345,10 @@ const allScripts = {
341345
changeAudioOutput: addBadge(changeAudioOutput, BADGES.new),
342346
docDownloader: addBadge(docDownloader, BADGES.new),
343347
scribd_bypassPreview: addBadge(scribd_bypassPreview, BADGES.new),
348+
anti_clickjacking: addBadge(anti_clickjacking, BADGES.new),
349+
fb_antiPhishing: addBadge(fb_antiPhishing, BADGES.new),
350+
fb_removeFbclid: addBadge(fb_removeFbclid, BADGES.new),
351+
fb_messengerHistory: addBadge(fb_messengerHistory, BADGES.new),
344352
};
345353

346354
// alert(Object.keys(allScripts).length);

0 commit comments

Comments
 (0)