From 695490c90c832f1a5532b6d6f9dbf47751df9171 Mon Sep 17 00:00:00 2001 From: OpenCode Agent <> Date: Mon, 17 Aug 2026 22:41:52 +0000 Subject: [PATCH] feat: auto-restart dashboard after sshx install --- dashboard/plugin_api.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dashboard/plugin_api.py b/dashboard/plugin_api.py index 9122795..0f841bf 100644 --- a/dashboard/plugin_api.py +++ b/dashboard/plugin_api.py @@ -21,19 +21,35 @@ LINK_RE = re.compile(r"https://sshx\.io/s/[A-Za-z0-9_-]+") def _ensure_sshx() -> bool: - if shutil.which("sshx"): + already = shutil.which("sshx") is not None + if already: return True try: subprocess.run( ["sh", "-c", "curl -sSf https://sshx.io/get | sh"], capture_output=True, timeout=60, ) - return shutil.which("sshx") is not None + if shutil.which("sshx"): + _trigger_dashboard_restart() + return True + return False except Exception as e: logger.error("sshx install failed: %s", e) return False +def _trigger_dashboard_restart(): + try: + subprocess.Popen( + ["nohup", "bash", "-c", + "sleep 3 && sudo systemctl restart hermes-dashboard"], + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, + stdin=subprocess.DEVNULL, start_new_session=True, + ) + except Exception as e: + logger.error("Failed to trigger dashboard restart: %s", e) + + def _kill_sshx(): global _sshx_pid, _sshx_link if _sshx_pid: