spa modules and terminology: app.mjs split into flat es modules (router lifecycle, shared widgets, views own their state), mock smoke in test/; DICTIONARY.md rules the terms, four renames swept clean through the machinery - paper->status (run summary command is report now), window->session, wrap->housekeeping, context window->contwin; no dual-accepts by ruling, old data migrates once in the clerk (restore self-heals old dumps)

This commit is contained in:
2026-11-14 23:48:27 +00:00
parent 89a2c161b3
commit c51d31078e
36 changed files with 2643 additions and 1779 deletions
+35
View File
@@ -0,0 +1,35 @@
// web/view-claim.mjs — the invite claim: the only public screen.
// A single-use invite code is exchanged for a persistent token; the
// display name is a freeform label, collisions allowed.
import { $ } from './dom.mjs';
import { api, setToken } from './client.mjs';
import { state } from './state.mjs';
import { banner } from './chrome.mjs';
import { logEvent } from './log.mjs';
import { navigate } from './router.mjs';
export async function enter(arg, seq) {
$('claim-code').value = '';
$('claim-name').value = '';
let fresh = false;
try { fresh = (await api('/session')).fresh; } catch { /* public: works signed out; a dead server shows the plain hint */ }
if (seq !== state.seq) return;
$('claim-hint').textContent = fresh
? 'this deployment has no users yet — the superuser invite is in state/bootstrap-invite.txt on the server'
: 'a single-use invite code, from the operator';
$('claim-code').focus();
}
$('claim-form').addEventListener('submit', async (e) => {
e.preventDefault();
try {
const r = await api('/claim', { method: 'POST', body: { code: $('claim-code').value.trim(), name: $('claim-name').value.trim() } });
setToken(r.token);
state.me = r.user;
logEvent('nav', `claimed: ${r.user.name}${r.user.superuser ? ' (op)' : ''}`);
navigate('/');
} catch (err) {
banner(err.message);
}
});