fix: unblock add-node API and improve online status detection

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-16 11:15:51 +08:00
parent db251c39bf
commit 33533d7ebc
3 changed files with 51 additions and 15 deletions
+4 -1
View File
@@ -279,14 +279,17 @@ def collect_node_stats() -> dict:
matched = [c for c in connections if _match_connection(c, node)]
if not matched and single_node and has_connections:
matched = connections
if not matched and (session_up + session_down) > 0:
matched = [None] # 有活跃会话但 Clash 未返回连接详情
if not matched and single_node and global_active:
up_speed = global_up_speed
down_speed = global_down_speed
online = (
len(matched) > 0
or (session_up + session_down) > 0
or (up_speed + down_speed) > 512
or (single_node and global_active)
or (single_node and (global_active or has_connections))
)
if online: