feat: add library sync status polling with automatic page reload when background sync completes

Add /api/library-status endpoint returning ready/updated_at/error from library_cache with thread-safe lock. Add pollLibrarySync() function to check library status every 5 seconds and reload page when updated_at timestamp changes. Track lastLibrarySync timestamp to detect background sync completion. Save active view to sessionStorage before reload to restore navigation state
This commit is contained in:
2026-08-25 20:16:50 +02:00
parent 83dc8c08ae
commit 3f418bb2a3
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -1129,6 +1129,11 @@ def api_rescan():
def scan_status():
with job_lock: return jsonify(jobs)
@app.get("/api/library-status")
def library_status():
with library_cache_lock:
return jsonify({"ready": library_cache["ready"], "updated_at": library_cache["updated_at"], "error": library_cache["error"]})
@app.get("/api/downloads")
def downloads():
if not SAB_URL or not SAB_API_KEY: