-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredirect.html
40 lines (31 loc) · 1.18 KB
/
redirect.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
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>jpazchat redirect</title>
</head>
<body>
<script>
async function getAccessToken(app_token) {
let item = JSON.parse(localStorage.getItem("access_token") || "{}");
return item.access_token;
}
async function init() {
const url = new URL(location.href);
const target = url.searchParams.get("target");
const access_token = await getAccessToken();
if(target) {
const targets = {
"trivia": "https://dhttm9zkbfvzw.cloudfront.net/alexjpaz-twitch/deployments/trivia/#/background?channel=alexjpaz&token={access_token}",
"litty": "https://loving-lovelace-0225ae.netlify.app/?channel=alexjpaz&token={access_token}",
"alerts": "https://dhttm9zkbfvzw.cloudfront.net/alexjpaz-twitch/alerts/?channel=alexjpaz&twitch_token={access_token}",
};
let redirect_url = targets[target];
redirect_url = redirect_url.replace("{access_token}", access_token);
location.assign(redirect_url);
}
}
init();
</script>
</body>
</html>