Menu form: AppearanceFormHTML for a consumer's hidden fields

A consumer whose middleware demands a CSRF token on every POST
(yamase-web) had to exempt the menu's route; it can now put the hidden
token field into the form instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-10-29 23:45:34 +01:00
1 parent 03a1ce56d8
commit e4f88485f2
4 files changed
+34 -27

No files matched your search

+9 -7
View File
@@ -96,10 +96,12 @@ German when `Lang` starts with `de`) with one POST form whose buttons
submit `theme` or `palette`. `AppearanceHandler` stores the choice in
the cookies `yw_theme`/`yw_palette` (path `BasePath/`, a year,
`HttpOnly`, `SameSite=Lax`) and redirects to `back`, but only to a path
inside the UI. Any other method gets 405. `ApplyAppearance` ignores unknown cookie
values, so whatever the consumer set before stays the default. A
consumer with its own switch (e.g. `yareco`'s) can keep it and just set
`Theme`/`Palette`.
inside the UI. Any other method gets 405. `ApplyAppearance` ignores
unknown cookie values, so whatever the consumer set before stays the
default. A consumer whose middleware wants a CSRF token on every POST
puts the hidden field into `AppearanceFormHTML`, which is rendered
inside the menu's form. A consumer with its own switch (e.g. `yareco`'s)
can keep it and just set `Theme`/`Palette`.
**Adding a palette:** a `:root[data-palette="..."]` block in
`static/style.css`, a constant and an entry in `Palettes` in
@@ -152,7 +154,7 @@ concurrent-edit conflict during the initial rollout) and can produce a
force-move an existing tag again for any future change — always cut a
new one, even for a one-line fix.
## PageHeader fields (current as of v0.2.0)
## PageHeader fields (current as of v0.2.4)
`Title`, `AppName` (lowercase product name for `<title>`/footer — not
`Name`, which collides with a domain type's own `Name` field once
@@ -160,8 +162,8 @@ embedded in the same struct, as yakwui's viewmodel types do), `Lang`
(`<html lang>`, defaults to `"en"`), `Theme` (`<html data-theme>`, see
Theming), `Brand`, `BrandInitial`, `Subtitle`,
`BasePath`, `NavItems`/`ActiveNav`, `Flash`/`FlashKind`, `Username`,
`Palette`, `AppearancePath`/`AppearanceBack` (since v0.2.0, see
Theming), `LogoutPath` (since v0.1.10 a `<form method="post">` with a submit
`Palette`, `AppearancePath`/`AppearanceBack` (since v0.2.0) and
`AppearanceFormHTML` (since v0.2.4, see Theming), `LogoutPath` (since v0.1.10 a `<form method="post">` with a submit
button styled like the former link, never a GET link: a logout reachable
by GET can be triggered from any foreign page via an `<img>`/link and by
link prefetchers; the consumer registers the route as `POST` only and