-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsecret.html
89 lines (79 loc) · 3.19 KB
/
secret.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
<!-- This webpage code looks horrendous, and that's because it's being replaced by the svelte version later. -->
<!DOCTYPE html>
<head>
<title>OpenTaiko</title>
<link rel="icon" type="image/x-icon" href="src/image/favicon.ico">
<link rel="stylesheet" href="style.css">
<style>
.content {
float: right;
position: fixed;
padding: 0;
height: 100vh;
width: 100vw;
top: -68pt;
z-index: -1;
background-color: rgb(0,0,0);
display:flex;
align-content: center;
vertical-align: middle;
}
.collection {
margin:auto;
}
</style>
</head>
<body>
<header>
<h3><a href="index.html">Home</a></h3>
<h3><a href="download.html">Download</a></h3>
<h3><a href="songs.html">Songlist</a></h3>
</header>
<div class="content">
<div class="collection">
<form>
<input type="text" id="secret" name="secret">
</form>
<div class="button" onclick="fetchSecret();" style="margin:auto;background-image:linear-gradient(#ffffff,#ffffff);color:black;margin-top:5pt;">???</div>
</div>
</div>
<footer>
<a href="https://github.com/OpenTaiko" target="_blank"><img src="src/image/github.png"></img></a>
<a href="https://x.com/OpenTaiko" target="_blank"><img src="src/image/twitter.png"></img></a>
<a href="https://bsky.app/profile/opentaiko.bsky.social" target="_blank"><img src="src/image/bluesky.png"></img></a>
</footer>
</body>
<script>
const setColor = () => {
document.getElementById("secret").style.backgroundColor = "white"
}
const getSecret = async () => {
const secret = document.getElementById("secret").value;
if (secret === "" || !secret) return;
const secret_value = btoa(secret).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
const url = "https://opentaiko.neocities.org/" + secret_value + ".zip"
const response = await fetch(url, { method: "HEAD" });
if (response.ok) {
console.log("Secret found!");
document.getElementById("secret").style.backgroundColor = "rgb(150,255,150)";
setTimeout(setColor, 2000);
return url;
}
else {
console.log("Secret not found. Created '" + secret_value + "' from '" + secret + "'.");
document.getElementById("secret").style.backgroundColor = "rgb(255,150,150)";
setTimeout(setColor, 2000);
return;
}
}
const fetchSecret = async () => {
const url = await getSecret();
if (url) {
const downloadurl = document.createElement("a");
downloadurl.href = url;
downloadurl.target = "_blank";
downloadurl.click();
}
}
</script>
</html>