docs(website): theming phases 6-8 as built, and phase 9 cancelled
Marks the nav wiring and the builder UI landed, and records the five places the build differed from the design: - The server had no way to store a nav row. The design scoped 6-8 as client work, but updateSettings would have written a nav object as "[object Object]" — a save that 200s and does nothing, for ever. - The server deliberately cannot check that a `to` exists: the base NAV arrays are client constants, and a server-side copy would be a second source of truth for navigation. Shape is the server's question, membership the client's. - `hidden: false` is accepted and never stored, so hiding stays subtractive. - The nav editor cannot be hidden, enforced in three places. - Orders are written only when something actually moved, compared against the base restricted to the rows the editing admin can see. Phase 9 (hue-carrying rgba literals + Parchment) is cancelled rather than deferred. The finding that motivated it is kept as the record: those literals carry a hue, so they are a rough edge in the three dark presets and not only a blocker for a hypothetical light one. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -281,9 +281,25 @@ and [THEMING_AND_NAV.md](THEMING_AND_NAV.md) §2.
|
||||
|
||||
Values are `TEXT`, so a JSON-valued key arrives as a **string** and every
|
||||
consumer parses it. Server side that is `utils/settingsJson.js`
|
||||
(`parseJsonSetting`), client side `parseLayout`/its callers; both treat a
|
||||
malformed or wrong-shaped value as **absent** rather than as an error, so a
|
||||
hand-edited row degrades to the default instead of rendering something broken.
|
||||
(`parseJsonSetting`), client side `client/src/lib/settingsJson.js` and
|
||||
`parseLayout`; both treat a malformed or wrong-shaped value as **absent** rather
|
||||
than as an error, so a hand-edited row degrades to the default instead of
|
||||
rendering something broken.
|
||||
|
||||
**The three `nav_*` rows are presentation, never authorization.** An entry is
|
||||
keyed by an item's existing `to` and may carry only `label`, `order`, `hidden`
|
||||
and — admin nav only — `group`; `utils/navOverrides.js` rejects anything else on
|
||||
write, naming the key. It deliberately does **not** check that a `to` exists: the
|
||||
base `NAV` arrays are client constants, and duplicating them server-side would
|
||||
create a second source of truth for navigation that drifts the first time a route
|
||||
is added. `client/src/lib/navOverrides.js` drops an unknown `to` at merge time
|
||||
instead, which is also what makes deleting a route in code safe. The merge runs
|
||||
*before* the role and shard-feature filters in `SiteHeader.jsx` /
|
||||
`AdminLayout.jsx`, which are unchanged and remain the boundary — a stored
|
||||
`hidden: false` on a gated item shows nobody anything. `hidden: false` is
|
||||
accepted (the editor sends it mid-edit) but never stored, so hiding stays
|
||||
subtractive. `hidden` on `/admin/navigation` is dropped for `nav_admin`, because
|
||||
that screen is the only UI that can un-hide anything.
|
||||
|
||||
**`theme_visual` is resolved server-side, not shipped raw to the browser.**
|
||||
`utils/themeResolve.js` layers `:root` ← preset ← custom, field by field, into
|
||||
@@ -896,7 +912,7 @@ file a route sits in — that is the property the route manifest freezes.
|
||||
| POST | `/posts/upload` | multipart image upload (multer) → `{image_url}` for screenshots |
|
||||
| GET | `/wiki` · GET `/wiki/:slug` | read incl. unpublished |
|
||||
| POST | `/wiki` · PUT `/wiki/:slug` · DELETE `/wiki/:slug` | manage pages |
|
||||
| GET | `/settings` · PUT `/settings` | read all / update `{key:value,...}`. Enum-constrained keys are validated on the way in; `theme_visual` additionally has every value checked against the closed sets in `config/themePresets.js` (hex color, shortlisted font stack, bounded px radius, listed shadow) and is stored stringified, and `brand_assets` has every slot checked against `utils/brandAssets.js` — a same-origin path under `/uploads/`, `/brand/` or `/assets/`, never an off-origin or protocol-relative URL, since these values are written straight into the page as an `<img src>` / `<link rel=icon>` / `og:image`. Cleared slots are dropped rather than stored as `null`. A write to `brand_assets` or `theme_visual` invalidates the cached HTML shell. The read path drops bad fields anyway, so the `400` is about **feedback** — a save that appears to succeed and then does nothing is worse than a rejection |
|
||||
| GET | `/settings` · PUT `/settings` | read all / update `{key:value,...}`. Enum-constrained keys are validated on the way in; `theme_visual` additionally has every value checked against the closed sets in `config/themePresets.js` (hex color, shortlisted font stack, bounded px radius, listed shadow) and is stored stringified, and `brand_assets` has every slot checked against `utils/brandAssets.js` — a same-origin path under `/uploads/`, `/brand/` or `/assets/`, never an off-origin or protocol-relative URL, since these values are written straight into the page as an `<img src>` / `<link rel=icon>` / `og:image`. Cleared slots are dropped rather than stored as `null`. The three `nav_*` keys go through `utils/navOverrides.js` on the same path — shape only (`label`/`order`/`hidden`/`group` keyed by an app path), since whether a key names a route the nav declares is settled client-side at merge time; without this they would reach the store as `"[object Object]"` and read as absent for ever. A write to `brand_assets` or `theme_visual` invalidates the cached HTML shell (a nav write does not — nav is not in the shell). The read path drops bad fields anyway, so the `400` is about **feedback** — a save that appears to succeed and then does nothing is worse than a rejection |
|
||||
| DELETE | `/settings/:key` | reset one setting to its default by deleting the row. Allowlisted to the keys whose default lives outside the store (`theme_visual`, `brand_assets`, `nav_public`, `nav_admin`, `nav_player`, `hero_layout_draft`) — anything else is `400`. Idempotent: resetting a key that was never set succeeds |
|
||||
| POST | `/settings/brand-asset/:slot` | upload one brand asset (`logo` · `hero` · `favicon`) **and** point `brand_assets` at it, in one call → `{ url, brand_assets }`. One call rather than "upload, then PUT" so a half-completed save never leaves an unreferenced file in `/uploads`. Uses the shared `imageUpload.js` multer config — the mimetype allowlist is never widened, only tightened per slot: favicons are **PNG only** (§4.10 of [THEMING_AND_NAV.md](THEMING_AND_NAV.md)) and capped at 512 KB, logos at 1 MB, heroes at the shared 8 MB. A refused file is unlinked before the response. Merges into the existing overrides, so uploading a logo never clears a hero. `adminOnly` — tighter than the generic `POST /admin/uploads`, which editors may reach |
|
||||
| GET | `/activity?limit=&offset=` | paginated activity log |
|
||||
|
||||
Reference in New Issue
Block a user