fix watcher for smb

This commit is contained in:
2026-07-14 11:43:59 -04:00
parent 834ab81a94
commit b68b8f54bd
7 changed files with 190 additions and 133 deletions
+2 -23
View File
@@ -27,7 +27,7 @@ from db_py import (
clear_users,
update_user_password,
)
from scanner import full_scan, is_scan_in_progress, resolve_runtime_path, scan_results_only
from scanner import full_scan, get_scan_errors, is_scan_in_progress, resolve_runtime_path
from watcher import start_results_watchers, stop_results_watchers
BASE_DIR = Path(__file__).resolve().parent
@@ -334,7 +334,7 @@ def get_stats_route():
@app.get("/api/scan-status")
@require_auth
def get_scan_status_route():
return jsonify({"scanning": is_scan_in_progress()})
return jsonify({"scanning": is_scan_in_progress(), "errors": get_scan_errors()})
@app.post("/api/auth/login")
@@ -554,27 +554,6 @@ def rescan_route():
return jsonify({"ok": True, "scanning": True, "testCount": None, "completedCount": None})
@app.post("/api/config/rescan-results")
@require_auth
@require_role("admin")
def rescan_results_route():
_apply_smb_env_from_config()
results_dir = resolve_runtime_path(get_config("results_dir"))
results_dir_ref = resolve_runtime_path(get_config("results_dir_ref"))
if not results_dir:
return jsonify({"error": "Results directory not configured"}), 400
if is_scan_in_progress():
return jsonify({"ok": True, "scanning": True, "testCount": None, "completedCount": None})
threading.Thread(
target=scan_results_only,
args=(results_dir, results_dir_ref),
daemon=True,
).start()
return jsonify({"ok": True, "scanning": True, "testCount": None, "completedCount": None})
@app.get("/")
@app.get("/<path:path>")
def static_or_spa(path=""):