-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallback.html
More file actions
87 lines (84 loc) · 2.4 KB
/
callback.html
File metadata and controls
87 lines (84 loc) · 2.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SmartSaber — Spotify Auth</title>
<style>
body {
font-family: system-ui, sans-serif;
max-width: 600px;
margin: 60px auto;
padding: 0 20px;
background: #121212;
color: #fff;
}
h1 { color: #1db954; }
#code-box {
width: 100%;
padding: 12px;
font-family: monospace;
font-size: 14px;
background: #282828;
color: #fff;
border: 1px solid #535353;
border-radius: 6px;
box-sizing: border-box;
margin-top: 12px;
cursor: text;
}
button {
margin-top: 10px;
padding: 10px 20px;
background: #1db954;
color: #000;
border: none;
border-radius: 20px;
font-weight: bold;
cursor: pointer;
font-size: 14px;
}
button:active { background: #17a349; }
.error { color: #f15e6c; }
p { color: #b3b3b3; }
</style>
</head>
<body>
<h1>SmartSaber</h1>
<div id="content"></div>
<script>
const params = new URLSearchParams(window.location.search);
const code = params.get('code');
const error = params.get('error');
const content = document.getElementById('content');
if (code) {
content.innerHTML = `
<p>Auth approved! Copy the code below and paste it into your terminal.</p>
<textarea id="code-box" rows="4" readonly>${code}</textarea>
<br>
<button onclick="copyCode()">Copy Code</button>
<p style="font-size:12px;margin-top:16px;">You can close this tab once copied.</p>
`;
// Auto-select on load
document.getElementById('code-box').select();
} else if (error) {
content.innerHTML = `
<p class="error">Authorization failed: <strong>${error}</strong></p>
<p>Close this tab and try running <code>smartsaber login</code> again.</p>
`;
} else {
content.innerHTML = `
<p class="error">No auth code found in this URL.</p>
<p>This page should only be opened via the Spotify auth redirect.</p>
`;
}
function copyCode() {
const box = document.getElementById('code-box');
box.select();
document.execCommand('copy');
event.target.textContent = 'Copied!';
setTimeout(() => event.target.textContent = 'Copy Code', 2000);
}
</script>
</body>
</html>