mirror of
https://github.com/mileswolfallen2/miles-web.git
synced 2026-12-03 15:43:25 +00:00
168 lines
7.7 KiB
HTML
168 lines
7.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Moon Vault</title>
|
|
<meta name="theme-color" content="#07070c">
|
|
<meta name="robots" content="noindex, nofollow, noarchive, noimageindex">
|
|
<meta name="description" content="Private vault.">
|
|
<link rel="icon" type="image/png" href="favicon.png">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Space+Mono:wght@400;700&family=Inter:wght@400;500;600;800&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="projects/style.css">
|
|
<script src="site-config.js"></script>
|
|
<style>
|
|
:root{--vault-bg:#07070c;}
|
|
body{background:radial-gradient(circle at 50% 35%,#101020 0%,#05050a 70%);min-height:100vh;}
|
|
nav{position:fixed;top:0;left:0;right:0;z-index:100;background:rgba(7,7,12,0.9);padding:14px 24px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid rgba(255,255,255,0.06);}
|
|
.nav-logo{font-family:var(--font-pixel);font-size:10px;color:var(--text);text-decoration:none;display:flex;align-items:center;gap:8px;}
|
|
.nav-logo .logo-dot{width:10px;height:10px;background:var(--accent);display:inline-block;}
|
|
.nav-links{display:flex;gap:18px;}
|
|
.nav-links a{font-family:var(--font-mono);font-size:11px;color:var(--muted);text-decoration:none;text-transform:uppercase;letter-spacing:.04em;}
|
|
.nav-links a:hover{color:var(--accent);}
|
|
.vault-lock{position:fixed;inset:0;z-index:50;padding:80px 24px 24px;display:flex;align-items:center;justify-content:center;}
|
|
.lock-card{width:100%;max-width:410px;border:2px solid rgba(255,255,255,0.12);background:rgba(7,7,12,0.92);padding:38px 28px 30px;text-align:center;box-shadow:0 30px 80px rgba(0,0,0,0.6);}
|
|
.lock-card .lock-icon{font-size:44px;line-height:1;}
|
|
.lock-card h1{font-family:var(--font-pixel);font-size:14px;color:var(--text);margin:20px 0 8px;text-shadow:3px 3px 0 var(--accent);}
|
|
.lock-card p{font-family:var(--font-mono);font-size:11px;color:var(--muted);line-height:1.7;margin-bottom:22px;}
|
|
.lock-card form{display:flex;flex-direction:column;gap:12px;}
|
|
.lock-card input{font-family:var(--font-mono);font-size:13px;color:var(--text);background:rgba(0,0,0,0.45);border:1px solid rgba(255,255,255,0.18);padding:13px 14px;outline:none;text-align:center;border-radius:0;}
|
|
.lock-card input:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(255,61,154,.12);}
|
|
.lock-card button{font-family:var(--font-pixel);font-size:9px;color:#000;background:var(--accent);border:none;padding:14px;cursor:pointer;text-transform:uppercase;letter-spacing:.05em;}
|
|
.lock-card button:focus-visible,.nav-links a:focus-visible{outline:2px solid var(--text);outline-offset:3px;}
|
|
.lock-card button:hover{filter:brightness(1.15);}
|
|
.lock-card button:disabled{opacity:.55;cursor:wait;}
|
|
.lock-msg{font-family:var(--font-mono);font-size:11px;color:#ff5c7a;min-height:17px;}
|
|
.lock-msg.ok{color:var(--green);}
|
|
.lock-hint{font-family:var(--font-mono);font-size:9px;color:#666;margin-top:18px;line-height:1.7;}
|
|
.shake{animation:shake .35s;}
|
|
@keyframes shake{0%,100%{transform:translateX(0)}20%{transform:translateX(-9px)}40%{transform:translateX(9px)}60%{transform:translateX(-6px)}80%{transform:translateX(6px)}}
|
|
@media (prefers-reduced-motion:reduce){.shake{animation:none;}}
|
|
@media (max-width:640px){.nav-links{gap:12px;}.nav-links a{font-size:10px;}}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<nav>
|
|
<a href="index.html" class="nav-logo"><span class="logo-dot"></span> milesallen</a>
|
|
<div class="nav-links">
|
|
<a href="index.html#projects">Projects</a>
|
|
<a href="dashboard.html">Dashboard</a>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="vault-lock">
|
|
<div class="lock-card" id="lockCard">
|
|
<div class="lock-icon" aria-hidden="true">🔒</div>
|
|
<h1>moon vault</h1>
|
|
<p>Nothing to see here.<br>Unless you know the word.</p>
|
|
<form id="lockForm" autocomplete="on">
|
|
<input type="password" id="lockPass" placeholder="passphrase" aria-label="Passphrase" aria-describedby="lockHint lockMsg" autocomplete="current-password" autocapitalize="off" spellcheck="false" maxlength="512" autofocus required>
|
|
<button type="submit" id="lockButton">Unlock</button>
|
|
<div class="lock-msg" id="lockMsg" role="status" aria-live="polite"></div>
|
|
</form>
|
|
<div class="lock-hint" id="lockHint">server-verified · rate limited · not indexed</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
(function () {
|
|
var form = document.getElementById('lockForm');
|
|
var input = document.getElementById('lockPass');
|
|
var button = document.getElementById('lockButton');
|
|
var msg = document.getElementById('lockMsg');
|
|
var card = document.getElementById('lockCard');
|
|
var busy = false;
|
|
|
|
function setMessage(text, ok) {
|
|
msg.textContent = text || '';
|
|
msg.className = 'lock-msg' + (ok ? ' ok' : '');
|
|
}
|
|
|
|
function shake() {
|
|
card.classList.remove('shake');
|
|
void card.offsetWidth;
|
|
card.classList.add('shake');
|
|
}
|
|
|
|
var host = window.location.hostname;
|
|
var fallbackBase = (host === 'milesallen.site' || host === 'www.milesallen.site')
|
|
? 'https://api.milesallen.site'
|
|
: '';
|
|
var base = window.MILES_API_BASE || fallbackBase;
|
|
var API = window.MILES_API_URL || (base ? base + '/api' : '/api');
|
|
var VAULT_URL = window.MILES_VAULT_URL || (base ? base + '/vault' : '/vault');
|
|
|
|
function go() {
|
|
window.location.replace(VAULT_URL);
|
|
}
|
|
|
|
fetch(API + '/vault/session', { credentials: 'include', cache: 'no-store' })
|
|
.then(function (response) {
|
|
if (!response.ok) throw new Error('Vault status unavailable');
|
|
return response.json();
|
|
})
|
|
.then(function (data) {
|
|
if (data.authenticated) go();
|
|
else if (data.enabled === false) {
|
|
setMessage('Vault is not configured on this server.', false);
|
|
button.disabled = true;
|
|
input.disabled = true;
|
|
}
|
|
})
|
|
.catch(function () {
|
|
setMessage('Vault status unavailable. Try again.', false);
|
|
});
|
|
|
|
form.addEventListener('submit', function (event) {
|
|
event.preventDefault();
|
|
if (busy) return;
|
|
var password = input.value;
|
|
if (!password) { setMessage('Enter the passphrase.', false); return; }
|
|
|
|
busy = true;
|
|
button.disabled = true;
|
|
setMessage('checking…', true);
|
|
|
|
fetch(API + '/vault/login', {
|
|
method: 'POST',
|
|
credentials: 'include',
|
|
cache: 'no-store',
|
|
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
|
|
body: JSON.stringify({ password: password })
|
|
})
|
|
.then(function (response) {
|
|
return response.json().catch(function () { return {}; }).then(function (data) {
|
|
if (!response.ok) {
|
|
var error = new Error(data.error && data.error.message ? data.error.message : 'Unlock failed');
|
|
error.status = response.status;
|
|
error.retryAfter = response.headers.get('Retry-After');
|
|
throw error;
|
|
}
|
|
return data;
|
|
});
|
|
})
|
|
.then(function () {
|
|
setMessage('unlocked.', true);
|
|
go();
|
|
})
|
|
.catch(function (error) {
|
|
busy = false;
|
|
button.disabled = false;
|
|
input.value = '';
|
|
if (error.status === 429) {
|
|
setMessage('too many attempts. try again' + (error.retryAfter ? ' in ' + error.retryAfter + 's' : ' later') + '.', false);
|
|
} else if (error.status === 401) {
|
|
setMessage('nope.', false);
|
|
} else {
|
|
setMessage(error.message || 'something went wrong.', false);
|
|
}
|
|
shake();
|
|
input.focus();
|
|
});
|
|
});
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|