fix: xmpp type entries check via ejabberdctl JID online status
This commit is contained in:
@@ -962,6 +962,7 @@ def api_expected():
|
||||
entry["check"] = "tcp"
|
||||
elif svc_type == "xmpp_bot":
|
||||
entry["check"] = "xmpp" # xmpp bot without port means ejabberd-connected
|
||||
entry["jid"] = agent.get("jid", "")
|
||||
else:
|
||||
entry["check"] = "agent_online"
|
||||
expected.append(entry)
|
||||
@@ -1024,6 +1025,16 @@ def api_expected():
|
||||
# 远程服务:状态由 /api/platform 精确检测,这里标记为远程引用
|
||||
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:
|
||||
actual[name] = "unknown"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user