-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
49 lines (37 loc) · 1.36 KB
/
Copy pathbackground.js
File metadata and controls
49 lines (37 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
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
47
48
49
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
if (msg.action === "inyectar") {
chrome.tabs.create({ url: "https://discord.com/login", active: true }, (tab) => {
const listener = (tabId, info) => {
if (tabId !== tab.id || info.status !== "complete") return;
chrome.tabs.onUpdated.removeListener(listener);
setTimeout(() => {
chrome.scripting.executeScript({
target: { tabId: tab.id },
func: (token) => {
if (!location.href.includes("discord.com")) {
return;
}
if (!location.href.includes("/login") && !location.href.includes("/app")) {
return;
}
const injectToken = () => {
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
iframe.contentWindow.localStorage.setItem("token", `"${token}"`);
iframe.remove();
};
injectToken();
setTimeout(injectToken, 2000);
setTimeout(injectToken, 2000);
setTimeout(() => {
location.reload();
}, 2200);
},
args: [msg.token]
});
}, 3500);
};
chrome.tabs.onUpdated.addListener(listener);
});
}
});