variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
|
|
|
// web/view-claim.mjs -- the invite claim: the only public screen.
|
2026-11-14 23:48:27 +00:00
|
|
|
// 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
|
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
|
|
|
? 'this deployment has no users yet -- the superuser invite is in state/bootstrap-invite.txt on the server'
|
2026-11-14 23:48:27 +00:00
|
|
|
: '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);
|
|
|
|
|
}
|
|
|
|
|
});
|