Merge control portal work from RPGTheory/aeternalis-portal
RPGTheory/aeternalis-portal had diverged from this repo (the git/CI/CD copy) with an in-progress control portal feature that was never synced back here, so none of it had gone through CI or been deployed: - New site/game/control routing split: index.html becomes a world directory landing page (site.ts), game.html is the renamed former index.html (main.ts), control.html is a new admin panel (control.ts, portal-shared.ts, portal.css). - Server: new internal/store/portal.go (character/world registry, command queue, admin grants) and internal/transport/control.go (portal API routes), plus a new internal/gitops package that lets the portal provision new worlds via a GitOps repo commit. - game.World gains BornAt/DiedAt/DeathReason and an operator Control() path (close/open admissions, awaken boss, end world, per-character rename/heal/unstuck/retire); death no longer reuses the same character id on rejoin, matching the "new life" permadeath model in Plan.md rather than the old bypass-prevention test's expectations. - deploy/: new control-egress network policy and portal/control values (admin role, GitOps repo/branch/values file/CIDRs). - New e2e coverage: tests/portal.spec.ts, tools/capture-world.mjs. Verified this repo's own independent commits (800ms movement-staleness window, 20s boss-attack poll, SRS/TLS deploy values, ubuntu-22.04 runner pin, DOCKER_HOST fix) were already present in the portal copy before merging, so nothing here regresses them. `tsc --noEmit`, the vite client build, and the protocol contract check all pass; no go.mod changes. Could not run `go build`/`go test` locally (no Go toolchain on PATH, Docker daemon not running) — every new/changed Go symbol was manually cross-referenced and resolves, but this should still be built and tested in CI before merging to master. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { createIcons, ArrowDown, ArrowRight, ArrowUpRight, Check, Globe2, HeartPulse, LogIn, LogOut, MapPin, MoreHorizontal, Play, Plus, RefreshCw, ScrollText, Search, ShieldCheck, Users, X } from 'lucide';
|
||||
import type { Character } from './generated';
|
||||
|
||||
export type RecordCharacter = { id: string; account: string; worldId: string; name: string; state: string; character: { view: Character; bornAt: string; diedAt?: string; deathReason?: string; dailySeconds: number } };
|
||||
export type World = { id: string; phase: string; living: number; dead: number; capacity: number; createdAt: string; bossAt: string; closed: boolean; available: boolean; revision: number };
|
||||
export type Command = { id: string; worldId: string; actor: string; op: string; target: string; value: string; reason: string; status: string; result: string; createdAt: number; completedAt: number };
|
||||
export const $ = <T extends HTMLElement = HTMLElement>(id: string) => document.getElementById(id) as T;
|
||||
export const el = <K extends keyof HTMLElementTagNameMap>(tag: K, text = '', className = '') => { const node = document.createElement(tag); node.textContent = text; node.className = className; return node; };
|
||||
export function icons() { createIcons({ icons: { ArrowDown, ArrowRight, ArrowUpRight, Check, Globe2, HeartPulse, LogIn, LogOut, MapPin, MoreHorizontal, Play, Plus, RefreshCw, ScrollText, Search, ShieldCheck, Users, X } }); }
|
||||
export function icon(name: string) { const node = el('i'); node.dataset.lucide = name; return node; }
|
||||
export function badge(state: string) { return el('span', state.replaceAll('-', ' '), `badge state-${state}`); }
|
||||
export function date(value: string | number) { return value ? new Date(typeof value === 'number' ? value * 1000 : value).toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }) : 'Unknown'; }
|
||||
export function gameURL(world: string) { return `/game?world=${encodeURIComponent(world)}`; }
|
||||
export class APIError extends Error { constructor(message: string, public status: number) { super(message); } }
|
||||
export async function api<T>(path: string, body?: unknown): Promise<T> {
|
||||
const response = await fetch(path, { method: body === undefined ? 'GET' : 'POST', credentials: 'same-origin', signal: AbortSignal.timeout(15000), headers: body === undefined ? {} : { 'Content-Type': 'application/json' }, body: body === undefined ? undefined : JSON.stringify(body) });
|
||||
const value = await response.json().catch(() => ({ error: `Request failed (${response.status})` }));
|
||||
if (!response.ok) throw new APIError(value.error || `Request failed (${response.status})`, response.status);
|
||||
return value;
|
||||
}
|
||||
export function table(headers: string[]) { const node = el('table'); const head = node.createTHead().insertRow(); for (const label of headers) { const th = el('th', label); th.scope = 'col'; head.append(th); } const body = node.createTBody(); return { node, body }; }
|
||||
export function cell(row: HTMLTableRowElement, content: string | Node) { const td = row.insertCell(); typeof content === 'string' ? td.textContent = content : td.append(content); return td; }
|
||||
Reference in New Issue
Block a user