Hub 2.2.0: a public key on the v2 heartbeat, Clear public key

Installs that registered with protocol v1 move to v2 by sending their
public key on a signed v2 heartbeat: saved / matches / mismatch, never a
failed heartbeat. Clear public key (2FA again) for a rebuilt server.
Contracts 1.4.0 vendored; hub-protocol.md §6 updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 12:05:59 +02:00
co-authored by Claude Opus 5.5
parent 7428337aa5
commit 106d71e566
11 changed files with 158 additions and 14 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "events-hub-frontend",
"version": "2.1.1",
"version": "2.2.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "events-hub-frontend",
"version": "2.1.1",
"version": "2.2.0",
"dependencies": {
"lucide-react": "^0.536.0",
"next": "^15.5.24",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "events-hub-frontend",
"version": "2.1.1",
"version": "2.2.0",
"private": true,
"scripts": {
"dev": "next dev -p 3200",
@@ -14,6 +14,7 @@ import { Badge, Loading, Message, PageTitle, Pager } from "@/components/ui";
type Detail = {
id: string; name: string; url: string; version: string | null; protocolVersion: number; timezone: string | null; notes: string | null;
publicKey: string | null;
adminContact: { name?: string; email?: string } | null; server: { node?: string; postgres?: string; os?: string } | null;
features: Record<string, unknown> | null; registeredAt: string; lastHeartbeatAt: string | null; releasedAt: string | null;
health: Health | null; stats: Stats | null;
@@ -39,6 +40,7 @@ export default function InstallPage() {
const { id } = useParams<{ id: string }>();
const [d, setD] = useState<Detail | null>(null);
const [notes, setNotes] = useState("");
const [keyTotp, setKeyTotp] = useState("");
const [msg, setMsg] = useState<{ type: "ok" | "err"; text: string } | null>(null);
const load = useCallback(() => api<Detail>(`/api/admin/installs/${id}`).then(x => { setD(x); setNotes(x.notes || ""); }).catch(e => setMsg({ type: "err", text: errorText(e) })), [id]);
@@ -63,6 +65,16 @@ export default function InstallPage() {
} catch (e) { setMsg({ type: "err", text: errorText(e) }); }
};
const clearKey = async () => {
if (!window.confirm("Forget this site's public key? The church's other products stop listing it until its next heartbeat, and their links to it must be connected again.")) return;
try {
await api(`/api/admin/installs/${id}/public-key/clear`, { method: "POST", body: { totp: keyTotp } });
setKeyTotp("");
setMsg({ type: "ok", text: "Public key cleared. The next heartbeat saves the site's current key." });
load();
} catch (e) { setMsg({ type: "err", text: errorText(e) }); }
};
return (
<>
<Link href="/" className="mb-2 inline-flex items-center gap-1 text-sm text-slate-500 hover:underline"><ArrowLeft className="h-4 w-4" /> Installs</Link>
@@ -107,6 +119,16 @@ export default function InstallPage() {
<p className="mt-2 text-xs text-slate-500">{d.protocolVersion >= 2 ? "This site is told about the products listed to it in each heartbeat reply (Linked products), so it can connect to them." : "This site uses protocol 1 (Cross Events before 2.4), so it isn't told about the others yet."}</p>
</>
)}
<div className="mt-3 border-t border-slate-100 pt-3">
<Row k="This site's public key" v={d.publicKey ? "saved" : d.protocolVersion >= 2 ? "none yet (saved with its next heartbeat)" : "none (protocol 1)"} />
{d.publicKey && (
<form className="mt-2 flex flex-wrap items-end gap-2" onSubmit={e => { e.preventDefault(); clearKey(); }}>
<p className="w-full text-xs text-slate-500">Only when the site&apos;s server was restored or rebuilt and the history below says it sent a different key: clearing lets its next heartbeat save the new one.</p>
<div><label className="label" htmlFor="k-t">Two-factor code</label><input id="k-t" className="input" inputMode="numeric" autoComplete="one-time-code" required value={keyTotp} onChange={e => setKeyTotp(e.target.value)} /></div>
<button className="btn-danger">Clear public key</button>
</form>
)}
</div>
</div>
<div className="grid gap-6 md:grid-cols-2">