fix: xmpp type entries check via ejabberdctl JID online status

This commit is contained in:
hmo
2026-07-18 11:33:04 +08:00
parent 7eee60a7cf
commit 0139e2949d
+11
View File
@@ -962,6 +962,7 @@ def api_expected():
entry["check"] = "tcp" entry["check"] = "tcp"
elif svc_type == "xmpp_bot": elif svc_type == "xmpp_bot":
entry["check"] = "xmpp" # xmpp bot without port means ejabberd-connected entry["check"] = "xmpp" # xmpp bot without port means ejabberd-connected
entry["jid"] = agent.get("jid", "")
else: else:
entry["check"] = "agent_online" entry["check"] = "agent_online"
expected.append(entry) expected.append(entry)
@@ -1024,6 +1025,16 @@ def api_expected():
# 远程服务:状态由 /api/platform 精确检测,这里标记为远程引用 # 远程服务:状态由 /api/platform 精确检测,这里标记为远程引用
actual[name] = "remote (见平台Tab)" actual[name] = "remote (见平台Tab)"
elif check == "xmpp":
# 无端口号的 xmpp_bot:通过 ejabberdctl 查 JID 是否在线
jid = e.get("jid", "")
if jid:
online = _ejabberd_online_jids()
actual[name] = "online" if jid in online else "offline"
else:
actual[name] = "unknown"
elif check == "agent_online":
actual[name] = "unknown"
else: else:
actual[name] = "unknown" actual[name] = "unknown"