Backend
UI preferences
Theme, palette, motion and bottom bar saved on the account, validated and merged one key at a time.
/api/auth/me/preferences keeps the UI choices of the signed in user on the account, so the theme, the palette and the bottom bar follow them to every device. The values are stored in User.preferences, next to any free form keys a project writes through PATCH /auth/me.
Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /auth/me/preferences | Every key, with defaults for the ones never set. Works with an API key. |
| PATCH | /auth/me/preferences | Partial: only the keys sent change. Needs a session (api_key_not_allowed with a key). |
GET /api/auth/me/preferences
{
"theme": "dark",
"palette": "#0d9488",
"motion": "system",
"bottom_bar": ["home", "files", "chat", "settings/profile"]
}Validation
theme:light,darkorsystem(default).palette: a name fromPLEATE["PREFERENCES"]["PALETTES"](the pleate presets), a#rrggbbcolor (stored lower case) ornullfor the site default.motion:system(default) oroff.bottom_bar: up to 4 unique nav ids in order, each 1 to 64 characters ofa-z 0-9 - _ /.- Any other key is refused, so the object stays small.
From React
tsx
import { usePreferences } from "pleate-client/react";
const { preferences, update } = usePreferences();
update.mutate({ theme: "dark" }); // optimistic, rolled back if the server refusesSettings
| Key | Default | Meaning |
|---|---|---|
| PREFERENCES.PALETTES | the 11 pleate presets | Palette names a user may pick. Add the ones your own CSS defines. |
Error codes
| Code | Status | When |
|---|---|---|
| validation_error | 400 | Field codes: invalid_choice, invalid_palette, max_length, invalid, duplicate_item, unknown_field. |
| api_key_not_allowed | 403 | PATCH with an API key. |