feat(frontend): implement settings page

- Profile editor: name and optional password change with confirm field,
  saves via PATCH /users/me and updates auth store
- Appearance: theme toggle button (dark/light) with sun/moon icon
- App cache: PWA reset — unregisters service workers and clears caches
- Sessions: list active sessions with parsed user agent, start date,
  expiry, current badge, and terminate button per session
- Add mock handlers: PATCH /users/me, DELETE /auth/sessions/{id}

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 23:37:44 +03:00
parent 9b1aa40522
commit 6da25dc696
2 changed files with 540 additions and 0 deletions
+13
View File
@@ -300,6 +300,19 @@ export function mockApiPlugin(): Plugin {
return json(res, 200, ME);
}
// PATCH /users/me
if (method === 'PATCH' && path === '/users/me') {
const body = (await readBody(req)) as { name?: string; password?: string };
if (body.name) ME.name = body.name;
return json(res, 200, ME);
}
// DELETE /auth/sessions/{id}
const sessionDelMatch = path.match(/^\/auth\/sessions\/(\d+)$/);
if (method === 'DELETE' && sessionDelMatch) {
return noContent(res);
}
// GET /files/{id}/thumbnail
const thumbMatch = path.match(/^\/files\/([^/]+)\/thumbnail$/);
if (method === 'GET' && thumbMatch) {