-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.html
232 lines (209 loc) · 8.18 KB
/
admin.html
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
}
#login-section, #admin-section {
margin-top: 50px;
padding: 20px;
background-color: white;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
#controls {
margin-bottom: 20px;
}
#controls label, #controls input, #controls button {
margin-right: 10px;
}
#items-container .item {
border: 1px solid #ddd;
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
background-color: #fff;
}
#items-container .item-buttons button {
margin-right: 5px;
}
</style>
</head>
<body>
<div id="login-section">
<h2>Admin Login</h2>
<form id="login-form">
<label for="adminname">Admin Name:</label>
<input type="text" id="adminname" name="adminname" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<button type="submit">Login</button>
</form>
<div id="login-message"></div>
</div>
<div id="admin-section" style="display:none;">
<h2>Admin Panel</h2>
<div id="controls">
<label for="size-limit">Size Limit [MB] :</label>
<input type="number" id="size-limit" name="size-limit">
<button onclick="setSizeLimit()">Set Size Limit</button>
<label for="moderate-toggle">Moderate:</label>
<input type="checkbox" id="moderate-toggle" onchange="toggleModerate()">
<label for="shutdown-toggle">Shutdown:</label>
<input type="checkbox" id="shutdown-toggle" onchange="toggleShutdown()">
</div>
<div id="items-container"></div>
</div>
<script>
document.getElementById('login-form').addEventListener('submit', function(event) {
event.preventDefault();
const adminname = document.getElementById('adminname').value;
const password = document.getElementById('password').value;
fetch('https://1234gds.pythonanywhere.com/verify', {
method: 'POST',
headers: {
'adminname': adminname,
'password': password
}
})
.then(response => response.text())
.then(text => {
if (text === 'success') {
document.getElementById('login-section').style.display = 'none';
document.getElementById('admin-section').style.display = 'block';
fetchItems(adminname, password);
} else {
document.getElementById('login-message').innerText = 'Login failed!';
}
});
});
function fetchItems(adminname, password) {
fetch('https://1234gds.pythonanywhere.com/results', {
headers: {
'adminname': adminname,
'password': password
}
})
.then(response => response.json())
.then(data => {
const container = document.getElementById('items-container');
container.innerHTML = '';
data.forEach(item => {
const itemDiv = document.createElement('div');
itemDiv.className = 'item';
itemDiv.innerHTML = `
<p>ID: ${item.id}</p>
<p>URL: ${item.details.url}</p>
<p>Name: ${item.details.name}</p>
<p>Size: ${item.details.size}</p>
<p>Hash: ${item.details.hash}</p>
<p>IP: ${item.details.ip}</p>
<div class="item-buttons">
<button onclick="banFile('${item.id}')">Ban File</button>
<button onclick="banIP('${item.details.ip}')">Ban IP</button>
<button onclick="approve('${item.id}')">Approve</button>
<button onclick="ignore('${item.id}')">Ignore</button>
</div>
`;
container.appendChild(itemDiv);
});
});
}
function setSizeLimit() {
const size = document.getElementById('size-limit').value;
const adminname = document.getElementById('adminname').value;
const password = document.getElementById('password').value;
fetch('https://1234gds.pythonanywhere.com/sizelimit', {
method: 'POST',
headers: {
'size': size,
'adminname': adminname,
'password': password
}
});
}
function toggleModerate() {
const moderate = document.getElementById('moderate-toggle').checked;
const adminname = document.getElementById('adminname').value;
const password = document.getElementById('password').value;
fetch(`https://1234gds.pythonanywhere.com/${moderate ? 'moderate_on' : 'moderate_off'}`, {
method: 'POST',
headers: {
'adminname': adminname,
'password': password
}
});
}
function toggleShutdown() {
const shutdown = document.getElementById('shutdown-toggle').checked;
const adminname = document.getElementById('adminname').value;
const password = document.getElementById('password').value;
fetch(`https://1234gds.pythonanywhere.com/${shutdown ? 'shutdown_on' : 'shutdown_off'}`, {
method: 'POST',
headers: {
'adminname': adminname,
'password': password
}
});
}
function banFile(id) {
const adminname = document.getElementById('adminname').value;
const password = document.getElementById('password').value;
fetch('https://1234gds.pythonanywhere.com/banfile', {
method: 'POST',
headers: {
'id': id,
'adminname': adminname,
'password': password
}
});
}
function banIP(ip) {
const adminname = document.getElementById('adminname').value;
const password = document.getElementById('password').value;
fetch('https://1234gds.pythonanywhere.com/banip', {
method: 'POST',
headers: {
'ip': ip,
'adminname': adminname,
'password': password
}
});
}
function approve(id) {
const adminname = document.getElementById('adminname').value;
const password = document.getElementById('password').value;
fetch('https://1234gds.pythonanywhere.com/approve', {
method: 'POST',
headers: {
'id': id,
'adminname': adminname,
'password': password
}
});
}
function ignore(id) {
const adminname = document.getElementById('adminname').value;
const password = document.getElementById('password').value;
fetch('https://1234gds.pythonanywhere.com/ignore', {
method: 'POST',
headers: {
'id': id,
'adminname': adminname,
'password': password
}
});
}
</script>
</body>
</html>