-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallback.html
More file actions
53 lines (52 loc) · 1.8 KB
/
Copy pathcallback.html
File metadata and controls
53 lines (52 loc) · 1.8 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Q-SYS SmartThings Auth Relay</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
display: flex; align-items: center; justify-content: center;
min-height: 100vh; margin: 0;
background: #1a1a2e; color: #eee;
}
.card {
background: #16213e; border-radius: 12px; padding: 48px 64px;
text-align: center; box-shadow: 0 4px 32px rgba(0,0,0,0.5);
max-width: 480px; width: 90%;
}
h2 { margin: 0 0 16px; font-size: 1.4rem; }
p { color: #aaa; line-height: 1.6; margin: 0; }
.ok { color: #4caf50; }
.err { color: #f44336; }
.spin { font-size: 2rem; display: block; margin-bottom: 16px;
animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
</style>
</head>
<body>
<div class="card" id="card">
<span class="spin">↻</span>
<h2>Redirecting to Q-SYS Core…</h2>
<p>Do not close this window.</p>
</div>
<script>
var p = new URLSearchParams(window.location.search);
var code = p.get('code');
var state = p.get('state');
var card = document.getElementById('card');
if (code && state) {
// state = "CORE_IP:PORT" (set by the plugin when building the auth URL)
var target = 'http://' + state + '/callback?code=' + encodeURIComponent(code);
window.location.replace(target);
} else {
card.innerHTML =
'<h2 class="err">✗ Relay Error</h2>' +
'<p>Missing <code>code</code> or <code>state</code> parameter.<br>' +
'This page is only valid as a SmartThings OAuth redirect target.<br>' +
'Return to Q-SYS Designer and click <strong>Link Account</strong> again.</p>';
}
</script>
</body>
</html>