Add browser UI with in-browser signature verification

Every node now serves a search and listing-detail UI at GET /. It is
vanilla TypeScript, bundled unminified into web/dist (committed) and
embedded with go:embed, so `go build` is enough to run a node.

The browser verifies each listing itself (certificate, binding, validity,
signature, proof-of-work) with pure-JS ed25519, so a gateway can withhold
listings but not forge them. Unverifiable results are hidden and their
content is never shown. Listing text is only inserted via textContent and
the UI is served with a strict CSP.

Canonical JSON is reimplemented in TypeScript and tested against a golden
fixture signed by the Go code. /api/v1/status now reports difficulty.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 18:29:40 +01:00
co-authored by Claude Sonnet 5.5
parent 918e16ed37
commit 3fd40241bc
30 changed files with 6418 additions and 5 deletions
+22
View File
@@ -0,0 +1,22 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light dark">
<meta name="referrer" content="no-referrer">
<title>Allmende</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header class="top">
<a class="brand" href="#/">Allmende</a>
<span id="status" class="status"></span>
</header>
<main id="app"></main>
<footer id="foot" class="foot"></footer>
<noscript><p class="error pad">Allmende braucht JavaScript, um Signaturen in deinem Browser zu prüfen. / Allmende needs JavaScript to verify signatures in your browser.</p></noscript>
<script type="module" src="app.js"></script>
</body>
</html>
+214
View File
@@ -0,0 +1,214 @@
:root {
--bg: #f7f6f2;
--surface: #ffffff;
--text: #1d2420;
--muted: #5f6b64;
--line: #dcdcd2;
--accent: #2f6b4f;
--accent-text: #ffffff;
--ok: #1f7a4d;
--ok-bg: #e3f3ea;
--bad: #b3261e;
--bad-bg: #fbe7e5;
--warn: #8a5a00;
--warn-bg: #fdf1d6;
--radius: 10px;
--maxw: 60rem;
color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #14181a;
--surface: #1c2224;
--text: #e8ece9;
--muted: #9aa7a0;
--line: #2f3a3d;
--accent: #6fbf97;
--accent-text: #0e1a14;
--ok: #6fd6a0;
--ok-bg: #173325;
--bad: #ff8a80;
--bad-bg: #3a1c1a;
--warn: #f2c15b;
--warn-bg: #3a2e12;
}
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
margin: 0;
background: var(--bg);
color: var(--text);
font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.top, main, .foot {
max-width: var(--maxw);
margin: 0 auto;
padding-left: 16px;
padding-right: 16px;
}
.top {
display: flex;
flex-wrap: wrap;
align-items: baseline;
gap: 4px 16px;
padding-top: 20px;
padding-bottom: 8px;
}
.brand {
font-size: 1.6rem;
font-weight: 700;
letter-spacing: -0.02em;
color: var(--text);
text-decoration: none;
}
.status, .muted, .hint { color: var(--muted); font-size: 0.9rem; }
.info { margin-left: 0.5rem; }
.tagline { color: var(--muted); margin: 4px 0 20px; }
.pad { padding: 16px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
h3 { font-size: 1.05rem; line-height: 1.3; margin: 0; }
/* Search form */
.filters {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
gap: 12px;
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 16px;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: 0.85rem; font-weight: 600; }
input, select {
width: 100%;
min-height: 2.5rem;
padding: 6px 10px;
font: inherit;
color: var(--text);
background: var(--bg);
border: 1px solid var(--line);
border-radius: 8px;
}
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible {
outline: 3px solid var(--accent);
outline-offset: 2px;
}
.actions { display: flex; gap: 8px; align-items: end; grid-column: 1 / -1; }
.btn {
min-height: 2.5rem;
padding: 6px 16px;
font: inherit;
font-weight: 600;
color: var(--text);
background: var(--surface);
border: 1px solid var(--line);
border-radius: 8px;
cursor: pointer;
}
.btn.primary { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
/* Results */
.results { margin-top: 20px; }
.cards {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
gap: 12px;
}
.card {
display: block;
padding: 14px 16px;
color: inherit;
text-decoration: none;
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.card:hover { border-color: var(--accent); }
.card p { margin: 4px 0 0; }
.card-top { display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; }
.price { font-size: 1.15rem; font-weight: 700; }
.price.big { font-size: 1.5rem; margin: 6px 0 16px; }
.facts { color: var(--muted); }
.results-foot { margin: 16px 0 32px; }
.error { color: var(--bad); }
.warn { color: var(--warn); background: var(--warn-bg); padding: 8px 12px; border-radius: 8px; }
.badge {
flex: none;
padding: 1px 8px;
font-size: 0.75rem;
font-weight: 600;
white-space: nowrap;
border-radius: 999px;
}
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
/* Detail */
.back { display: inline-block; margin: 8px 0 16px; }
.detail-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.panel {
margin: 0 0 12px;
padding: 14px 16px;
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--radius);
}
.panel p { margin: 0 0 8px; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 8px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.chips li { padding: 2px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; }
.checks { list-style: none; margin: 8px 0; padding: 0; }
.checks li { display: flex; flex-wrap: wrap; gap: 0 8px; padding: 2px 0; }
.checks .mark { font-weight: 700; }
.checks .ok .mark { color: var(--ok); }
.checks .bad { color: var(--bad); }
details { margin-top: 8px; }
summary { cursor: pointer; }
pre {
overflow-x: auto;
padding: 12px;
font-size: 0.8rem;
background: var(--bg);
border: 1px solid var(--line);
border-radius: 8px;
}
.foot { padding-top: 24px; padding-bottom: 32px; color: var(--muted); font-size: 0.85rem; }
@media (max-width: 30rem) {
.detail-head { flex-direction: column; }
.kv { grid-template-columns: 1fr; }
}