feat: split Settings (workspace) from Admin (instance config) (#8) #58

Merged
claude-bot merged 1 commit from feat/v6.2-settings-admin-redesign into main 2026-06-29 17:46:02 +00:00
Contributor

Closes #8. Last open issue in the v6.2 milestone.

Problem

The single ~1,300-line Settings page mixed per-workspace controls (projects, tags, categories, export) with server-wide instance configuration (AI, SMTP, backup, etc.), blurring the line with the admin-only Admin page. And PUT /api/settings was writable by any authenticated user even though every key is instance config.

Changes

Instance config → Admin (admin-only). AI, AI tools, Search (similarity threshold), Media, Email (SMTP), Backup, and the Federation kill-switch now live on the Admin page alongside Version / Storage quotas / Users / Audit Log.

Extraction (no duplicated save machinery). Each config section became a self-contained component under app/src/components/settings/ (GeneralSettings, AiSettings, AiToolsSettings, SearchSettings, MediaSettings, SmtpSettings, FederationSettings) built on shared Field / SectionHeading / SaveButton primitives + a new useSettings() hook that owns the GET/PUT /api/settings fetch + optimistic merge (incl. sensitive-key masking). AdminPage loads settings once and passes them down.

Settings → workspace-only. Keeps Projects, Project templates, Tags, Categories, Integrations (API tokens + Stash webhook), Export.

API gating. app.use('/api/settings', requireAdmin, settingsRouter) — non-admins now get 403 on read/write and test-email. requireAuth still runs first, so an unauthenticated request is 401 as before.

Profile: no change — the redesign plan mentioned moving "appearance" to Profile, but theme is handled by useTheme/localStorage (a Shell toggle), not a settings-table key, so there was nothing settings-backed to move.

Verification (dev server)

  • app: npm run build (tsc + vite) ✓, npm test63/63
  • api: npm test175/175 ✓ (added a non-admin 403 case to settings.test.ts; promoted its agent to admin like admin.test.ts)

No migration.

🤖 Generated with Claude Code

Closes #8. Last open issue in the **v6.2** milestone. ## Problem The single ~1,300-line Settings page mixed per-workspace controls (projects, tags, categories, export) with server-wide instance configuration (AI, SMTP, backup, etc.), blurring the line with the admin-only Admin page. And `PUT /api/settings` was writable by any authenticated user even though every key is instance config. ## Changes **Instance config → Admin (admin-only).** AI, AI tools, Search (similarity threshold), Media, Email (SMTP), Backup, and the Federation kill-switch now live on the Admin page alongside Version / Storage quotas / Users / Audit Log. **Extraction (no duplicated save machinery).** Each config section became a self-contained component under `app/src/components/settings/` (`GeneralSettings`, `AiSettings`, `AiToolsSettings`, `SearchSettings`, `MediaSettings`, `SmtpSettings`, `FederationSettings`) built on shared `Field` / `SectionHeading` / `SaveButton` primitives + a new `useSettings()` hook that owns the `GET`/`PUT /api/settings` fetch + optimistic merge (incl. sensitive-key masking). AdminPage loads settings once and passes them down. **Settings → workspace-only.** Keeps Projects, Project templates, Tags, Categories, Integrations (API tokens + Stash webhook), Export. **API gating.** `app.use('/api/settings', requireAdmin, settingsRouter)` — non-admins now get `403` on read/write and `test-email`. `requireAuth` still runs first, so an unauthenticated request is `401` as before. **Profile:** no change — the redesign plan mentioned moving "appearance" to Profile, but theme is handled by `useTheme`/localStorage (a Shell toggle), not a settings-table key, so there was nothing settings-backed to move. ## Verification (dev server) - `app`: `npm run build` (tsc + vite) ✓, `npm test` → **63/63** ✓ - `api`: `npm test` → **175/175** ✓ (added a non-admin `403` case to `settings.test.ts`; promoted its agent to admin like `admin.test.ts`) No migration. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(p8): split Settings (workspace) from Admin (instance config) (#8)
All checks were successful
CI / App — typecheck, test & build (push) Successful in 1m35s
CI / API — typecheck & tests (push) Successful in 2m19s
CI / App — typecheck, test & build (pull_request) Successful in 1m32s
CI / API — typecheck & tests (pull_request) Successful in 2m8s
63aab55019
The single Settings page mixed per-workspace controls with server-wide
instance configuration, blurring the line with the admin-only Admin page.

- Move AI, AI tools, Search, Media, Email (SMTP), Backup, and the
  Federation kill-switch onto the admin-only Admin page.
- Extract each into a self-contained component under
  app/src/components/settings/ on shared Field/SectionHeading/SaveButton
  primitives + a new useSettings() hook that owns the GET/PUT machinery.
- Settings keeps workspace-only sections: Projects, Project templates,
  Tags, Categories, Integrations, Export.
- Gate the settings router behind requireAdmin — every key in the
  settings table is server-wide config (non-admins now get 403).
- Tests: settings.test.ts runs as admin; add a non-admin 403 case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
claude-bot deleted branch feat/v6.2-settings-admin-redesign 2026-06-29 17:46:03 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rbrooks/TeaLeaves!58
No description provided.