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

MethodPathPurpose
GET/auth/me/preferencesEvery key, with defaults for the ones never set. Works with an API key.
PATCH/auth/me/preferencesPartial: 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, dark or system (default).
  • palette: a name from PLEATE["PREFERENCES"]["PALETTES"] (the pleate presets), a #rrggbb color (stored lower case) or null for the site default.
  • motion: system (default) or off.
  • bottom_bar: up to 4 unique nav ids in order, each 1 to 64 characters of a-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 refuses

Settings

KeyDefaultMeaning
PREFERENCES.PALETTESthe 11 pleate presetsPalette names a user may pick. Add the ones your own CSS defines.

Error codes

CodeStatusWhen
validation_error400Field codes: invalid_choice, invalid_palette, max_length, invalid, duplicate_item, unknown_field.
api_key_not_allowed403PATCH with an API key.