34 lines
2.1 KiB
HTML
34 lines
2.1 KiB
HTML
<!DOCTYPE html>
|
|||
|
|
<html lang="zh-CN">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
<title>UAPI</title>
|
||
|
|
<style>
|
||
|
|
:root { --bg: #0a0f0f; --card: #0f1a1a; --border: #1a3a2a; --text: #c9d1d9; --muted: #5a7a5a; --accent: #3fb950; }
|
||
|
|
* { margin:0; padding:0; box-sizing:border-box; }
|
||
|
|
body { background:var(--bg); color:var(--text); font-family:'JetBrains Mono','Fira Code','SF Mono',Consolas,monospace; min-height:100vh; display:flex; align-items:center; justify-content:center; }
|
||
|
|
.box { background:var(--card); border:1px solid var(--border); border-radius:4px; padding:36px; width:100%; max-width:360px; text-align:center; }
|
||
|
|
.box h1 { font-size:18px; color:var(--accent); font-weight:400; margin-bottom:6px; }
|
||
|
|
.box p { color:var(--muted); font-size:12px; margin-bottom:20px; }
|
||
|
|
.box input { width:100%; padding:10px 12px; background:#050a0a; border:1px solid var(--border); border-radius:4px; color:#fff; font-size:14px; font-family:inherit; outline:none; }
|
||
|
|
.box input:focus { border-color:var(--accent); }
|
||
|
|
.box button { width:100%; margin-top:12px; padding:10px; background:var(--accent); color:#000; border:none; border-radius:4px; font-size:14px; font-family:inherit; cursor:pointer; font-weight:600; }
|
||
|
|
.box button:hover { background:#2ea043; color:#fff; }
|
||
|
|
.err { color:var(--red); font-size:12px; margin-top:10px; display:none; }
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div class="box">
|
||
|
|
<h1>[UAPI] 身份验证</h1>
|
||
|
|
<p>请输入访问口令</p>
|
||
|
|
<input type="password" id="pwd" placeholder="口令" autofocus>
|
||
|
|
<button onclick="login()">进入系统</button>
|
||
|
|
<div class="err" id="err">口令错误</div>
|
||
|
|
</div>
|
||
|
|
<script>
|
||
|
|
async function login(){const t=document.getElementById('pwd').value;if(!t)return;try{const r=await fetch('/api/auth?token='+encodeURIComponent(t));if(r.ok){document.cookie='site_token='+t+';path=/;max-age=2592000;SameSite=Lax';location.href='/?token='+encodeURIComponent(t)}else{document.getElementById('err').style.display='block'}}catch{document.getElementById('err').style.display='block'}}
|
||
|
|
document.getElementById('pwd').addEventListener('keydown',e=>{if(e.key==='Enter')login()});
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|