add: DB-backed settings UI for live-editable tunables

Add a settings page (/settings) and API (/api/settings GET/PUT) to edit
encoding profiles (crf/preset per media type), lp, OMDb key, log retention,
and delete-originals from the browser, persisted to a settings table in
logs.db. config.yaml seeds the store on first run; afterwards the DB is the
source of truth (paths.* and http_addr stay config-only). Each job snapshots
the current settings, so changes apply to the next encode with no restart.

PUT validates ranges (crf 0-63, preset 0-13, lp >=0, retention >=1) before
persisting. No auth, by design for now (isolated network) — see #2.

Closes #1
This commit is contained in:
Esa Kataja
2026-06-21 19:51:35 +03:00
parent bef58f480b
commit 8fc00c96b9
8 changed files with 427 additions and 19 deletions
+4
View File
@@ -64,6 +64,10 @@ func NewClient(apiKey string, log *logger.Logger) *Client {
}
}
// SetAPIKey updates the OMDb key (e.g. after a settings change). Called from the
// single-threaded encode loop before a fetch, so no locking is needed.
func (c *Client) SetAPIKey(key string) { c.omdbAPIKey = key }
// redactURL strips secret query parameters (e.g. apikey) before logging.
func redactURL(rawURL string) string {
u, err := url.Parse(rawURL)