From f20d41355bae008adee97006b66328dea8f92095 Mon Sep 17 00:00:00 2001 From: domverse Date: Wed, 18 Mar 2026 23:50:20 +0100 Subject: [PATCH] feat: add compare endpoint to webui, fix duplicate Done. line - Add /compare POST endpoint that runs the two-instance diff - Add "Compare Instances" button to the dashboard - Fix double "Done." output: the summary line was logged both as a regular log event and as the done event message Co-Authored-By: Claude Sonnet 4.6 --- webui.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/webui.py b/webui.py index b127c13..fa07c81 100644 --- a/webui.py +++ b/webui.py @@ -258,9 +258,10 @@ async def run_sync_job(job_id: str, command: str) -> None: summary_line = "" async for raw in proc.stdout: text = raw.decode(errors="replace").rstrip() - _jobs[job_id]["output"].append({"type": "log", "message": text}) if text.startswith("Done."): summary_line = text + else: + _jobs[job_id]["output"].append({"type": "log", "message": text}) await proc.wait() success = proc.returncode == 0 _jobs[job_id]["output"].append({ @@ -514,6 +515,7 @@ async def dashboard(): Preview Changes +
@@ -552,6 +554,21 @@ async def start_pull(): return {"job_id": job_id, "stream_url": f"/stream/{job_id}"} +@app.post("/compare") +async def start_compare(): + if _active_job is not None: + raise HTTPException(status_code=409, detail="A sync job is already running") + settings = _load_settings() + local = settings.get("local", {}) + if not local.get("url") or not local.get("token"): + return JSONResponse( + status_code=400, + content={"detail": "Local instance not configured — set LOCAL_OUTLINE_URL and LOCAL_OUTLINE_TOKEN env vars"}, + ) + job_id = _new_job("compare") + return {"job_id": job_id, "stream_url": f"/stream/{job_id}"} + + @app.post("/push") async def start_push(): if _active_job is not None: