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:
@@ -0,0 +1,23 @@
|
||||
// Bundles src/main.ts into dist/app.js and copies the static files next to it.
|
||||
// The output is committed and embedded into the Go binary (see embed.go), so a
|
||||
// plain `go build` produces a node with its UI and nobody needs Node to run
|
||||
// one. The bundle is deliberately not minified: it is the code that decides
|
||||
// whether a listing is genuine, so it should stay readable.
|
||||
|
||||
import { build } from "esbuild";
|
||||
import { cp, mkdir, rm } from "node:fs/promises";
|
||||
|
||||
await rm("dist", { recursive: true, force: true });
|
||||
await mkdir("dist", { recursive: true });
|
||||
|
||||
await build({
|
||||
entryPoints: ["src/main.ts"],
|
||||
bundle: true,
|
||||
format: "esm",
|
||||
target: "es2022",
|
||||
outfile: "dist/app.js",
|
||||
legalComments: "inline",
|
||||
logLevel: "info",
|
||||
});
|
||||
|
||||
await cp("static", "dist", { recursive: true });
|
||||
Reference in New Issue
Block a user