fix: multi-node online stats, per-node Hy2 ports, and panel reload stability

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-16 11:35:15 +08:00
parent 33533d7ebc
commit abbaac9520
11 changed files with 246 additions and 73 deletions
+16
View File
@@ -0,0 +1,16 @@
"""节点端口与 inbound 标签(多节点统计用)。"""
def ordered_nodes(nodes: list[dict]) -> list[dict]:
return sorted(nodes, key=lambda n: int(n["id"]))
def hy2_port(node: dict, nodes: list[dict], base: int = 8443) -> int:
for index, item in enumerate(ordered_nodes(nodes)):
if int(item["id"]) == int(node["id"]):
return base + index
return base
def hy2_inbound_tag(node_id: int) -> str:
return f"hy2-in-{node_id}"