MCPcopy Create free account
hub / github.com/StarsTom/mobileCodexHelper / build_remote_block

Function build_remote_block

mobile_codex_control.py:435–453  ·  view source on GitHub ↗
(remote: dict[str, Any], app_ok: bool, proxy_ok: bool)

Source from the content-addressed store, hash-verified

433
434
435def build_remote_block(remote: dict[str, Any], app_ok: bool, proxy_ok: bool) -> tuple[StatusBlock, dict[str, Any]]:
436 if not remote["published"]:
437 block = StatusBlock("远程发布", False, "未开启", "远程发布未开启", "error")
438 return block, {"value": "未开启", "detail": block.detail, "level": "error"}
439
440 if not app_ok or not proxy_ok:
441 detail = f"{remote['url']} | 已发布,但本地服务未启动" if remote["url"] else "已发布,但本地服务未启动"
442 block = StatusBlock("远程发布", False, "已发布,待服务启动", detail, "warning")
443 return block, {"value": "已发布", "detail": detail, "level": "warning"}
444
445 if remote["health_ok"]:
446 detail = f"{remote['url']} | 远程健康正常" if remote["url"] else remote["detail"]
447 block = StatusBlock("远程发布", True, "可访问", detail, "success")
448 return block, {"value": "可访问", "detail": detail, "level": "success"}
449
450 health_summary = normalize_remote_health_detail(remote["health_detail"])
451 detail = f"{remote['url']} | {health_summary}" if remote["url"] else health_summary
452 block = StatusBlock("远程发布", True, "已发布,待验证", detail, "warning")
453 return block, {"value": "已发布", "detail": detail, "level": "warning"}
454
455
456def load_tailscale_status() -> dict[str, Any]:

Callers 1

collect_statusFunction · 0.85

Calls 2

StatusBlockClass · 0.85

Tested by

no test coverage detected