This commit is contained in:
2026-01-22 02:45:08 -08:00
parent 3d571b007b
commit ba23c0606f
18 changed files with 75 additions and 5355 deletions

View File

@@ -251,35 +251,6 @@ def _run(result: Any, args: List[str], config: Dict[str, Any]) -> int:
except Exception as exc:
debug(f"Cookies check failed: {exc}")
# ZeroTier Hosting
zt_conf = config.get("networking", {}).get("zerotier", {})
if zt_conf.get("serve"):
from SYS.background_services import ensure_zerotier_server_running
try:
debug("ZeroTier hosting enabled; ensuring server is running")
ensure_zerotier_server_running()
except Exception as exc:
debug(f"ensure_zerotier_server_running failed: {exc}")
serve_target = zt_conf.get("serve")
port = zt_conf.get("port") or 999
status = "OFFLINE"
detail = f"Sharing: {serve_target} on port {port}"
try:
from API.HTTP import HTTPClient
debug(f"Probing ZeroTier health on 127.0.0.1:{port}")
# Probing 127.0.0.1 is more reliable on Windows than localhost
with HTTPClient(timeout=1.0, retries=0) as client:
resp = client.get(f"http://127.0.0.1:{port}/health")
if resp.status_code == 200:
status = "ONLINE"
payload = resp.json()
detail += f" (Live: {payload.get('name', 'unknown')})"
debug(f"ZeroTier host responded: status={resp.status_code}, payload_keys={list(payload.keys()) if isinstance(payload, dict) else 'unknown'}")
except Exception as exc:
debug(f"ZeroTier probe failed: {exc}")
_add_startup_check(startup_table, status, "ZeroTier Host", detail=detail)
except Exception as exc:
debug(f"Status check failed: {exc}")