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

docs: add Bruno collection entries for settings endpoints

+142
+43
bruno/AppView API/Settings/Get Settings Page.bru
··· 1 + meta { 2 + name: Get Settings Page 3 + type: http 4 + seq: 1 5 + } 6 + 7 + get { 8 + url: {{web_url}}/settings 9 + } 10 + 11 + assert { 12 + res.status: eq 200 13 + } 14 + 15 + docs { 16 + Renders the user settings page. 17 + 18 + Requires authentication (session cookie). Unauthenticated users are redirected 19 + to /login (302). 20 + 21 + Returns HTML page containing: 22 + - Light-theme <select id="lightThemeUri"> when allowUserChoice is true 23 + - Dark-theme <select id="darkThemeUri"> when allowUserChoice is true 24 + - Informational banner when allowUserChoice is false 25 + - "Preferences saved." banner when ?saved=1 query param is present 26 + - Error banner when ?error=<message> query param is present 27 + - <div id="theme-preview"> HTMX swap target 28 + 29 + Both selects carry HTMX attributes: 30 + hx-get="/settings/preview" 31 + hx-trigger="change" 32 + hx-target="#theme-preview" 33 + hx-swap="outerHTML" 34 + hx-include="this" 35 + 36 + Query parameters: 37 + - saved: "1" (optional) — shows "Preferences saved." success banner 38 + - error: string (optional) — shows decoded error message in error banner 39 + 40 + Error codes: 41 + - 302: Not authenticated → redirects to /login 42 + - 200: Success — page rendered (with or without selects depending on policy) 43 + }
+50
bruno/AppView API/Settings/Preview Theme.bru
··· 1 + meta { 2 + name: Preview Theme 3 + type: http 4 + seq: 2 5 + } 6 + 7 + get { 8 + url: {{web_url}}/settings/preview?lightThemeUri=at://{{forum_did}}/space.atbb.forum.theme/3lbllight 9 + } 10 + 11 + params:query { 12 + lightThemeUri: at://{{forum_did}}/space.atbb.forum.theme/3lbllight 13 + } 14 + 15 + assert { 16 + res.status: eq 200 17 + } 18 + 19 + docs { 20 + HTMX endpoint — returns an HTML fragment with color swatches for the given theme. 21 + 22 + Called automatically by the settings page when the user changes a theme select. 23 + Returns a <div id="theme-preview"> fragment that HTMX swaps into the page. 24 + 25 + Accepts exactly one of: 26 + - lightThemeUri: AT URI of a light theme 27 + - darkThemeUri: AT URI of a dark theme 28 + 29 + The endpoint fetches the theme from the AppView by rkey, extracts these tokens: 30 + color-bg, color-surface, color-primary, color-text, color-border 31 + 32 + Returns the fragment: 33 + <div id="theme-preview" class="theme-preview"> 34 + <span class="theme-preview__name">Theme Name</span> 35 + <div class="theme-preview__swatches"> 36 + <span class="theme-preview__swatch" style="background:#hex" title="color-bg" /> 37 + ... 38 + </div> 39 + </div> 40 + 41 + Returns empty fragment on any of: 42 + - No query param provided 43 + - URI fails rkey extraction (malformed) 44 + - AppView returns non-ok status (unknown theme) 45 + - Network error reaching AppView 46 + 47 + Error codes: 48 + - 200: Always — never errors, returns empty fragment on failure 49 + Empty fragment: <div id="theme-preview"></div> 50 + }
+49
bruno/AppView API/Settings/Save Appearance.bru
··· 1 + meta { 2 + name: Save Appearance 3 + type: http 4 + seq: 3 5 + } 6 + 7 + post { 8 + url: {{web_url}}/settings/appearance 9 + } 10 + 11 + body:form { 12 + lightThemeUri: at://{{forum_did}}/space.atbb.forum.theme/3lbllight 13 + darkThemeUri: at://{{forum_did}}/space.atbb.forum.theme/3lbldark 14 + } 15 + 16 + assert { 17 + res.status: eq 302 18 + res.headers.location: contains /settings 19 + } 20 + 21 + docs { 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 + }