From 27502c69979d916d0f4a7433151692b468aa2881 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 01:22:39 +0000 Subject: [PATCH 1/3] Initial plan From 13e3b76c88e5cbef89f6b48793727dc14e907a2c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 01:26:11 +0000 Subject: [PATCH 2/3] Add hub auto-launch: XDG autostart, API endpoints, and frontend toggle Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/0b0d70c0-01d1-49d1-b9ca-8d4f8e5af64a Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> --- app/sovran_systemsos_web/server.py | 34 ++++++++++ app/sovran_systemsos_web/static/js/events.js | 2 + .../static/js/features.js | 63 +++++++++++++++++++ modules/core/sovran-hub.nix | 35 +++++++++++ 4 files changed, 134 insertions(+) diff --git a/app/sovran_systemsos_web/server.py b/app/sovran_systemsos_web/server.py index 3180f92..a0259bf 100644 --- a/app/sovran_systemsos_web/server.py +++ b/app/sovran_systemsos_web/server.py @@ -57,6 +57,7 @@ ZEUS_CONNECT_FILE = "/var/lib/secrets/zeus-connect-url" REBOOT_COMMAND = ["reboot"] ONBOARDING_FLAG = "/var/lib/sovran/onboarding-complete" +AUTOLAUNCH_DISABLE_FLAG = "/var/lib/sovran/hub-autolaunch-disabled" # ── Tech Support constants ──────────────────────────────────────── @@ -1390,6 +1391,39 @@ async def api_onboarding_complete(): return {"ok": True} +# ── Auto-launch endpoints ───────────────────────────────────────── + +@app.get("/api/autolaunch/status") +async def api_autolaunch_status(): + """Check if Hub auto-launch on login is enabled.""" + disabled = os.path.exists(AUTOLAUNCH_DISABLE_FLAG) + return {"enabled": not disabled} + + +class AutolaunchToggleRequest(BaseModel): + enabled: bool + + +@app.post("/api/autolaunch/toggle") +async def api_autolaunch_toggle(req: AutolaunchToggleRequest): + """Enable or disable Hub auto-launch on login.""" + if req.enabled: + # Remove the disable flag to enable auto-launch + try: + os.remove(AUTOLAUNCH_DISABLE_FLAG) + except FileNotFoundError: + pass + else: + # Create the disable flag to suppress auto-launch + os.makedirs(os.path.dirname(AUTOLAUNCH_DISABLE_FLAG), exist_ok=True) + try: + with open(AUTOLAUNCH_DISABLE_FLAG, "w") as f: + f.write("") + except OSError as exc: + raise HTTPException(status_code=500, detail=f"Could not write flag file: {exc}") + return {"ok": True, "enabled": req.enabled} + + @app.get("/api/config") async def api_config(): cfg = load_config() diff --git a/app/sovran_systemsos_web/static/js/events.js b/app/sovran_systemsos_web/static/js/events.js index 8d5e9ea..a39ef00 100644 --- a/app/sovran_systemsos_web/static/js/events.js +++ b/app/sovran_systemsos_web/static/js/events.js @@ -105,12 +105,14 @@ async function init() { if (cfg.feature_manager) { loadFeatureManager(); } + loadAutolaunchToggle(); } catch (_) { await refreshServices(); loadNetwork(); checkUpdates(); setInterval(refreshServices, POLL_INTERVAL_SERVICES); setInterval(checkUpdates, POLL_INTERVAL_UPDATES); + loadAutolaunchToggle(); } } diff --git a/app/sovran_systemsos_web/static/js/features.js b/app/sovran_systemsos_web/static/js/features.js index 4c92cfb..0b30519 100644 --- a/app/sovran_systemsos_web/static/js/features.js +++ b/app/sovran_systemsos_web/static/js/features.js @@ -579,3 +579,66 @@ function buildFeatureCard(feat) { return card; } + +// ── Auto-launch toggle ──────────────────────────────────────────── + +async function loadAutolaunchToggle() { + try { + var data = await apiFetch("/api/autolaunch/status"); + renderAutolaunchToggle(data.enabled); + } catch (err) { + console.warn("Failed to load autolaunch status:", err); + } +} + +function renderAutolaunchToggle(enabled) { + // Remove existing section if any + var old = $sidebarFeatures.querySelector(".autolaunch-section"); + if (old) old.parentNode.removeChild(old); + + var section = document.createElement("div"); + section.className = "category-section autolaunch-section"; + + section.innerHTML = + '