/* combo.codes — Gate app */ const DS = window.ComboCodesDesignSystem_019e18; const { Button, Terminal, Input, StatusDot } = DS; /* Access control is server-side. The typed key is sent to /auth/login; the server resolves the access profile, sets a signed httpOnly cookie, and returns where to go. No keys, hashes or rules live in this file. */ const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "enterAccent": "magenta", "ambientLevel": 85, "glitchIdle": true, "scanlines": true }/*EDITMODE-END*/; /* ---- rotating access log ------------------------------------------ */ const LOG_POOL = [ { text: 'node online · gate.combo.codes', tone: 'ok' }, { text: 'listening on :443', tone: 'dim' }, { text: 'tls 1.3 · handshake ok', tone: 'dim' }, { text: 'visitor detected', tone: 'default' }, { text: 'fingerprint logged', tone: 'dim' }, { text: 'auth required · waiting for key', tone: 'warn' }, { text: '0 errors', tone: 'ok' }, ]; function useRotatingLog(size = 5, every = 2400) { const [head, setHead] = React.useState(size); React.useEffect(() => { const id = setInterval(() => setHead((h) => h + 1), every); return () => clearInterval(id); }, [every]); const lines = []; for (let i = size; i > 0; i--) { lines.push(LOG_POOL[(head - i + LOG_POOL.length * 100) % LOG_POOL.length]); } return lines; } /* ---- the logo assembly --------------------------------------------- */ function GateLogo() { return (
{'{'}{'{'} combo.codescombo.codes {'}'}{'}'} ;;
); } /* ---- ambient furniture ---------------------------------------------- */ function Ambient({ level }) { const logLines = useRotatingLog(); return ( ); } /* ---- access modal ----------------------------------------------------- */ function AccessModal({ onClose }) { const [value, setValue] = React.useState(''); const [phase, setPhase] = React.useState('idle'); // idle | denied | granted const [attempts, setAttempts] = React.useState(0); const [shake, setShake] = React.useState(false); const [grantedZone, setGrantedZone] = React.useState(null); const [grantStep, setGrantStep] = React.useState(0); const deny = () => { setAttempts((a) => a + 1); setPhase('denied'); setShake(true); setTimeout(() => setShake(false), 280); }; const submit = async () => { if (phase === 'granted' || phase === 'checking') return; const key = value.trim(); if (!key) return; setPhase('checking'); try { const res = await fetch('/auth/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, credentials: 'same-origin', body: JSON.stringify({ key }), }); const data = await res.json().catch(() => null); if (res.ok && data && data.ok) { setPhase('granted'); setGrantedZone({ label: data.label || 'ACCESS_GRANTED', kind: data.kind || 'document' }); [1, 2, 3].forEach((n) => setTimeout(() => setGrantStep(n), 240 + n * 360)); setTimeout(() => { window.location.href = data.redirect || '/'; }, 1900); return; } } catch (e) { /* network / parse error — fall through to denied */ } deny(); }; React.useEffect(() => { const onKey = (e) => { if (e.key === 'Escape' && phase !== 'granted') onClose(); }; window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); }, [phase, onClose]); const cls = [ 'gatemodal', phase === 'denied' ? 'gatemodal--denied' : '', phase === 'granted' ? 'gatemodal--granted' : '', shake ? 'gatemodal--shake' : '', ].filter(Boolean).join(' '); return (
{ if (e.target === e.currentTarget && phase !== 'granted') onClose(); }}>
auth.console — combo.codes
{phase !== 'granted' ? (
identify yourself_
{ setValue(e.target.value); if (phase === 'denied') setPhase('idle'); }} onKeyDown={(e) => { if (e.key === 'Enter') submit(); }} >
{phase === 'denied' ? `> access denied · key not recognized [attempt ${String(attempts).padStart(2, '0')}]` : '> session is encrypted · nothing is stored'}
) : (
{grantStep >= 1 ?
key accepted
: null} {grantStep >= 2 ?
zone: {grantedZone.label}
: null} {grantStep >= 3 ?
opening {grantedZone.kind}_
: null}
)}
); } /* ---- the gate ---------------------------------------------------------- */ function Gate() { const [t, setTweak] = useTweaks(TWEAK_DEFAULTS); const [modalOpen, setModalOpen] = React.useState(false); return (
{t.scanlines ?
: null}
{'{'} PRIVATE_ACCESS_NODE {'}'}
node online · access by key only
your key was issued with your invitation
combo.codes_
{modalOpen ? setModalOpen(false)}> : null} setTweak('enterAccent', v)}> setTweak('ambientLevel', v)}> setTweak('glitchIdle', v)}> setTweak('scanlines', v)}>
); } window.GateApp = Gate; if (!window.__standalone) { ReactDOM.createRoot(document.getElementById('root')).render(); }