WIP! A BB-style forum, on the ATmosphere!
We're still working... we'll be back soon when we have something to show off!
node
typescript
hono
htmx
atproto
1meta {
2 name: Save Appearance
3 type: http
4 seq: 3
5}
6
7post {
8 url: {{web_url}}/settings/appearance
9}
10
11body:form {
12 lightThemeUri: at://{{forum_did}}/space.atbb.forum.theme/3lbllight
13 darkThemeUri: at://{{forum_did}}/space.atbb.forum.theme/3lbldark
14}
15
16assert {
17 res.status: eq 302
18 res.headers.location: contains /settings
19}
20
21docs {
22 Saves the user's light and dark theme preferences as cookies.
23
24 Requires authentication (session cookie). Unauthenticated users are redirected
25 to /login (302).
26
27 Body parameters (application/x-www-form-urlencoded):
28 - lightThemeUri: string (required) — AT URI of the chosen light theme
29 - darkThemeUri: string (required) — AT URI of the chosen dark theme
30
31 Validation:
32 1. Both URIs must be non-empty strings
33 2. Forum theme policy is re-fetched fresh (bypasses cache) to prevent stale themes
34 3. allowUserChoice must be true in the policy
35 4. Both URIs must be present in policy.availableThemes
36
37 On success:
38 - Sets cookie: atbb-light-theme=<uri>; Path=/; Max-Age=31536000; SameSite=Lax
39 - Sets cookie: atbb-dark-theme=<uri>; Path=/; Max-Age=31536000; SameSite=Lax
40 - Redirects 302 to /settings?saved=1
41
42 Error codes:
43 - 302 → /login: Not authenticated
44 - 302 → /settings?error=invalid: Missing or non-string body fields
45 - 302 → /settings?error=unavailable: Policy fetch failed (no cookies set)
46 - 302 → /settings?error=not-allowed: allowUserChoice is false
47 - 302 → /settings?error=invalid-theme: URI not in availableThemes
48 - 302 → /settings?saved=1: Success (cookies set)
49}