-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.html
524 lines (479 loc) · 21.2 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
<!DOCTYPE html>
<html>
<head>
<title>Admin Panel</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin-top: 50px;
}
.btn {
margin: 10px;
}
.button-container {
display: flex;
}
.container {
text-align: center;
width: 100%;
box-sizing: border-box;
}
#expandedSection {
display: none;
width: 100vw; /* Set the width to 100% of the viewport width */
height: 100vh; /* Set the height to 100% of the viewport height */
}
#listTypeDropdown {
width: 200px; /* Set a fixed width */
border: 1px solid #ced4da; /* Border color */
border-radius: 4px; /* Rounded corners */
padding: 5px 10px; /* Padding for text */
font-size: 16px; /* Font size */
color: #495057; /* Text color */
background-color: #fff; /* Background color */
appearance: none; /* Remove default appearance */
cursor: pointer; /* Change cursor to pointer on hover */
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; /* Smooth transition for hover effects */
}
#recordTypeDropdown {
width: 200px; /* Set a fixed width */
border: 1px solid #ced4da; /* Border color */
border-radius: 4px; /* Rounded corners */
padding: 5px 10px; /* Padding for text */
font-size: 16px; /* Font size */
color: #495057; /* Text color */
background-color: #fff; /* Background color */
appearance: none; /* Remove default appearance */
cursor: pointer; /* Change cursor to pointer on hover */
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; /* Smooth transition for hover effects */
}
#recordTypeDropdown:hover {
border-color: #80bdff; /* Border color on hover */
outline: 0;
box-shadow: 0 0 0 0.01rem rgba(0, 123, 255, 0.25); /* Add a shadow on hover */
}
#recordTypeDropdown:focus {
border-color: #80bdff; /* Border color on focus */
outline: 0;
box-shadow: 0 0 0 0.01rem rgba(0, 123, 255, 0.25); /* Add a shadow on hover */
}
#listTypeDropdown:hover {
border-color: #80bdff; /* Border color on hover */
outline: 0;
box-shadow: 0 0 0 0.01rem rgba(0, 123, 255, 0.25); /* Add a shadow on hover */
}
#listTypeDropdown:focus {
border-color: #80bdff; /* Border color on focus */
outline: 0;
box-shadow: 0 0 0 0.01rem rgba(0, 123, 255, 0.25); /* Add a shadow on hover */
}
.table-responsive {
width: 100%; /* Ensure it takes the full width */
margin: 0px 0; /* Add some spacing between tables if they wrap */
overflow-x: visible;
}
#sectionTitle {
font-size: 24px;
margin-bottom: 20px;
}
.level-entry {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
border-bottom: 1px solid #ddd;
}
.placeHereButton {
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
padding: 5px 10px;
border-radius: 5px;
}
table tr:nth-child(odd).updated,
table tr:nth-child(even).updated {
background-color: #ffff99 !important; /* Light yellow */
}
table tr:nth-child(odd).checked,
table tr:nth-child(even).checked {
background-color: #80d0a2 !important; /* Light yellow */
}
body {
/*\\ -ms-overflow-style: none;
scrollbar-width: none; */
overflow-y: scroll;
overflow-x: hidden;
-webkit-font-smoothing: antialiased;
font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
line-height: 1.25;
box-sizing: border-box;
/* width: 100%; */
min-height: 100%;
margin: 0;
padding-top : 128px;
position: relative;
}
.no-wrap {
white-space: nowrap;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
</head>
<body>
<div class="header">
<a id="home-link" href="index.html">
<div class="left-section">
<img class="main-icon" src="icons/xylzicon.png">
<div class="main-title">xylz</div>
</div>
</a>
<div class="middle-section">
<a href="https://www.twitch.tv/xylzlol" target="_blank">
<img src="icons/logo--twitch.svg" alt="Twitch icon" class="twitch-icon">
</a>
<a href="https://www.youtube.com/xylzz" target="_blank">
<img src="icons/logo--youtube.svg" alt="Youtube icon" class="youtube-icon">
</a>
<a href="https://discord.com/invite/HMjWaGh" target="_blank">
<img src="icons/logo--discord.svg" alt="Discord icon" class="discord-icon">
</a>
<a href="https://twitter.com/Xylz97751031" target="_blank">
<img src="icons/logo--twitter.svg" alt="Twitter icon" class="twitter-icon">
</a>
</div>
<div class="right-section">
<div class="loggedInButton">
<a class="nav-link-button" href="/account.html">Account</a>
</div>
<li class="loggedOutButtons no-wrap">
<a class="nav-link-button" href="/signup.html">Sign Up</a>
</li>
<li class="loggedOutButtons no-wrap">
<a class="nav-link-button" href="/signin.html">Sign In</a>
</li>
<button class="button-54" role="button" onclick="window.location.href='legacy.html'">legacy</button>
<button class="button-54" role="button" onclick="window.location.href='/leaderboard.html'">Leaderboard</button>
</div>
<div class="hamburger-menu">
<input type="checkbox" id="checkbox">
<label for="checkbox" class="toggle">
<div class="bar bar--top"></div>
<div class="bar bar--middle"></div>
<div class="bar bar--bottom"></div>
</label>
<ul class="menu">
<li role="button" onclick="window.location.href='/leaderboard.html'">Leaderboard</li>
<li role="button" onclick="window.location.href='/legacy.html'">Legacy</li>
<li role="button" class="loggedInButton" onclick="window.location.href='/level_submission_form.html'">Submit Level</li>
<li role="button" class="loggedInButton" onclick="window.location.href='/record_submission_form.html'">Submit Record</li>
<li role="button" class="loggedOutButtons" onclick="window.location.href='/signin.html'">Sign in</li>
<li role="button" class="loggedOutButtons" onclick="window.location.href='/signup.html'">Sign Up</li>
<li role="button" class="loggedInButton" onclick="window.location.href='/account.html'">Account</li>
</ul>
</div>
</div>
<div class="container" id="adminPanel">
<h1>Admin Panel</h1>
<button class="btn btn-primary" id="levelsButton">Levels</button>
<button class="btn btn-primary" id="usersButton">Users</button>
<button class="btn btn-primary" id="recordsButton">Records</button>
</div>
<div class="container container-fluid" id="expandedSection">
<h1 id="sectionTitle"></h1>
<button class="btn btn-secondary" id="backButton">Back</button>
<!-- The content for each section will be dynamically loaded here -->
<button class="btn btn-success" id="saveChangesButton">Save Changes</button>
<select id="listTypeDropdown">
<option value="mainlist">Main List</option>
<option value="legacy_levels">Legacy Levels</option>
<option value="removed_levels">Removed Levels</option>
<option value="pending_levels">Pending Levels</option>
</select>
<select id="recordTypeDropdown">
<option value="records">Records</option>
<option value="pending_records">Pending Records</option>
</select>
<div style="display: flex; justify-content: space-between;">
<div class="table-responsive" style="width: 100%;">
<button id="fetchUpdatesButton" class="btn btn-primary" style="display: none; float: right;">Fetch Updates</button>
<button id="restoreBackupButton" class="btn btn-primary" style="display: none; float: left;">Restore Backup</button>
<button id="fetchUpdatesCancelButton" class="btn btn-danger" style="display: none;">Cancel Fetching</button>
<div id="fetchingUpdates" style="display: none;">
<div class="spinner-border text-primary" role="status">
<span class="sr-only">Loading...</span>
</div>
<span>Fetching Updates...</span>
</div>
<div id="progress-bar-container" style="width: 100%; display: none;">
<div id="progress-bar" style="width: 0%; height: 20px; background-color: #2196F3;">
</div>
</div>
<table id="levelsTable" class="table table-striped table-bordered table-hover display">
<thead>
<tr>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<div class="container" id="notAdminMessage" style="display: none;">
<div style="animation: bounce; animation-duration: 2s;">
<h2>You do not have permission to access this page, silly goose.</h2>
<img src="/images/sillygoose.png" alt="Silly Goose">
</div>
</div>
<div class="modal fade" id="restoreBackupModal" tabindex="-1" role="dialog" aria-labelledby="restoreBackupModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="restoreBackupModalLabel">Restore Backup</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table class="table" id="backupTable">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Backup File</th>
</tr>
</thead>
<tbody>
<!-- Backup files will be inserted here -->
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary">Restore</button>
</div>
</div>
</div>
</div>
<!-- Backup Contents Modal -->
<div class="modal fade" id="backupContentsModal" tabindex="-1" role="dialog" aria-labelledby="backupContentsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="backupContentsModalLabel">Backup Contents</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- Contents will be displayed here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<!-- Fetch Updates Modal -->
<div class="modal fade" id="fetchUpdatesModal" tabindex="-1" role="dialog" aria-labelledby="fetchUpdatesModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fetchUpdatesModalLabel">Fetch Updates</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
This will fetch updates for all levels. Please note that this operation takes VERY LONG as it is extremely rate-limited to avoid getting IP-banned by robtop.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="fetchUpdatesContinueButton"data-dismiss="modal">Continue</button>
</div>
</div>
</div>
</div>
<!-- The Generic Modal -->
<div class="modal fade" id="genericModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title" id="genericModalTitle"></h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body" id="genericModalBody">
<!-- Content will be injected here -->
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="genericModalPrimaryBtn">Save</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Edit Level Modal -->
<div class="modal fade" id="editModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title" id="editModalTitle">Edit Level</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<form id="editLevelForm">
<div class="form-group">
<label for="editModalName">Name:</label>
<input type="text" class="form-control" id="editModalName" required>
</div>
<div class="form-group">
<label for="editModalID">ID:</label>
<input type="text" class="form-control" id="editModalID" required>
</div>
<div class="form-group">
<label for="editModalCreator">Creator:</label>
<input type="text" class="form-control" id="editModalCreator" required>
</div>
<div class="form-group">
<label for="editModalVerifier">Verifier:</label>
<input type="text" class="form-control" id="editModalVerifier" required>
</div>
<div class="form-group">
<label for="editModalLink">YouTube Link:</label>
<input type="url" class="form-control" id="editModalLink" required>
</div>
<div class="form-group">
<label for="editModalNong" id="nongLabel" style="display: none;">Nong:</label>
<audio controls id="editModalNong" style="display: none;"></audio>
<button id="deleteNongButton" type="button" style="display: none;">Delete NONG</button>
</div>
</form>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="editModalSaveBtn">Save Changes</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Remove Level Confirmation Modal -->
<div class="modal fade" id="removeModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Remove Level</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<p id="removeModalMessage"></p>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" id="removeModalConfirmBtn">Remove</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<!-- Delete User Modal -->
<div class="modal fade" id="deleteUserModal" tabindex="-1" role="dialog" aria-labelledby="deleteUserModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteUserModalLabel">Delete</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Are you sure you want to delete <strong id="deleteModalUsername"></strong>?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" id="deleteUserModalConfirmBtn">Delete</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="reviewModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="reviewModalTitle">Review Record</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<h6 id="levelTitle"></h6>
<iframe id="youtubeEmbed" width="100%" height="315" frameborder="0" allowfullscreen></iframe>
<div id="recordInfo"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" onclick="denyRecord()">Deny</button>
<button type="button" class="btn btn-success" onclick="acceptRecord()">Accept</button>
</div>
</div>
</div>
</div>
<!-- Edit User Modal -->
<div class="modal fade" id="editUserModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Edit User</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<form id="editUserForm">
<div class="form-group">
<label for="editModalUsername">Username:</label>
<input type="text" class="form-control" id="editModalUsername" required>
</div>
<div class="form-group">
<label for="editModalGDe">GD User:</label>
<input type="text" class="form-control" id="editModalGDe">
</div>
<div class="form-group">
<label for="editModalIsAdmin">Permission Level:</label>
<input type="number" id="editModalPermissionLevel" min="0" max="2">
</div>
</form>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="editUserModalSaveBtn">Save Changes</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.14.0/Sortable.min.js"></script>
<script type="module" data-cfasync="false" src="/js/admin.js"></script>
<script type="module" data-cfasync="false" src="/js/admin/users.js"></script>
<script type="module" data-cfasync="false" src="/js/admin/records.js" defer></script>
<link rel="stylesheet" href="css/header.css">
<script type="module" data-cfasync="false"src="js/authCheck.js" defer></script>
</body>
</html>