mirror of
https://github.com/siyuan-note/siyuan
synced 2026-04-21 13:37:52 +00:00
Adds a minimal endpoint for activating a theme by name and mode without
requiring the caller to fetch and re-POST the entire appearance config blob.
Request body:
{ "theme": "<theme-dir-name>", "mode": 0|1 }
Behaviour:
- Sets both ThemeLight and ThemeDark to the supplied theme name
- Sets Mode (0 = light, 1 = dark)
- Calls InitAppearance() to validate the theme exists and reads its
version from theme.json for cache-busting
- Saves conf.json
- Broadcasts the "setAppearance" WebSocket event so all open windows
call loadAssets() and reload the theme CSS with the new ?v= parameter
Returns the full Appearance config (same shape as setAppearance).
Motivation: external tools (e.g. OS-level theme switchers) previously
had to GET /api/system/getConf, patch the appearance object, and POST
the entire blob to /api/setting/setAppearance. /api/setting/setTheme
reduces that to a single, self-contained call with no dependencies.
Co-authored-by: You name <konty@github.com>
|
||
|---|---|---|
| .. | ||
| api | ||
| av | ||
| bazaar | ||
| cache | ||
| cmd | ||
| conf | ||
| filesys | ||
| harmony | ||
| job | ||
| mobile | ||
| model | ||
| resource | ||
| search | ||
| server | ||
| sql | ||
| task | ||
| testdata | ||
| treenode | ||
| util | ||
| entrypoint.sh | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| versioninfo.json | ||