Fitness dashboard v1

This commit is contained in:
2026-06-11 12:55:43 +02:00
parent 4f14b39d16
commit fde4eff12d
6 changed files with 881 additions and 5 deletions
+5 -3
View File
@@ -58,7 +58,9 @@ type specialPage struct {
}
// pageTypeHandler is implemented by each special folder type (diary, gallery, …).
// handle returns nil when the handler does not apply to the given path.
// handle returns nil when the handler does not apply to the given path. The
// request is passed read-only (e.g. query params selecting a view variant);
// mutations belong in the POST flow, not here.
// redirect returns ok=true with an absolute URL when the request should be
// short-circuited with a 302 redirect (e.g. persistent date links in a diary,
// or virtual diary URLs in edit mode that delegate to the year file's editor).
@@ -66,7 +68,7 @@ type specialPage struct {
// When adding a new hook, prefer a sibling method here over folding logic
// into main.go or render.go.
type pageTypeHandler interface {
handle(root, fsPath, urlPath string) *specialPage
handle(root, fsPath, urlPath string, r *http.Request) *specialPage
redirect(root, fsPath, urlPath string, r *http.Request) (target string, ok bool)
}
@@ -264,7 +266,7 @@ func (h *handler) serveDir(w http.ResponseWriter, r *http.Request, urlPath, fsPa
var special *specialPage
if !editMode {
for _, ph := range pageTypeHandlers {
if special = ph.handle(h.root, fsPath, urlPath); special != nil {
if special = ph.handle(h.root, fsPath, urlPath, r); special != nil {
break
}
}