Create add-admin.html
Browse files- add-admin.html +58 -0
add-admin.html
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="ja">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<title>admin設定ページ</title>
|
6 |
+
<style>
|
7 |
+
body {
|
8 |
+
font-family: sans-serif;
|
9 |
+
padding: 2rem;
|
10 |
+
background-color: #f4f4f4;
|
11 |
+
}
|
12 |
+
button {
|
13 |
+
margin: 1rem 0;
|
14 |
+
padding: 0.5rem 1rem;
|
15 |
+
font-size: 1rem;
|
16 |
+
}
|
17 |
+
#status {
|
18 |
+
margin-top: 1rem;
|
19 |
+
font-weight: bold;
|
20 |
+
}
|
21 |
+
</style>
|
22 |
+
</head>
|
23 |
+
<body>
|
24 |
+
<h1>Admin ローカルストレージ設定</h1>
|
25 |
+
|
26 |
+
<button onclick="setAdmin()">admin = 1 に設定</button><br>
|
27 |
+
<button onclick="removeAdmin()">admin を解除</button>
|
28 |
+
|
29 |
+
<div id="status"></div>
|
30 |
+
|
31 |
+
<script>
|
32 |
+
function setAdmin() {
|
33 |
+
localStorage.setItem("admin", "1");
|
34 |
+
updateStatus();
|
35 |
+
}
|
36 |
+
|
37 |
+
function removeAdmin() {
|
38 |
+
localStorage.removeItem("admin");
|
39 |
+
updateStatus();
|
40 |
+
}
|
41 |
+
|
42 |
+
function updateStatus() {
|
43 |
+
const value = localStorage.getItem("admin");
|
44 |
+
const status = document.getElementById("status");
|
45 |
+
if (value === "1") {
|
46 |
+
status.textContent = "現在の状態: admin=1(Socket.IO スクリプトは無視されます)";
|
47 |
+
status.style.color = "green";
|
48 |
+
} else {
|
49 |
+
status.textContent = "現在の状態: admin 未設定(Socket.IO スクリプトが実行されます)";
|
50 |
+
status.style.color = "red";
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
// ページ読み込み時に状態を表示
|
55 |
+
updateStatus();
|
56 |
+
</script>
|
57 |
+
</body>
|
58 |
+
</html>
|