Skip to content

Commit 7da283a

Browse files
author
hoang.tran12
committed
merge request fb token + refactor
1 parent 77a6426 commit 7da283a

File tree

9 files changed

+69
-14
lines changed

9 files changed

+69
-14
lines changed

popup/helpers/checkForUpdate.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ export async function checkForUpdate() {
1212

1313
const { version_check, source_code } = config;
1414
const lastestVer = (await (await fetch(version_check)).json()).version;
15-
if (lastestVer > currentVer) {
15+
if (lastestVer >= currentVer) {
1616
updateBtn.style.display = "inline-block";
1717
updateBtn.innerHTML = t({
1818
vi: "cập nhật v" + lastestVer,
1919
en: "update v" + lastestVer,
2020
});
21+
updateBtn.setAttribute(
22+
"data-tooltip",
23+
t({ vi: "Đã có phiên bản mới", en: "Update available" })
24+
);
25+
updateBtn.setAttribute("data-flow", "bottom");
2126
updateBtn.onclick = () => {
2227
trackEvent("CHECK-FOR-UPDATE");
2328
window.open(source_code);

popup/popup.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ <h3>
5050
</div>
5151

5252
<!-- settings -->
53-
<div class="settings" data-tooltip="Settings" data-flow="left">
53+
<div class="settings" title="Settings" data-tooltip="Settings" data-flow="left">
5454
<i class="fa-solid fa-gear fa-lg"></i>
5555
</div>
5656

5757
<!-- reload -->
58-
<div class="reload" data-tooltip="Reload extension" data-flow="right">
58+
<div class="reload" title="Reload extension" data-tooltip="Reload extension" data-flow="right">
5959
<i class="fa-solid fa-arrows-rotate fa-lg"></i>
6060
</div>
6161

@@ -75,7 +75,7 @@ <h3 class="title">Modal Title</h3>
7575
</div>
7676

7777
<!-- scroll to top -->
78-
<div id="scroll-to-top" class="hide">
78+
<div id="scroll-to-top" class="hide" title="Scroll to top">
7979
<i class="fa-solid fa-arrow-up fa-lg"></i>
8080
</div>
8181

popup/tabs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ const tabs = [
338338
s.fb_getTokenFfb,
339339
s.fb_getTokenFacebook,
340340
s.fb_getTokenBussinessLocation,
341+
s.fb_getTokenMessage,
341342
// s.fb_getTokenBusinessStudio,
342343
s.fb_getTokenCampaigns,
343344
createTitle("--- Get ID ---", "--- Lấy ID ---"),

scripts/fb_getTokenBusinessStudio.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export default {
55
vi: "Lấy fb token EAAc (studio)",
66
},
77
description: {
8-
en: "Get facebook access token from business.facebook.com",
9-
vi: "Lấy facebook access token từ trang business.facebook.com",
8+
en: "Get facebook access token EAAc from business.facebook.com",
9+
vi: "Lấy facebook access token EAAc từ trang business.facebook.com",
1010
},
1111

1212
popupScript: {

scripts/fb_getTokenCampaigns.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export default {
55
vi: "Lấy fb token EAAB (campaigns)",
66
},
77
description: {
8-
en: "Get facebook token EAAG from www.facebook.com campaigns",
9-
vi: "Lấy facebook token EAAG từ www.facebook.com campaigns",
8+
en: "Get facebook token EAAB from www.facebook.com (campaigns)",
9+
vi: "Lấy facebook token EAAB từ www.facebook.com (campaigns)",
1010
},
1111

1212
popupScript: {

scripts/fb_getTokenFacebook.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export default {
55
vi: "Lấy fb token EAAB (instagram)",
66
},
77
description: {
8-
en: "Get facebook access token from www.facebook.com",
9-
vi: "Lấy facebook access token từ trang www.facebook.com",
8+
en: "Get facebook access token EAAB from www.facebook.com",
9+
vi: "Lấy facebook access token EAAB từ trang www.facebook.com",
1010
},
1111
whiteList: ["https://*.facebook.com/*"],
1212

scripts/fb_getTokenMessage.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
export default {
2+
icon: `<i class="fa-solid fa-key fa-lg"></i>`,
3+
name: {
4+
en: "Get fb token EAADo1 (messenger)",
5+
vi: "Lấy fb token EAADo1 (messenger)",
6+
},
7+
description: {
8+
en: "Get facebook access token from www.facebook.com (messenger_for_android)",
9+
vi: "Lấy facebook access token từ trang www.facebook.com (messenger_for_android)",
10+
},
11+
whiteList: ["https://*.facebook.com/*"],
12+
13+
pageScript: {
14+
onClick: function () {
15+
try {
16+
let uid = /(?<=c_user=)(\d+)/.exec(document.cookie)?.[0];
17+
if (!uid) {
18+
alert("Không tìm thấy uid trong cookie. Bạn đã đăng nhập chưa?");
19+
return;
20+
}
21+
let dtsg =
22+
require("DTSGInitialData").token ||
23+
document.querySelector('[name="fb_dtsg"]').value,
24+
xhr = new XMLHttpRequest(),
25+
data = new FormData(),
26+
url = `https://www.facebook.com/dialog/oauth/business/cancel/?app_id=256002347743983&version=v19.0&logger_id=&user_scopes[0]=email&user_scopes[1]=read_insights&user_scopes[2]=read_page_mailboxes&user_scopes[3]=pages_show_list&redirect_uri=fbconnect%3A%2F%2Fsuccess&response_types[0]=token&response_types[1]=code&display=page&action=finish&return_scopes=false&return_format[0]=access_token&return_format[1]=code&tp=unspecified&sdk=&selected_business_id=&set_token_expires_in_60_days=false`;
27+
data.append("fb_dtsg", dtsg);
28+
29+
xhr.open("POST", url, !0);
30+
xhr.onreadystatechange = function () {
31+
if (4 == xhr.readyState && 200 == xhr.status) {
32+
var a = xhr.responseText.match(/(?<=access_token=)(.*?)(?=\&)/);
33+
console.log(xhr.responseText);
34+
if (a && a[0]) {
35+
prompt("Token", a[0]);
36+
} else {
37+
alert("Failed to Get Access Token.");
38+
}
39+
}
40+
};
41+
xhr.send(data);
42+
} catch (e) {
43+
alert("ERROR: " + e);
44+
}
45+
},
46+
},
47+
};

scripts/fb_revealDeletedMessages.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ export default {
262262
else if (
263263
confirm(
264264
`Bạn có chắc muốn xóa tất cả ${len} tin nhắn` +
265-
` đã được lưu bởi chức năng này?\n\n` +
266-
`+ Chỉ nên xóa khi thấy đã lưu quá nhiều tin nhắn.\n` +
267-
`+ Sau khi xóa, nếu có người thu hồi tin nhắn, mà tin đó chưa được lưu\n` +
268-
` thì bạn sẽ ko biết được nội dung tin nhắn.`
265+
` đã được lưu bởi chức năng này?\n\n` +
266+
`+ Chỉ nên xóa khi thấy đã lưu quá nhiều tin nhắn.\n` +
267+
`+ Sau khi xóa, nếu có người thu hồi tin nhắn, mà tin đó chưa được lưu\n` +
268+
` thì bạn sẽ ko biết được nội dung tin nhắn.`
269269
)
270270
) {
271271
window.ufs_rvdfm_all_msgs = {};

scripts/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ import chongLuaDao from "./chongLuaDao.js";
163163
import prevent_closeBrowser_lastTab from "./prevent_closeBrowser_lastTab.js";
164164
import createInvisibleText from "./createInvisibleText.js";
165165
import smoothScroll from "./smoothScroll.js";
166+
import fb_getTokenMessage from "./fb_getTokenMessage.js";
166167

167168
// inject badges
168169
const allScripts = {
@@ -345,6 +346,7 @@ const allScripts = {
345346
),
346347
createInvisibleText: addBadge(createInvisibleText, BADGES.new),
347348
smoothScroll: addBadge(smoothScroll, BADGES.new),
349+
fb_getTokenMessage: addBadge(fb_getTokenMessage, BADGES.new),
348350
};
349351

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

0 commit comments

Comments
 (0)