[web] The web UI: hosts, add/edit with apply progress, undo, history and restore, share links, engine switch, certificates and device installs, signing by hand, settings and tokens; smoke test counts every §4 flow's clicks

This commit is contained in:
2026-11-07 23:44:27 +01:00
parent aed5fbfcff
commit 3e326e85a0
47 changed files with 7868 additions and 3 deletions
@@ -0,0 +1,69 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
<script lang="ts">
// Handoff §13.5: the intermediate banner. Renew is 1 click; the banner then shows the match
// code. Until Custos can sign (docs/custos-ticket.md) the request is signed by hand offline,
// so the waiting banner links to that page.
import { Banner, Button } from "@ianitor/ui";
import { del, post, sentence } from "../lib/api";
import { app, navigate, refresh, secondsLeft } from "../lib/app.svelte";
import { duration, longDate } from "../lib/format";
import type { PkiRequest } from "../lib/types";
const i = $derived(app.overview?.intermediate ?? null);
let pending = $state(false);
let problem = $state<string | null>(null);
async function renew() {
pending = true;
problem = null;
try {
await post<PkiRequest>("/certs/intermediate/renewal");
await refresh();
} catch (e) {
problem = sentence(e);
} finally {
pending = false;
}
}
async function cancel(id: string) {
try {
await del(`/pki-requests/${encodeURIComponent(id)}`);
await refresh();
} catch (e) {
problem = sentence(e);
}
}
</script>
{#if app.renewedUntil}
<Banner tone="kept" live="status" ondismiss={() => (app.renewedUntil = null)}>
{#snippet title()}Renewed. The Domi intermediate certificate is now valid until {longDate(app.renewedUntil, false)}.{/snippet}
</Banner>
{:else if i?.renewal}
{@const r = i.renewal}
<Banner tone="notice" label="Domi intermediate certificate">
{#snippet title()}
<span tabindex="-1">Sign the renewal on the offline computer. Check that it shows the same code:</span>
<span class="code" aria-label="Match code {r.match_code}">{r.match_code}</span>
{/snippet}
The request stays open for {duration(secondsLeft(r.expires_at))}. {#if problem}{problem}{/if}
{#snippet actions()}
<Button variant="outline" onclick={() => navigate("/certificates/renew-by-hand")}>Sign it by hand</Button>
<Button onclick={() => cancel(r.request_id)}>Cancel request</Button>
{/snippet}
</Banner>
{:else if i?.banner}
<Banner tone={i.state === "due" ? "notice" : "down"} label="Domi intermediate certificate">
{#snippet title()}<strong>{i.banner?.message}</strong>{/snippet}
{i.state === "missing" ? "Setting it up makes a request that the Domi root signs on the offline computer." : "Renewing makes a request that the Domi root signs; check the match code on both screens."}
{#if problem} {problem}{/if}
{#snippet actions()}<Button variant="outline" onclick={renew} {pending}>{i.state === "missing" ? "Set up" : "Renew"}</Button>{/snippet}
</Banner>
{/if}
<style>
.code { font-family: var(--font-inscription); font-size: 1.4rem; letter-spacing: 0.16em; color: var(--accent-strong); margin-left: 8px; }
</style>