Skip to content

Commit 3ad82c8

Browse files
committed
get token ffb auto
1 parent a372245 commit 3ad82c8

File tree

3 files changed

+58
-19
lines changed

3 files changed

+58
-19
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"default_popup": "./popup/popup.html",
1414
"default_icon": "./assets/icon32.png"
1515
},
16-
"permissions": ["tabs", "scripting", "storage"],
16+
"permissions": ["tabs", "scripting", "storage", "cookies"],
1717
"host_permissions": ["<all_urls>"],
1818
"options_page": "./pages/options/options.html",
1919
"content_scripts": [

scripts/fb_getTokenFfb.js

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,67 @@
11
export default {
2-
icon: `<i class="fa-solid fa-arrow-up-right-from-square"></i>`,
2+
icon: "https://ffb.vn/assets/img/illustrations/favicon.png",
33
name: {
4-
en: "Get fb token full permission (ffb.vn)",
5-
vi: "Lấy token fb đủ quyền (ffb.vn)",
4+
en: "Get fb token from cookie (ffb.vn)",
5+
vi: "Lấy fb token từ cookie (ffb.vn)",
66
},
77
description: {
8-
en: "WARNING: I do not own this website. Be careful when use!",
9-
vi: "CẢNH BÁO: Không phải trang web của mình. Cẩn thận khi sử dụng!",
8+
en: "Post your fb cookie to ffb.vn API",
9+
vi: "Gửi cookie fb lên API của ffb.vn",
1010
},
1111
blackList: [],
1212
whiteList: [],
13+
runInExtensionContext: true,
1314

1415
func: function () {
15-
window.open("https://ffb.vn/get-token");
16+
async function getCookiesInExtensionContext(domain) {
17+
let cookies = await chrome.cookies.getAll({ domain });
18+
return cookies.map((_) => _.name + "=" + decodeURI(_.value)).join(";");
19+
}
20+
21+
(async () => {
22+
let cookie = await getCookiesInExtensionContext("facebook.com");
23+
if (!cookie) {
24+
alert("Không thấy cookie. Hãy chắc rằng bạn đã đăng nhập facebook!");
25+
} else {
26+
//prettier-ignore
27+
let types = ["eaaq","eaag","eaab","eaas","eaai","eaaa","Mở trang ffb.vn",];
28+
let typeIndex = prompt(
29+
"[Lưu ý]\n" +
30+
"+ Sẽ gửi cookie facebook của bạn lên ffb.vn\n" +
31+
"+ Mình không đảm bảo an toàn cho cookie của bạn\n" +
32+
"+ Ấn Cancel ngay nếu muốn huỷ\n\n" +
33+
"Chọn loại token muốn lấy:\n" +
34+
types.map((_, i) => ` ${i}: ${_.toUpperCase()}`).join("\n"),
35+
0
36+
);
37+
38+
if (typeIndex == null) return;
39+
if (typeIndex < 0 || typeIndex >= types.length) {
40+
alert(
41+
"Invalid type. Please try again\nLựa chọn không hợp lệ. Vui lòng thử lại"
42+
);
43+
return;
44+
}
45+
if (typeIndex == types.length - 1) {
46+
window.open("https://ffb.vn/get-token");
47+
return;
48+
}
49+
50+
const formData = new FormData();
51+
formData.append("cookie", cookie);
52+
formData.append("type", types[typeIndex]);
53+
54+
let res = await fetch("https://ffb.vn/api/tool/cookie2token", {
55+
method: "POST",
56+
body: formData,
57+
});
58+
let json = await res.json();
59+
if (json.error) {
60+
alert("ERROR: " + json.msg);
61+
} else {
62+
prompt("Access token", json.token);
63+
}
64+
}
65+
})();
1666
},
1767
};

scripts/viewCookies.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,7 @@ export default {
1414
if (c == "") {
1515
alert("There is No cookie here");
1616
} else {
17-
if (
18-
confirm(
19-
"Cookies found:\n\n" + c + "\n\n - Do you want to open it in new tab?"
20-
)
21-
) {
22-
let w = window.open(
23-
"",
24-
"Links",
25-
"scrollbars,resizable,width=400,height=600"
26-
);
27-
w.document.write(c);
28-
}
17+
prompt("Cookies found:", decodeURI(c));
2918
}
3019
},
3120
};

0 commit comments

Comments
 (0)