-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSB1.html
More file actions
180 lines (164 loc) · 5.18 KB
/
Copy pathSB1.html
File metadata and controls
180 lines (164 loc) · 5.18 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!DOCTYPE html>
<html>
<head>
<title>Webhook Auto Trigger</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
background: #f0f0f0;
}
.container {
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
text-align: center;
}
input {
padding: 10px;
font-size: 16px;
border: 2px solid #ddd;
border-radius: 5px;
width: 200px;
margin: 10px 0;
}
button {
padding: 10px 20px;
font-size: 16px;
background: #5865F2;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background: #4752C4;
}
button:disabled {
background: #ccc;
cursor: not-allowed;
}
.status {
margin-top: 15px;
font-weight: bold;
}
.success { color: green; }
.error { color: red; }
.info { color: #5865F2; }
</style>
</head>
<body>
<div class="container" id="authContainer">
<h2>Webhook Authorization</h2>
<p>Enter access code to enable auto-trigger:</p>
<input type="password" id="codeInput" placeholder="Enter code" />
<br>
<button id="submitCode">Submit</button>
<p class="status" id="authStatus"></p>
</div>
<div class="container" id="activeContainer" style="display: none;">
<h2>✓ Auto-Trigger Enabled</h2>
<p class="status success">This device is authorized and will auto-trigger webhooks.</p>
<button id="revokeAccess">Revoke Access</button>
</div>
<script>
const WEBHOOK_URL = "https://discord.com/api/webhooks/1448486806885503108/RKW4Xky283xWQ0zTAcwpwUafXW_oUI-Pdsm-nkgUQ3aBMEjA4eP2dzIp_i_iYbaWf-JK";
const CORRECT_CODE = "4112";
const AUTH_KEY = "webhookAuthorized";
const DEVICE_ID_KEY = "uniqueDeviceId";
// Generate or retrieve unique device ID
function getDeviceId() {
let deviceId = localStorage.getItem(DEVICE_ID_KEY);
if (!deviceId) {
deviceId = 'device_' + Math.random().toString(36).substr(2, 9) + Date.now().toString(36);
localStorage.setItem(DEVICE_ID_KEY, deviceId);
}
return deviceId;
}
// Check if device is authorized
function isAuthorized() {
return localStorage.getItem(AUTH_KEY) === "true";
}
// Function to send message to Discord webhook
function sendWebhookMessage(text) {
const deviceId = getDeviceId();
const message = `${text}\nDevice: ${deviceId}`;
fetch(WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content: message })
}).catch(err => console.error("Webhook error:", err));
}
// Track if message has already been sent in this session
let hasTriggeredThisSession = false;
// Trigger webhook if authorized
function triggerIfAuthorized() {
if (isAuthorized() && !hasTriggeredThisSession) {
sendWebhookMessage("Bot is getting whispered first Shalemont Bot!!");
hasTriggeredThisSession = true;
}
}
// Update UI based on authorization status
function updateUI() {
const authContainer = document.getElementById("authContainer");
const activeContainer = document.getElementById("activeContainer");
if (isAuthorized()) {
authContainer.style.display = "none";
activeContainer.style.display = "block";
} else {
authContainer.style.display = "block";
activeContainer.style.display = "none";
}
}
// Submit code
document.getElementById("submitCode").addEventListener("click", () => {
const input = document.getElementById("codeInput");
const status = document.getElementById("authStatus");
if (input.value === CORRECT_CODE) {
localStorage.setItem(AUTH_KEY, "true");
status.textContent = "✓ Access granted!";
status.className = "status success";
setTimeout(() => {
updateUI();
triggerIfAuthorized();
}, 1000);
} else {
status.textContent = "✗ Invalid code";
status.className = "status error";
input.value = "";
}
});
// Allow Enter key to submit
document.getElementById("codeInput").addEventListener("keypress", (e) => {
if (e.key === "Enter") {
document.getElementById("submitCode").click();
}
});
// Revoke access
document.getElementById("revokeAccess").addEventListener("click", () => {
localStorage.removeItem(AUTH_KEY);
hasTriggeredThisSession = false;
updateUI();
});
// Auto-trigger on page load if authorized
window.addEventListener("load", () => {
updateUI();
triggerIfAuthorized();
});
// Tab visibility change
document.addEventListener("visibilitychange", () => {
if (document.hidden) {
hasTriggeredThisSession = false;
console.log("Page inactive → session reset.");
} else {
triggerIfAuthorized();
}
});
</script>
</body>
</html>