Replaces the URL/channel/version-fetching tool-HTML system with a
local-only override model. No network fetch, no Ed25519 signatures, no
channels/versions, no `apps:` .zddc key.
Tool HTML resolves, in precedence:
1. a real file on disk at the path (operator drops browse.html / archive.html
/ a new mytool.html) — served by the existing static handler;
2. an `<app>.html` member of the site-root <ZDDC_ROOT>/.zddc.zip bundle, read
server-side via internal/zipfs (local file, no fetch, no signature;
re-stat'd each request for free hot-reload);
3. the embedded //go:embed default.
Remove (complete unwire):
- internal/apps/{fetch,verify,cache,singleflight}.go and their tests; the
spec-parsing/cascade machinery in apps.go (ParseSpec/Resolve/PreviewLine/
SpecComponents/appsState, DefaultUpstream*/DefaultChannel/CacheDirName).
- --apps-pubkey / ZDDC_APPS_PUBKEY flag+env+Config field; the setupApps
cache/fetcher/pubkey wiring (now just apps.NewServer(root, version)).
- the `apps:` / `apps_pubkey:` .zddc keys: ZddcFile.Apps/AppsPubKey, the
walker merges, cascade-summary adds, validate.go apps validation
(ValidateAppSourceSpec/validateURLSpec/validateChannelOrVersion/
AppsDefaultKey/IsValidAppsKey), and the isZero/is-empty refs. A stale
apps:/apps_pubkey: in an existing .zddc is now silently ignored
(back-compat), not a parse error. Client .zddc validator (preview-yaml.js)
drops the apps/apps_pubkey keys + appsmap case.
Add:
- internal/apps/bundle.go — nil-safe Bundle over <root>/.zddc.zip with
stat-based hot-reload, size caps, corrupt-zip tolerance.
- handler.go: Server{Bundle}, resolveBytes (bundle→embedded), simplified
Serve; X-ZDDC-Source = bundle:<m> / embedded:<app>@<ver>.
- dispatch: GET /.zddc.zip is 404 for everyone (config, not content); the
server reads members from the filesystem internally.
Tests: new bundle_test.go (member hit/absent/no-file/hot-reload/corrupt);
handler_test.go rewritten for bundle-overrides-embedded, absent-member→
embedded, unknown-tool 503, conditional-GET for both sources; dispatch test
covers bundle override + /.zddc.zip 404 + availability rules. go build/vet/
test ./... all green; gofmt clean. Docs (AGENTS.md, ARCHITECTURE.md) updated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
22 lines
1.2 KiB
Go
22 lines
1.2 KiB
Go
// Package apps serves the ZDDC tool HTML files (archive, transmittal,
|
|
// classifier, landing, browse, form, tables) on virtual paths in the file
|
|
// tree. Each tool is "available" only at directories whose cascade selects
|
|
// it (default_tool / dir_tool / available_tools) — see availability.go and
|
|
// the .zddc cascade. The markdown editor lives as a plugin inside browse.
|
|
//
|
|
// Tool HTML resolution is LOCAL-ONLY — no network fetch, no signatures, no
|
|
// channels/versions. For an enabled <dir>/<app>.html request the bytes come
|
|
// from, in precedence:
|
|
//
|
|
// 1. A real file on disk at the request path → static handler (operator
|
|
// override; handled by the dispatcher BEFORE Serve is ever reached, so
|
|
// by the time Serve runs no such file exists).
|
|
// 2. A member of the site-root config bundle <ZDDC_ROOT>/.zddc.zip, named
|
|
// "<app>.html", read server-side via internal/zipfs (see bundle.go).
|
|
// 3. The embedded default baked into the binary at compile time via
|
|
// //go:embed (see embed.go).
|
|
//
|
|
// To change a tool's HTML, drop a file at the path, drop "<app>.html" into
|
|
// .zddc.zip, or rebuild the binary. There is no `apps:` .zddc key and no
|
|
// upstream fetch — both were removed in favour of this local model.
|
|
package apps
|