Bind stove API keys to configured client IP

This commit is contained in:
anor
2026-11-27 03:26:42 +10:00
parent 086a993e8a
commit be5a29277a
13 changed files with 235 additions and 25 deletions
+3
View File
@@ -153,6 +153,7 @@ CREATE TABLE IF NOT EXISTS stove_api_keys (
revoked_at TEXT,
created_at TEXT NOT NULL,
note TEXT NOT NULL DEFAULT '',
allowed_ip TEXT,
history_bytes INTEGER NOT NULL DEFAULT 0,
last_used_at TEXT
);
@@ -279,6 +280,8 @@ def init_db():
with _conn() as conn:
conn.executescript(_CREATE)
conn.executescript(_STOVE_CREATE)
if _колонки_нет(conn, "stove_api_keys", "allowed_ip"):
conn.execute("ALTER TABLE stove_api_keys ADD COLUMN allowed_ip TEXT")
for _col, _decl in (("category", "TEXT"), ("source", "TEXT"),
("status", "TEXT NOT NULL DEFAULT 'new'")):
if _колонки_нет(conn, "feedback", _col):