-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathgithub-token-validator-retro.html
More file actions
514 lines (451 loc) · 14.4 KB
/
Copy pathgithub-token-validator-retro.html
File metadata and controls
514 lines (451 loc) · 14.4 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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GitHub Token Validator Retro — One File Tools</title>
<meta name="description" content="Validate GitHub Personal Access Tokens and view account ownership and scopes with a retro terminal theme." />
<style>
/* Retro Green Phosphor CRT Terminal styling */
@import url("https://fonts.googleapis.com/css2?family=VT323&display=swap");
:root {
--color-bg: #030804;
--color-text: #00ff66;
--color-text-dim: #008833;
--color-text-glow: rgba(0, 255, 102, 0.6);
--color-border: #00ff66;
--color-error: #ff3333;
--color-error-glow: rgba(255, 51, 51, 0.6);
--color-success: #00ff66;
--color-success-glow: rgba(0, 255, 102, 0.8);
--font-mono: "VT323", "Courier New", Courier, monospace;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: var(--color-bg);
color: var(--color-text);
font-family: var(--font-mono);
font-size: 1.5rem;
line-height: 1.4;
min-height: 100vh;
padding: 20px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
overflow-x: hidden;
}
/* CRT Scanline overlay */
.scanlines {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
background-size: 100% 4px;
z-index: 1000;
pointer-events: none;
}
/* Vignette overlay */
.vignette {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.7) 120%);
z-index: 1001;
pointer-events: none;
}
/* Screen flicker animation */
@keyframes flicker {
0% {
opacity: 0.99;
}
50% {
opacity: 1;
}
100% {
opacity: 0.99;
}
}
.terminal-screen {
width: 100%;
max-width: 720px;
background-color: rgba(2, 10, 3, 0.9);
border: 3px double var(--color-border);
box-shadow:
0 0 25px var(--color-text-glow),
inset 0 0 15px rgba(0, 255, 102, 0.15);
padding: 30px;
border-radius: 4px;
position: relative;
animation: flicker 0.15s infinite;
}
/* ASCII Art */
.ascii-art {
font-size: 0.75rem;
line-height: 1.15;
white-space: pre;
margin-bottom: 20px;
text-shadow: 0 0 5px var(--color-text-glow);
text-align: center;
display: flex;
justify-content: center;
overflow-x: auto;
}
header {
margin-bottom: 25px;
border-bottom: 1px dashed var(--color-border);
padding-bottom: 15px;
}
h1 {
font-size: 2.3rem;
text-align: center;
text-transform: uppercase;
letter-spacing: 2px;
text-shadow: 0 0 8px var(--color-text-glow);
margin-bottom: 8px;
}
.description {
font-size: 1.25rem;
text-align: center;
color: var(--color-text-dim);
}
.terminal-row {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
font-size: 1.3rem;
text-transform: uppercase;
letter-spacing: 1px;
text-shadow: 0 0 5px var(--color-text-glow);
}
.input-container {
display: flex;
background-color: rgba(0, 0, 0, 0.6);
border: 1px solid var(--color-border);
padding: 8px 12px;
box-shadow: inset 0 0 8px rgba(0, 255, 102, 0.2);
align-items: center;
}
.prompt-indicator {
margin-right: 10px;
user-select: none;
text-shadow: 0 0 5px var(--color-text-glow);
}
input[type="text"],
input[type="password"] {
flex: 1;
background: transparent;
border: none;
outline: none;
color: var(--color-text);
font-family: var(--font-mono);
font-size: 1.4rem;
text-shadow: 0 0 5px var(--color-text-glow);
width: 100%;
}
input::placeholder {
color: var(--color-text-dim);
opacity: 0.5;
}
.control-panel {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 15px;
margin-top: 15px;
}
.checkbox-container {
display: flex;
align-items: center;
cursor: pointer;
user-select: none;
font-size: 1.2rem;
}
.checkbox-container input {
display: none;
}
.custom-checkbox {
width: 18px;
height: 18px;
border: 1px solid var(--color-border);
margin-right: 8px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.6);
box-shadow: inset 0 0 4px rgba(0, 255, 102, 0.2);
}
.checkbox-container input:checked + .custom-checkbox::after {
content: "[X]";
color: var(--color-text);
font-size: 1.1rem;
text-shadow: 0 0 3px var(--color-text-glow);
}
.checkbox-container input:not(:checked) + .custom-checkbox::after {
content: "[ ]";
color: var(--color-text-dim);
font-size: 1.1rem;
}
.checkbox-label {
text-shadow: 0 0 3px var(--color-text-glow);
}
.btn-validate {
background-color: transparent;
border: 1px solid var(--color-border);
color: var(--color-text);
font-family: var(--font-mono);
font-size: 1.4rem;
padding: 8px 24px;
cursor: pointer;
text-transform: uppercase;
box-shadow: 0 0 5px rgba(0, 255, 102, 0.2);
transition: all 0.2s ease;
text-shadow: 0 0 5px var(--color-text-glow);
}
.btn-validate:hover {
background-color: var(--color-text);
color: var(--color-bg);
box-shadow: 0 0 15px var(--color-text-glow);
text-shadow: none;
}
.btn-validate:active {
transform: scale(0.98);
}
.console-log {
background-color: rgba(0, 0, 0, 0.8);
border: 1px solid var(--color-border);
min-height: 180px;
padding: 15px;
box-shadow: inset 0 0 10px rgba(0, 255, 102, 0.15);
margin-top: 25px;
font-size: 1.3rem;
overflow-y: auto;
max-height: 250px;
}
.log-line {
margin-bottom: 6px;
word-break: break-all;
}
.log-line::before {
content: "> ";
color: var(--color-text-dim);
}
.log-error {
color: var(--color-error);
text-shadow: 0 0 5px var(--color-error-glow);
}
.log-error::before {
content: "❌ ";
color: var(--color-error);
}
.log-success {
color: var(--color-success);
text-shadow: 0 0 8px var(--color-success-glow);
}
.log-success::before {
content: "✓ ";
color: var(--color-success);
}
.blinking-cursor {
display: inline-block;
width: 10px;
height: 1.3rem;
background-color: var(--color-text);
margin-left: 4px;
animation: blink 1s infinite steps(2);
vertical-align: middle;
}
@keyframes blink {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0;
}
}
footer {
margin-top: 30px;
text-align: center;
font-size: 1.1rem;
color: var(--color-text-dim);
}
footer a {
color: var(--color-text);
text-decoration: none;
border-bottom: 1px dashed var(--color-text);
}
footer a:hover {
background-color: var(--color-text);
color: var(--color-bg);
text-shadow: none;
}
/* Adjust styling for validation state transitions */
.error-theme {
--color-border: var(--color-error);
--color-text: var(--color-error);
--color-text-glow: var(--color-error-glow);
--color-text-dim: #990000;
}
.success-theme {
--color-border: #00ff66;
--color-text: #00ff66;
--color-text-glow: var(--color-success-glow);
}
/* Responsive adjustments */
@media (max-width: 600px) {
body {
padding: 10px;
font-size: 1.2rem;
}
.terminal-screen {
padding: 15px;
}
h1 {
font-size: 1.8rem;
}
.ascii-art {
font-size: 0.6rem;
}
.btn-validate {
width: 100%;
text-align: center;
}
}
</style>
</head>
<body>
<div class="scanlines"></div>
<div class="vignette"></div>
<div class="terminal-screen" id="screen">
<header>
<div class="ascii-art" aria-hidden="true">========================================= ___ ___ _____ _ _ _ _ ___ ___ ___ / __|_ _|_ _| || | | | | _ ) | _ \/ _ \ | (_ || | | | | __ | |_| | _ \ | / (_) | \___|___| |_| |_||_|\___/|___/ |_|_\\___/ =========================================</div>
<h1 id="main-title">GitHub Token Validator</h1>
<p class="description">Secure checking of GitHub Personal Access Tokens.</p>
</header>
<main>
<div class="terminal-row">
<label for="token">Input GitHub Access Token:</label>
<div class="input-container">
<span class="prompt-indicator">SYS_SECURE></span>
<input type="password" id="token" placeholder="ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" autocomplete="off" />
</div>
<div class="control-panel">
<label class="checkbox-container">
<input type="checkbox" id="toggleVisibility" />
<span class="custom-checkbox"></span>
<span class="checkbox-label">Display input characters</span>
</label>
<button class="btn-validate" id="validateBtn">VALIDATE</button>
</div>
</div>
<div class="console-log" id="consoleLog" role="log" aria-live="polite">
<div class="log-line">SYSTEM READY. AWAITING TOKEN INPUT...<span class="blinking-cursor"></span></div>
</div>
</main>
<footer>
<p>Part of <a href="https://github.com/praveenscience/One-File-Tools" target="_blank" rel="noopener noreferrer">One File Tools</a></p>
</footer>
</div>
<script>
const consoleLog = document.getElementById("consoleLog");
const screen = document.getElementById("screen");
const tokenInput = document.getElementById("token");
const toggleVisibility = document.getElementById("toggleVisibility");
const validateBtn = document.getElementById("validateBtn");
toggleVisibility.addEventListener("change", () => {
if (toggleVisibility.checked) {
tokenInput.type = "text";
} else {
tokenInput.type = "password";
}
});
function clearLog() {
consoleLog.innerHTML = "";
}
function appendLog(text, type = "normal") {
// Remove trailing cursor if exists
const oldCursor = consoleLog.querySelector(".blinking-cursor");
if (oldCursor) {
oldCursor.remove();
}
const line = document.createElement("div");
line.className = "log-line";
if (type === "error") line.classList.add("log-error");
if (type === "success") line.classList.add("log-success");
line.textContent = text;
// Add cursor to the new line
const cursor = document.createElement("span");
cursor.className = "blinking-cursor";
line.appendChild(cursor);
consoleLog.appendChild(line);
consoleLog.scrollTop = consoleLog.scrollHeight;
}
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
validateBtn.addEventListener("click", async () => {
const token = tokenInput.value.trim();
// Reset theme classes
screen.className = "terminal-screen";
clearLog();
if (!token) {
appendLog("VALIDATING TOKEN INTEGRITY...");
await sleep(200);
screen.className = "terminal-screen error-theme";
appendLog("ERROR: SECURE STRING COMPROMISED. COMPONENT: NULL_TOKEN.", "error");
appendLog("PLEASE SUPPLY A VALID GITHUB PERSONAL ACCESS TOKEN.", "error");
return;
}
appendLog("INITIALIZING HANDSHAKE...");
await sleep(250);
appendLog("CONNECTING TO ENDPOINT: api.github.com...");
await sleep(250);
appendLog("SENDING AUTHORIZATION CREDENTIALS...");
await sleep(200);
try {
const response = await fetch("https://api.github.com/user", {
headers: {
Authorization: `Bearer ${token}`
}
});
appendLog(`RESPONSE RECEIVED: STATUS ${response.status} ${response.statusText}`);
await sleep(200);
if (!response.ok) {
screen.className = "terminal-screen error-theme";
appendLog("ACCESS REJECTED. CREDENTIAL INVALID.", "error");
return;
}
const userData = await response.json();
const scopes = response.headers.get("x-oauth-scopes") || "No scopes declared (or Fine-Grained Token)";
screen.className = "terminal-screen success-theme";
appendLog("SECURITY ACCESS GRANTED.", "success");
await sleep(150);
appendLog(`OWNER : ${userData.login}`, "success");
await sleep(150);
appendLog(`ID : ${userData.id}`, "success");
await sleep(150);
appendLog(`SCOPES: ${scopes}`, "success");
await sleep(150);
appendLog("VALIDATION COMPLETE.", "success");
} catch (error) {
console.error(error);
screen.className = "terminal-screen error-theme";
appendLog("HARDWARE EXCEPTION ENCOUNTERED.", "error");
await sleep(150);
appendLog(`MESSAGE: ${error.message || "CONNECTION RESET"}`, "error");
}
});
</script>
</body>
</html>