feat(db): backfill, DB-backed web scans, firewall snapshot view (R001/S001/F001)
- R001: app/db/backfill.py imports git-history blocklist -> ledger, firewall snapshots, and per-source requests.csv (idempotent; ran live migrating 705 historical blocklist entries). - S001: web_scan.latest_scans() now merges SQLite 'scans' records so the dashboard surfaces CLI/restart scans (_db_scans). - F001: /api/firewall/snapshots + 'Snapshot history' panel; added recent_firewall_snapshots() query with entry counts.
This commit is contained in:
1 parent
ba48054293
commit
2fb4032766
4 files changed
+308
-6
No files matched your search
@@ -265,6 +265,19 @@ def register_routes(app: Flask,
|
||||
"snapshot_dir": MIKROTIK_DATA_DIR,
|
||||
})
|
||||
|
||||
@app.get("/api/firewall/snapshots")
|
||||
def firewall_snapshots():
|
||||
"""Recent firewall snapshots persisted in the SQLite store (F001)."""
|
||||
try:
|
||||
from ..db import get_connection
|
||||
from ..db import repositories as repo
|
||||
conn = get_connection()
|
||||
limit = request.args.get("limit", 10, type=int)
|
||||
return jsonify({"snapshots": repo.recent_firewall_snapshots(
|
||||
conn, limit=limit)})
|
||||
except Exception as exc:
|
||||
return jsonify({"error": str(exc), "snapshots": []}), 503
|
||||
|
||||
@app.post("/api/firewall/sync")
|
||||
def firewall_sync():
|
||||
return _sync_firewall(dry_run=True)
|
||||
|
||||
Reference in new issue
Block a user