()
| 454 | |
| 455 | |
| 456 | def load_tailscale_status() -> dict[str, Any]: |
| 457 | if not TAILSCALE.exists(): |
| 458 | return {"ok": False, "error": f"Tailscale CLI 未找到:{TAILSCALE}"} |
| 459 | result = run_command([str(TAILSCALE), "status", "--json"]) |
| 460 | if result.returncode != 0: |
| 461 | return {"ok": False, "error": result.stderr.strip() or result.stdout.strip() or "读取 Tailscale 状态失败"} |
| 462 | try: |
| 463 | return {"ok": True, "data": json.loads(result.stdout)} |
| 464 | except json.JSONDecodeError as exc: |
| 465 | return {"ok": False, "error": f"Tailscale 返回的 JSON 无法解析: {exc}"} |
| 466 | |
| 467 | |
| 468 | def load_serve_status() -> dict[str, Any]: |
no test coverage detected