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:
@@ -113,6 +113,18 @@ func (l *Logger) Debug(message, file, extra string) {
|
||||
l.write(LevelDebug, message, file, extra)
|
||||
}
|
||||
|
||||
// DB exposes the underlying connection so the settings store can share the
|
||||
// same logs.db file rather than opening a second database.
|
||||
func (l *Logger) DB() *sql.DB { return l.db }
|
||||
|
||||
// SetRetention updates the purge horizon at runtime (e.g. from the settings UI).
|
||||
// Takes effect on the next purge. Ignored for non-positive values.
|
||||
func (l *Logger) SetRetention(days int) {
|
||||
if days > 0 {
|
||||
l.retentionDays = days
|
||||
}
|
||||
}
|
||||
|
||||
// LogEntry is one row returned by RecentLogs, shaped for the status feed.
|
||||
type LogEntry struct {
|
||||
TS string `json:"ts"`
|
||||
|
||||
Reference in New Issue
Block a user