Add searchable admin audit history

This commit is contained in:
Jonathan Sykes
2026-10-14 01:54:08 +08:00
parent 6bcaccbcaf
commit 301fab335f
9 changed files with 208 additions and 4 deletions

View File

@@ -265,6 +265,17 @@ export async function initDb() {
created_at INTEGER NOT NULL DEFAULT (unixepoch()),
last_used_at INTEGER
);
CREATE TABLE IF NOT EXISTS audit_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
ts INTEGER NOT NULL DEFAULT (unixepoch()),
actor TEXT NOT NULL,
action TEXT NOT NULL,
target TEXT NOT NULL DEFAULT '',
detail TEXT NOT NULL DEFAULT '{}'
);
CREATE INDEX IF NOT EXISTS idx_audit_ts ON audit_log (ts DESC, id DESC);
CREATE INDEX IF NOT EXISTS idx_audit_actor_action ON audit_log (actor, action, ts DESC);
`);
await migrateVideoMeta();
// Uploads shared from devices (PWA share target): who sent it, and whether it