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>
22 lines
499 B
Go
22 lines
499 B
Go
// Package web embeds the browser UI. The UI is built from web/src with
|
|
// `npm run build` (see build.mjs) and the output in dist/ is committed, so a
|
|
// plain `go build` yields a node that serves its own UI.
|
|
package web
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
)
|
|
|
|
//go:embed dist
|
|
var dist embed.FS
|
|
|
|
// Files returns the built UI, rooted at its index.html.
|
|
func Files() fs.FS {
|
|
sub, err := fs.Sub(dist, "dist")
|
|
if err != nil {
|
|
panic(err) // dist is embedded at compile time; this cannot fail
|
|
}
|
|
return sub
|
|
}
|