cursor2api / public /login.html
github-actions[bot]
sync: upstream b70f787 Merge pull request #84 from huangzt/feature/vue-logs-ui
c6dedd5
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cursor2API - 登录</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:'Inter',sans-serif;background:linear-gradient(135deg,#e0e7ff 0%,#f0f4f8 30%,#fdf2f8 70%,#f0f4f8 100%);color:#1e293b;height:100vh;display:flex;align-items:center;justify-content:center}
.card{width:400px;padding:44px;background:rgba(255,255,255,.85);border:1px solid rgba(226,232,240,.8);border-radius:20px;backdrop-filter:blur(24px);box-shadow:0 20px 40px rgba(0,0,0,.06),0 8px 16px rgba(0,0,0,.04)}
.logo{text-align:center;margin-bottom:32px}
.logo h1{font-size:24px;font-weight:700;background:linear-gradient(135deg,#6366f1,#3b82f6,#0891b2);-webkit-background-clip:text;-webkit-text-fill-color:transparent}
.logo p{font-size:13px;color:#94a3b8;margin-top:8px}
.field{margin-bottom:22px}
.field label{display:block;font-size:11px;font-weight:600;color:#475569;text-transform:uppercase;letter-spacing:.5px;margin-bottom:8px}
.field input{width:100%;padding:11px 16px;font-size:14px;background:#f7f9fc;border:1px solid #e2e8f0;border-radius:10px;color:#1e293b;outline:none;font-family:'JetBrains Mono',monospace;transition:all .2s}
.field input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.12);background:#fff}
.field input::placeholder{color:#cbd5e1}
.btn{width:100%;padding:11px;font-size:14px;font-weight:600;background:linear-gradient(135deg,#3b82f6,#6366f1);border:none;border-radius:10px;color:#fff;cursor:pointer;transition:all .2s;box-shadow:0 4px 12px rgba(59,130,246,.25)}
.btn:hover{opacity:.92;box-shadow:0 6px 16px rgba(59,130,246,.3)}.btn:active{transform:scale(.98)}
.err{margin-top:14px;padding:10px 14px;background:#fef2f2;border:1px solid #fecaca;border-radius:8px;font-size:12px;color:#dc2626;display:none;text-align:center}
</style>
</head>
<body>
<div class="card">
<div class="logo"><h1>⚡ Cursor2API</h1><p>日志查看器需要验证身份</p></div>
<div class="field">
<label>Auth Token</label>
<input type="password" id="tokenIn" placeholder="sk-your-token..." autofocus />
</div>
<button class="btn" onclick="doLogin()">登录</button>
<div class="err" id="errMsg">Token 无效,请检查后重试</div>
</div>
<script>
const saved=localStorage.getItem('cursor2api_token');
if(saved)window.location.href='/logs?token='+encodeURIComponent(saved);
document.getElementById('tokenIn').addEventListener('keydown',e=>{if(e.key==='Enter')doLogin()});
async function doLogin(){
const token=document.getElementById('tokenIn').value.trim();if(!token)return;
try{const r=await fetch('/api/stats?token='+encodeURIComponent(token));
if(r.ok){localStorage.setItem('cursor2api_token',token);window.location.href='/logs?token='+encodeURIComponent(token)}
else{document.getElementById('errMsg').style.display='block'}}
catch{document.getElementById('errMsg').style.display='block'}
}
</script>
</body>
</html>