RECORDGOD/site/index.html

46 lines
2.0 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>RecordGod</title>
<style>
:root{--pink:#ff5db1;--ink:#0b0b0d;--line:#26262c;--mut:#8a8a94}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--ink);color:#f0f0f2;font:15px/1.5 system-ui,sans-serif}
.wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}
.box{width:340px;text-align:center}
h1{font-size:46px;font-weight:600;margin:0 0 4px}
h1 b{color:var(--pink);font-weight:600}
.sub{color:var(--mut);letter-spacing:.14em;text-transform:uppercase;font-size:12px;margin-bottom:26px}
input{width:100%;padding:12px;border:1px solid var(--line);border-radius:10px;background:#0e0e11;color:#eee;font:15px system-ui;text-align:center}
button{width:100%;margin-top:10px;padding:12px;border:0;border-radius:10px;background:var(--pink);color:#1a0a14;font:600 15px system-ui;cursor:pointer}
.err{color:#e66;font-size:13px;margin-top:10px;min-height:18px}
.foot{color:#44444c;font-size:12px;margin-top:28px}
</style>
</head>
<body>
<div class="wrap"><div class="box">
<h1>Record<b>God</b></h1>
<div class="sub">store back-office · sign in</div>
<input id="tok" type="password" placeholder="access token" autofocus>
<button onclick="go()">Sign in</button>
<div id="err" class="err"></div>
<div class="foot">owner access only</div>
</div></div>
<script>
const tok = document.getElementById('tok');
async function go(){
const t = tok.value.trim(); if(!t) return;
document.getElementById('err').textContent = 'checking…';
const r = await fetch('/admin/stats', { headers: { 'Authorization': 'Bearer ' + t } });
if(r.ok){ localStorage.setItem('rg_token', t); location.href = '/admin'; }
else document.getElementById('err').textContent = 'invalid token';
}
tok.addEventListener('keydown', e => { if(e.key === 'Enter') go(); });
// already signed in? skip straight to the cockpit
if(localStorage.getItem('rg_token')) location.href = '/admin';
</script>
</body>
</html>