feat(backend,frontend): add Web UI for configuring OpenCode server Basic Auth password

Allow administrators to set and clear the managed OpenCode server password
from the Settings UI without requiring container or environment variable
changes. Passwords are encrypted before database persistence and never
returned to the frontend. The server manager resolves the password
dynamically at restart time, falling back to the env var if no stored
password exists.

- Add system_settings table migration (v12)
- Add SettingsService methods for encrypted password storage
- Add GET/PATCH /api/settings/opencode-server-auth routes
- Make OpenCodeServerManager resolve password dynamically from DB
- Add frontend API methods, React Query hook, and auth settings component
This commit is contained in:
Chris Scott committed 2026-04-29 00:46:17 +00:00
1 parent efae3b86c1
commit 954bc60ddb
13 files changed
+731 -20

No files matched your search

+14
View File
@@ -328,3 +328,17 @@ export const OpenCodeConfigResponseSchema = z.object({
configs: z.array(OpenCodeConfigMetadataSchema),
defaultConfig: OpenCodeConfigMetadataSchema.nullable(),
});
export const OpenCodeServerAuthSettingsSchema = z.object({
username: z.string().min(1),
hasPassword: z.boolean(),
source: z.enum(['configured', 'env', 'none']),
});
export const UpdateOpenCodeServerAuthSettingsSchema = z.object({
password: z.string().min(1).optional(),
clearPassword: z.boolean().optional(),
});
export type OpenCodeServerAuthSettings = z.infer<typeof OpenCodeServerAuthSettingsSchema>;
export type UpdateOpenCodeServerAuthSettings = z.infer<typeof UpdateOpenCodeServerAuthSettingsSchema>;