v0.315.0: one app page with four tabs; the guide the catalog can carry; no Raspberry Pi badge
gates / gates (push) Failing after 47s

An app was six pages — details, install/settings, logs, export, the per-app backup panel and a
details card for moving data — and every "Vissza" on them went to the app LIST, so there was no way
back to the app you were looking at. It is now ONE page with four tab URLs under /apps/{slug}/,
one shared header and one set of banners.

  settings  Mukodes (Start/Restart/Stop, Stop confirms) + the cards that want something from the
            household + the install-time and optional settings. The default for an installed app,
            RENDERED at the bare URL and never redirected to.
  data      the data folders, move to another drive, the nightly copy, the 2nd-copy setting, export
  guide     tagline, screenshots, use cases, first steps, the catalog's guide, the FAQ, the docs
            link — and the WHOLE page for an app that is not installed
  logs      the log, and the only tab whose poller runs

The tabs are links, not panels: a link in an alert has to land ON a tab, and the log poller must not
run on the other three. Start/Restart/Stop left the page header, where they read as menu buttons.

The old /stacks/{name}/{deploy,logs,export,backup} GETs answer 302 — never 301, which a browser
caches beyond anyone's reach — to the tab that now holds them, query string carried through, with
name->slug resolved through the stack list rather than assumed equal. Every POST on those paths is
untouched: the backup form, the app-email toggle and the reveal endpoints keep their URLs.

A value asked AFTER the app starts is now generic (D2). The catalog marks a field `after_start: true`
and supplies its label; the ACTION is Go, in a registry keyed by slug + env var. The catalog can
never declare what runs — a declared field with no registered action renders nothing, POSTs 404 and
logs one WARN with the env var KEY, never the value. A red-proof found the second half of that guard
unpinned: deleting the "the catalog must have DECLARED this field" check left the suite green, and a
POST for an undeclared field then reached Plex and opened the setup gate.
TestAfterStart_RegistryAloneIsNotAnInvitation pins it.

New catalog block app_info.guide (sections + faq + checked_version), parsed, localised field by
field and rendered with the household's own address filled in. It renders only when checked_version
names the image tag its author clicked through. No template carries one yet.

The Pi and "csak x86" badges are gone; PiCompatible and the catalog key stay this release, or a box
on 0.314.0 would read "csak x86" on every app (R-1067).

template_id_gate.py now follows {{template}} includes, with a scope decoy proving the walk did not
become vacuous.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117kRTSgs3rJWUFGxyoWN6Y
This commit is contained in:
2026-10-15 18:37:50 +02:00
parent 85f65c70d8
commit e66d4669d6
120 changed files with 16239 additions and 9866 deletions
+40 -15
View File
@@ -814,21 +814,26 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case strings.HasPrefix(path, "/stacks/") && strings.HasSuffix(path, "/auto-field/reveal") && r.Method == http.MethodPost:
name := strings.TrimSuffix(strings.TrimPrefix(path, "/stacks/"), "/auto-field/reveal")
s.appAutoFieldRevealHandler(w, r, name)
case strings.HasPrefix(path, "/stacks/") && strings.HasSuffix(path, "/export"):
name := strings.TrimPrefix(path, "/stacks/")
name = strings.TrimSuffix(name, "/export")
s.exportPageHandler(w, r, name)
case strings.HasPrefix(path, "/stacks/") && strings.HasSuffix(path, "/logs"):
name := strings.TrimPrefix(path, "/stacks/")
name = strings.TrimSuffix(name, "/logs")
s.logsHandler(w, r, name)
case strings.HasPrefix(path, "/stacks/") && strings.HasSuffix(path, "/deploy"):
name := strings.TrimPrefix(path, "/stacks/")
name = strings.TrimSuffix(name, "/deploy")
s.deployHandler(w, r, name)
// v0.315.0 — THE OLD APP URLS. Each of these four was a page of its own until the app page took
// their content into a tab. An alert e-mail, a bookmark or a tab open since before the update
// still carries them, so each GET answers 302 to the tab that now holds it; the query string
// travels too (`?raw=1` is a logs poller, `?flash=…` is a save coming back).
//
// 302 AND NOT 301, deliberately: a 301 lives in the browser's cache beyond anyone's reach, and
// these paths are a bridge for one release, not an address.
//
// The METHOD CHECK is the load-bearing half. `/stacks/{name}/backup` POST is the backup form,
// `/app-email` POST is the toggle, `/auto-field/reveal` POST reads a secret — redirecting any of
// them would turn a save into a GET of a page and lose the household's input. Each POST case
// below is therefore matched on its method, and the GET redirects never see one.
case strings.HasPrefix(path, "/stacks/") && strings.HasSuffix(path, "/export") && r.Method == http.MethodGet:
s.redirectStackGETToAppTab(w, r, strings.TrimSuffix(strings.TrimPrefix(path, "/stacks/"), "/export"), appTabData)
case strings.HasPrefix(path, "/stacks/") && strings.HasSuffix(path, "/logs") && r.Method == http.MethodGet:
s.redirectStackGETToAppTab(w, r, strings.TrimSuffix(strings.TrimPrefix(path, "/stacks/"), "/logs"), appTabLogs)
case strings.HasPrefix(path, "/stacks/") && strings.HasSuffix(path, "/deploy") && r.Method == http.MethodGet:
s.redirectStackDeployGET(w, r, strings.TrimSuffix(strings.TrimPrefix(path, "/stacks/"), "/deploy"))
case strings.HasPrefix(path, "/stacks/") && strings.HasSuffix(path, "/backup") && r.Method == http.MethodGet:
name := strings.TrimSuffix(strings.TrimPrefix(path, "/stacks/"), "/backup")
s.tier2ConfigPageHandler(w, r, name)
s.redirectStackGETToAppTab(w, r, strings.TrimSuffix(strings.TrimPrefix(path, "/stacks/"), "/backup"), appTabData)
case strings.HasPrefix(path, "/stacks/") && strings.HasSuffix(path, "/backup") && r.Method == http.MethodPost:
name := strings.TrimSuffix(strings.TrimPrefix(path, "/stacks/"), "/backup")
s.tier2ConfigSaveHandler(w, r, name)
@@ -878,9 +883,29 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case strings.HasPrefix(path, "/apps/") && strings.HasSuffix(path, "/initial-credentials/reveal") && r.Method == http.MethodPost:
slug := strings.TrimSuffix(strings.TrimPrefix(path, "/apps/"), "/initial-credentials/reveal")
s.appInitialCredsRevealHandler(w, r, slug)
// v0.315.0: the household's answer to an after-start field (Part 4). POST, so CsrfProtect covers
// it; the registry decides what runs, and an unregistered field is a 404 that executes nothing.
case strings.HasPrefix(path, "/apps/") && strings.Contains(path, "/after-start/") && r.Method == http.MethodPost:
rest := strings.TrimPrefix(path, "/apps/")
slug, env, _ := strings.Cut(rest, "/after-start/")
s.appAfterStartHandler(w, r, slug, env)
// v0.315.0: the app page and its tabs. Placed after every /apps/ POST case above and before the
// catch-all, so a more specific path always wins.
case strings.HasPrefix(path, "/apps/") && r.Method == http.MethodGet:
slug, tab, known := appTabPathSuffix(strings.TrimPrefix(path, "/apps/"))
switch {
case !known:
// An unknown suffix is not a tab, and it is not part of the slug either.
s.logger.Printf("[WARN] [web] 404 Not Found: %s %s (no such app tab)", r.Method, path)
http.NotFound(w, r)
case tab == appTabInstall:
s.appInstallPageHandler(w, r, slug)
default:
s.appPageHandler(w, r, slug, tab)
}
case strings.HasPrefix(path, "/apps/"):
slug := strings.TrimPrefix(path, "/apps/")
s.appDetailHandler(w, r, slug)
s.appPageHandler(w, r, slug, "")
case path == "/debug":
// v0.116.1: available at ANY logging.level (the ring always captures; see ServeDebugAPI).
s.debugPageHandler(w, r)