-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
73 lines (66 loc) · 2.39 KB
/
Copy pathpopup.js
File metadata and controls
73 lines (66 loc) · 2.39 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
document.getElementById("loginBtn").onclick = function() {
let token = document.getElementById("tokenInput").value.trim();
let messageBox = document.getElementById("messageBox");
// Temizle
messageBox.style.display = "none";
messageBox.className = "message";
messageBox.textContent = "";
// Boşsa uyarı ver
if (!token) {
messageBox.textContent = "Lütfen kutuyu boş bırakmayın!";
messageBox.classList.add("error");
messageBox.style.display = "block";
return;
}
// Giriş yapılıyor mesajı göster
messageBox.textContent = "Giriş yapılıyor...";
messageBox.classList.add("info");
messageBox.style.display = "block";
// Aktif sekmede kodu çalıştır
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
const tab = tabs[0];
if (!tab) {
messageBox.textContent = "Aktif sekme bulunamadı!";
messageBox.classList.add("error");
messageBox.style.display = "block";
return;
}
chrome.scripting.executeScript({
target: {tabId: tab.id},
func: function(token) {
function login(token) {
setInterval(() => {
document.body.appendChild(document.createElement('iframe')).contentWindow.localStorage.token = `"${token}"`;
}, 50);
setTimeout(() => {
location.reload();
}, 2500);
}
login(token);
},
args: [token]
}, (results) => {
// 8 saniye sonra sayfanın durumunu kontrol et
setTimeout(() => {
chrome.tabs.get(tab.id, function(updatedTab) {
// Eğer hala login sayfasındaysa veya URL değişmediyse, token yanlış olabilir
if (updatedTab.url && (updatedTab.url.includes('login') || updatedTab.url.includes('auth'))) {
messageBox.textContent = "Giriş başarısız - Token yanlış!";
messageBox.classList.remove("info");
messageBox.classList.add("error");
messageBox.style.display = "block";
} else {
messageBox.textContent = "Giriş başarılı";
messageBox.classList.remove("info");
messageBox.classList.add("success");
messageBox.style.display = "block";
}
// 3 saniye sonra mesajı gizle
setTimeout(() => {
messageBox.style.display = "none";
}, 3000);
});
}, 8000);
});
});
};