feat(webui): system settings + TLS cert API (Wave A1)

GET/POST /api/system/settings (port/host/tlsEnabled/trustProxy) persisted via
updateRuntimeConfig — listener-level, restart-to-apply; response carries
restartRequiredToApply + the env-overridden field names so the panel can flag
edits that won't take effect. Enabling TLS is blocked unless a usable cert is
present. POST/DELETE /api/system/tls/cert validates a pasted PEM pair
(validateTlsPair) before writing config/cert.pem + key.pem. Adds read-only
readRuntimeConfig() and a tested pure coerceSettingsPatch validator. All routes
sit behind the existing /api/* auth middleware.
This commit is contained in:
DrSmoothl committed 2026-06-18 14:32:24 +08:00
1 parent 9a455b30c6
commit 7faef1b7c0
4 files changed
+196 -2

No files matched your search

+8
View File
@@ -77,6 +77,14 @@ export function loadRuntimeConfig(): RuntimeConfig {
return { ...normalized, ...resolveRuntimeEnvOverrides(process.env) };
}
/**
* Read the persisted config (normalized, no env overrides, no write). For the
* settings panel's GET — shows what's actually saved/editable on disk.
*/
export function readRuntimeConfig(): RuntimeConfig {
return normalizeRuntimeConfig(tryLoadRuntimeConfig() ?? {});
}
/**
* Persist a partial update. Merges onto the ON-DISK config (not the env-merged
* runtime view) so an env override (e.g. SNOWLUMA_WEBUI_PORT) is never baked