Spaces:
Paused
Paused
Update public/index.html
Browse files- public/index.html +135 -19
public/index.html
CHANGED
|
@@ -11,10 +11,37 @@
|
|
| 11 |
}
|
| 12 |
body {
|
| 13 |
font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
|
| 14 |
-
background:
|
| 15 |
-
color:
|
| 16 |
padding: 20px;
|
| 17 |
min-height: 100vh;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
}
|
| 19 |
.container {
|
| 20 |
max-width: 1400px;
|
|
@@ -23,11 +50,12 @@
|
|
| 23 |
padding: 0 20px;
|
| 24 |
}
|
| 25 |
.overview {
|
| 26 |
-
background:
|
| 27 |
border-radius: 15px;
|
| 28 |
padding: 25px;
|
| 29 |
margin-bottom: 30px;
|
| 30 |
-
border: 1px solid
|
|
|
|
| 31 |
}
|
| 32 |
.overview-title {
|
| 33 |
font-size: 18px;
|
|
@@ -35,7 +63,38 @@
|
|
| 35 |
align-items: center;
|
| 36 |
gap: 10px;
|
| 37 |
margin-bottom: 20px;
|
| 38 |
-
color:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
#summary {
|
| 41 |
display: grid;
|
|
@@ -43,21 +102,22 @@
|
|
| 43 |
gap: 15px;
|
| 44 |
}
|
| 45 |
#summary div {
|
| 46 |
-
background:
|
| 47 |
padding: 15px;
|
| 48 |
border-radius: 8px;
|
| 49 |
-
border: 1px solid
|
|
|
|
| 50 |
}
|
| 51 |
#summary div {
|
| 52 |
font-size: 14px;
|
| 53 |
-
color:
|
| 54 |
}
|
| 55 |
#summary span {
|
| 56 |
display: block;
|
| 57 |
font-size: 24px;
|
| 58 |
font-weight: bold;
|
| 59 |
margin-top: 5px;
|
| 60 |
-
color:
|
| 61 |
}
|
| 62 |
.stats-container {
|
| 63 |
display: grid;
|
|
@@ -66,11 +126,11 @@
|
|
| 66 |
margin-top: 20px;
|
| 67 |
}
|
| 68 |
.server-card {
|
| 69 |
-
background:
|
| 70 |
border-radius: 8px;
|
| 71 |
padding: 15px;
|
| 72 |
-
border: 1px solid
|
| 73 |
-
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
| 74 |
height: auto;
|
| 75 |
}
|
| 76 |
.server-card:hover {
|
|
@@ -101,16 +161,17 @@
|
|
| 101 |
margin-top: 10px;
|
| 102 |
}
|
| 103 |
.metric-item {
|
| 104 |
-
background:
|
| 105 |
padding: 8px;
|
| 106 |
border-radius: 6px;
|
| 107 |
-
border: 1px solid
|
|
|
|
| 108 |
}
|
| 109 |
.metric-item:hover {
|
| 110 |
-
background:
|
| 111 |
}
|
| 112 |
.metric-label {
|
| 113 |
-
color:
|
| 114 |
font-size: 12px;
|
| 115 |
margin-bottom: 3px;
|
| 116 |
}
|
|
@@ -134,15 +195,16 @@
|
|
| 134 |
color: #f44336;
|
| 135 |
}
|
| 136 |
.network-stats {
|
| 137 |
-
background:
|
| 138 |
-
border: 1px solid
|
| 139 |
margin-top: 20px;
|
| 140 |
padding: 15px;
|
| 141 |
border-radius: 8px;
|
|
|
|
| 142 |
}
|
| 143 |
.network-item {
|
| 144 |
font-size: 14px;
|
| 145 |
-
color:
|
| 146 |
}
|
| 147 |
@keyframes fadeIn {
|
| 148 |
from { opacity: 0; transform: translateY(20px); }
|
|
@@ -170,6 +232,24 @@
|
|
| 170 |
<div class="container">
|
| 171 |
<div class="overview">
|
| 172 |
<div class="overview-title">📊 系统概览</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
<div id="summary">
|
| 174 |
<div>总实例数: <span id="totalServers">0</span></div>
|
| 175 |
<div>在线实例: <span id="onlineServers">0</span></div>
|
|
@@ -183,6 +263,42 @@
|
|
| 183 |
</div>
|
| 184 |
|
| 185 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
async function getUsernames() {
|
| 187 |
try {
|
| 188 |
const response = await fetch('/api/config');
|
|
|
|
| 11 |
}
|
| 12 |
body {
|
| 13 |
font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
|
| 14 |
+
background: var(--background-color);
|
| 15 |
+
color: var(--text-color);
|
| 16 |
padding: 20px;
|
| 17 |
min-height: 100vh;
|
| 18 |
+
transition: background 0.3s ease, color 0.3s ease;
|
| 19 |
+
}
|
| 20 |
+
:root {
|
| 21 |
+
/* 深色模式变量(默认) */
|
| 22 |
+
--background-color: #0a0a0a;
|
| 23 |
+
--text-color: #fff;
|
| 24 |
+
--card-background: #1a1a1a;
|
| 25 |
+
--card-border: rgba(255, 255, 255, 0.1);
|
| 26 |
+
--metric-background: #141414;
|
| 27 |
+
--metric-border: rgba(255, 255, 255, 0.05);
|
| 28 |
+
--metric-hover: #202020;
|
| 29 |
+
--secondary-text: #888;
|
| 30 |
+
--label-color: #666;
|
| 31 |
+
--network-background: rgba(255, 255, 255, 0.07);
|
| 32 |
+
}
|
| 33 |
+
[data-theme="light"] {
|
| 34 |
+
/* 浅色模式变量 */
|
| 35 |
+
--background-color: #f5f5f5;
|
| 36 |
+
--text-color: #333;
|
| 37 |
+
--card-background: #fff;
|
| 38 |
+
--card-border: rgba(0, 0, 0, 0.1);
|
| 39 |
+
--metric-background: #f9f9f9;
|
| 40 |
+
--metric-border: rgba(0, 0, 0, 0.05);
|
| 41 |
+
--metric-hover: #eaeaea;
|
| 42 |
+
--secondary-text: #666;
|
| 43 |
+
--label-color: #999;
|
| 44 |
+
--network-background: rgba(0, 0, 0, 0.07);
|
| 45 |
}
|
| 46 |
.container {
|
| 47 |
max-width: 1400px;
|
|
|
|
| 50 |
padding: 0 20px;
|
| 51 |
}
|
| 52 |
.overview {
|
| 53 |
+
background: var(--card-background);
|
| 54 |
border-radius: 15px;
|
| 55 |
padding: 25px;
|
| 56 |
margin-bottom: 30px;
|
| 57 |
+
border: 1px solid var(--card-border);
|
| 58 |
+
transition: background 0.3s ease, border 0.3s ease;
|
| 59 |
}
|
| 60 |
.overview-title {
|
| 61 |
font-size: 18px;
|
|
|
|
| 63 |
align-items: center;
|
| 64 |
gap: 10px;
|
| 65 |
margin-bottom: 20px;
|
| 66 |
+
color: var(--text-color);
|
| 67 |
+
}
|
| 68 |
+
.theme-toggle {
|
| 69 |
+
display: flex;
|
| 70 |
+
align-items: center;
|
| 71 |
+
gap: 10px;
|
| 72 |
+
margin-bottom: 20px;
|
| 73 |
+
font-size: 14px;
|
| 74 |
+
color: var(--secondary-text);
|
| 75 |
+
}
|
| 76 |
+
.theme-toggle button {
|
| 77 |
+
background: var(--metric-background);
|
| 78 |
+
border: 1px solid var(--metric-border);
|
| 79 |
+
color: var(--text-color);
|
| 80 |
+
padding: 6px;
|
| 81 |
+
border-radius: 6px;
|
| 82 |
+
cursor: pointer;
|
| 83 |
+
display: flex;
|
| 84 |
+
align-items: center;
|
| 85 |
+
justify-content: center;
|
| 86 |
+
width: 32px;
|
| 87 |
+
height: 32px;
|
| 88 |
+
transition: background 0.2s ease, transform 0.2s ease;
|
| 89 |
+
}
|
| 90 |
+
.theme-toggle button:hover {
|
| 91 |
+
background: var(--metric-hover);
|
| 92 |
+
transform: scale(1.05);
|
| 93 |
+
}
|
| 94 |
+
.theme-toggle svg {
|
| 95 |
+
width: 18px;
|
| 96 |
+
height: 18px;
|
| 97 |
+
fill: var(--text-color);
|
| 98 |
}
|
| 99 |
#summary {
|
| 100 |
display: grid;
|
|
|
|
| 102 |
gap: 15px;
|
| 103 |
}
|
| 104 |
#summary div {
|
| 105 |
+
background: var(--metric-background);
|
| 106 |
padding: 15px;
|
| 107 |
border-radius: 8px;
|
| 108 |
+
border: 1px solid var(--metric-border);
|
| 109 |
+
transition: background 0.3s ease, border 0.3s ease;
|
| 110 |
}
|
| 111 |
#summary div {
|
| 112 |
font-size: 14px;
|
| 113 |
+
color: var(--secondary-text);
|
| 114 |
}
|
| 115 |
#summary span {
|
| 116 |
display: block;
|
| 117 |
font-size: 24px;
|
| 118 |
font-weight: bold;
|
| 119 |
margin-top: 5px;
|
| 120 |
+
color: var(--text-color);
|
| 121 |
}
|
| 122 |
.stats-container {
|
| 123 |
display: grid;
|
|
|
|
| 126 |
margin-top: 20px;
|
| 127 |
}
|
| 128 |
.server-card {
|
| 129 |
+
background: var(--metric-background);
|
| 130 |
border-radius: 8px;
|
| 131 |
padding: 15px;
|
| 132 |
+
border: 1px solid var(--metric-border);
|
| 133 |
+
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, border 0.3s ease;
|
| 134 |
height: auto;
|
| 135 |
}
|
| 136 |
.server-card:hover {
|
|
|
|
| 161 |
margin-top: 10px;
|
| 162 |
}
|
| 163 |
.metric-item {
|
| 164 |
+
background: var(--card-background);
|
| 165 |
padding: 8px;
|
| 166 |
border-radius: 6px;
|
| 167 |
+
border: 1px solid var(--metric-border);
|
| 168 |
+
transition: background 0.3s ease;
|
| 169 |
}
|
| 170 |
.metric-item:hover {
|
| 171 |
+
background: var(--metric-hover);
|
| 172 |
}
|
| 173 |
.metric-label {
|
| 174 |
+
color: var(--label-color);
|
| 175 |
font-size: 12px;
|
| 176 |
margin-bottom: 3px;
|
| 177 |
}
|
|
|
|
| 195 |
color: #f44336;
|
| 196 |
}
|
| 197 |
.network-stats {
|
| 198 |
+
background: var(--network-background);
|
| 199 |
+
border: 1px solid var(--metric-border);
|
| 200 |
margin-top: 20px;
|
| 201 |
padding: 15px;
|
| 202 |
border-radius: 8px;
|
| 203 |
+
transition: background 0.3s ease, border 0.3s ease;
|
| 204 |
}
|
| 205 |
.network-item {
|
| 206 |
font-size: 14px;
|
| 207 |
+
color: var(--secondary-text);
|
| 208 |
}
|
| 209 |
@keyframes fadeIn {
|
| 210 |
from { opacity: 0; transform: translateY(20px); }
|
|
|
|
| 232 |
<div class="container">
|
| 233 |
<div class="overview">
|
| 234 |
<div class="overview-title">📊 系统概览</div>
|
| 235 |
+
<div class="theme-toggle">
|
| 236 |
+
主题:
|
| 237 |
+
<button onclick="toggleTheme('system')" title="跟随系统">
|
| 238 |
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
| 239 |
+
<path d="M3 5h18c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V7c0-1.1.9-2 2-2zm0 12h18V7H3v10zm2-8h2v2H5V9zm0 4h2v2H5v-2zm4-4h10v2H9V9zm0 4h10v2H9v-2z"/>
|
| 240 |
+
</svg>
|
| 241 |
+
</button>
|
| 242 |
+
<button onclick="toggleTheme('light')" title="浅色模式">
|
| 243 |
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
| 244 |
+
<path d="M12 15.5a3.5 3.5 0 100-7 3.5 3.5 0 000 7zM12 2a.5.5 0 01.5.5v2a.5.5 0 01-1 0v-2A.5.5 0 0112 2zm0 17a.5.5 0 01.5.5v2a.5.5 0 01-1 0v-2a.5.5 0 01.5-.5zM2 12h2.5a.5.5 0 010 1H2a.5.5 0 010-1zm17.5 0h2a.5.5 0 010 1h-2a.5.5 0 010-1zM4.2 5.8l1.4-1.4a.5.5 0 01.7 0l1.4 1.4a.5.5 0 010 .7l-1.4 1.4a.5.5 0 01-.7 0L4.2 6.5a.5.5 0 010-.7zm13.2 0l1.4 1.4a.5.5 0 010 .7l1.4 1.4a.5.5 0 010 .7l-1.4 1.4a.5.5 0 01-.7 0l-1.4-1.4a.5.5 0 010-.7l-1.4-1.4a.5.5 0 010-.7l1.4-1.4a.5.5 0 01.7 0zM6.5 17.8l-1.4 1.4a.5.5 0 01-.7 0l-1.4-1.4a.5.5 0 010-.7l1.4-1.4a.5.5 0 01.7 0l1.4 1.4a.5.5 0 010 .7zm11 0l1.4 1.4a.5.5 0 010 .7l1.4 1.4a.5.5 0 010 .7l-1.4 1.4a.5.5 0 01-.7 0l-1.4-1.4a.5.5 0 010-.7l-1.4-1.4a.5.5 0 010-.7l1.4-1.4a.5.5 0 01.7 0z"/>
|
| 245 |
+
</svg>
|
| 246 |
+
</button>
|
| 247 |
+
<button onclick="toggleTheme('dark')" title="深色模式">
|
| 248 |
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
| 249 |
+
<path d="M21.4 13.7C20.6 13.9 19.8 14 19 14c-5 0-9-4-9-9 0-.2 0-.4.1-.6C5.6 5.6 2.5 9.5 2.2 14c-.1.9.1 1.8.5 2.6.7 1.5 2.1 2.5 3.8 2.8 1.9.2 3.8.3 5.6.3 2.6 0 5.1-.6 7.4-1.7 2-.9 3.7-2.4 4.9-4.2.3-.5.5-1.1.6-1.7 0 .6-.2 1.2-.6 1.6zM12.1 18.5c-1.7 0-3.5-.1-5.2-.4-1.5-.2-2.8-1.2-3.4-2.6-.3-.7-.5-1.6-.4-2.4.3-4.1 3-7.5 6.9-8.5-.1.4-.2.8-.2 1.2 0 4.5 3.3 8.2 7.5 8.9-1.9.9-3.9 1.4-6 1.4-.4 0-.8 0-1.2.4z"/>
|
| 250 |
+
</svg>
|
| 251 |
+
</button>
|
| 252 |
+
</div>
|
| 253 |
<div id="summary">
|
| 254 |
<div>总实例数: <span id="totalServers">0</span></div>
|
| 255 |
<div>在线实例: <span id="onlineServers">0</span></div>
|
|
|
|
| 263 |
</div>
|
| 264 |
|
| 265 |
<script>
|
| 266 |
+
// 主题切换功能
|
| 267 |
+
function setTheme(theme) {
|
| 268 |
+
if (theme === 'system') {
|
| 269 |
+
localStorage.removeItem('theme');
|
| 270 |
+
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
| 271 |
+
document.documentElement.setAttribute('data-theme', systemPrefersDark ? 'dark' : 'light');
|
| 272 |
+
} else {
|
| 273 |
+
localStorage.setItem('theme', theme);
|
| 274 |
+
document.documentElement.setAttribute('data-theme', theme);
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
function toggleTheme(theme) {
|
| 279 |
+
setTheme(theme);
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
// 初始化主题
|
| 283 |
+
function initTheme() {
|
| 284 |
+
const savedTheme = localStorage.getItem('theme');
|
| 285 |
+
if (savedTheme) {
|
| 286 |
+
setTheme(savedTheme);
|
| 287 |
+
} else {
|
| 288 |
+
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
| 289 |
+
setTheme(systemPrefersDark ? 'dark' : 'light');
|
| 290 |
+
}
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
// 监听系统主题变化
|
| 294 |
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
| 295 |
+
if (!localStorage.getItem('theme')) {
|
| 296 |
+
setTheme('system');
|
| 297 |
+
}
|
| 298 |
+
});
|
| 299 |
+
|
| 300 |
+
initTheme();
|
| 301 |
+
|
| 302 |
async function getUsernames() {
|
| 303 |
try {
|
| 304 |
const response = await fetch('/api/config');
|