Demo content from demo/developer-guide (77b8a7e)

This commit is contained in:
f451-admin 2026-10-03 08:46:44 +02:00
parent 13a4facbd8
commit 619ecadaa6
2 changed files with 47 additions and 0 deletions

View file

@ -71,6 +71,34 @@ the *current* SHA and content instead of silently overwriting it. The
caller is expected to re-fetch, reconcile, and retry with the new
`baseSha`.
## Theming routes
Theme files live in Git (see [[architecture]]). Writes need push right on
the respective repository and are committed with the caller's own Git
account; `404` stays ambiguous. `GET /api/theme/resolved` and the brand
files are public, because the layout needs them before sign-in.
| Route | Purpose |
|---|---|
| `GET` / `PUT` / `DELETE /api/theme` | Instance theme with origin per token |
| `GET` / `PUT` / `DELETE /api/spaces/:space/theme` | Space theme |
| `GET` / `PUT` / `DELETE /api/me/theme` | Personal theme. Session only — API tokens get `403`. `?format=yaml` exports; `PUT` with `Content-Type: application/yaml` imports. Without a stored theme `GET` answers `200` with an empty one. |
| `GET /api/theme/resolved?space=` | The finished chain (default, instance, space, user) plus `brand`. Without a session the user level is missing, without `space` the space level. |
| `GET /api/theme/scopes` | The scopes the caller may view or write |
| `GET /api/theme/editor?scope=` | What the settings page needs for one scope |
| `GET` / `PUT` / `DELETE /api/theme/contrast` | Contrast thresholds, instance only |
| `GET /api/theme/library`, `/api/spaces/:space/theme/library` | Templates as `{ slug, name, origin }`, origin `builtin`, `instance` or `space` |
| `PUT` / `DELETE /api/theme/library/:slug`, `/api/spaces/:space/theme/library/:slug` | Write or delete a template |
| `GET /api/brand/logo`, `/api/brand/favicon`, `/api/spaces/:space/brand/logo` | Brand files, `ETag` from the blob SHA |
| `PUT` / `DELETE /api/theme/brand/logo`, `/api/theme/brand/favicon`, `/api/spaces/:space/brand/logo` | Write or remove a brand file (body: SVG) |
Saving a theme refuses the whole file with `400` and a list per token if a
value is invalid, a token locked, or a contrast threshold missed; for
personal themes contrast problems come back as `warnings[]` instead. A
space theme that violates a rule only through an inherited value (for
example `measure` above `measure-wide`) is refused with `422`. Logos over
256 KB or not SVG answer `422`.
## Release archive routes
In a versioned space, `release_page` (and the review release) accepts an

View file

@ -77,6 +77,25 @@ underscores, and attachment paths are fixed to the page's own `_media/`. A
central guard doesn't exist yet; `isReleasePath` in the API is the helper for
future routes.
## Themes in Git
Instance and space themes are files, not rows: `_meta/theme.yaml`,
`_meta/themes/<slug>.yaml`, `_meta/brand/` in the space repository, and in
the instance repository named by `F451_INSTANCE_CONFIG` also
`_meta/contrast.yaml`. The api reads them with a five-minute cache that
writes and webhook pushes empty.
One resolver in `packages/design-tokens` turns a list of levels (default,
instance, space, user) into the full token set, with an origin per token, the
derived colours and the contrast check. The shipped default and the layout's
inline `<style>` go through the same code, so there is no second way for
values to become CSS; see [[web-frontend]].
The single exception to "nothing lives only in the database" is
`user_settings`: the personal theme, one row per user. A user has no
repository. Losing the table loses those themes, as it loses sessions; the
YAML download is the backup.
## Classification checks
Classes are plain frontmatter, read from `pages.frontmatter` — there is no