mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-31 04:12:13 +03:00
fix(nodes): keep the credential-presence flag on the node heartbeat push
The Nodes page cache is overwritten wholesale by the heartbeat websocket push, but the job broadcast a raw []*model.Node while the REST list returns []*service.NodeView. model.Node tags the api token json:"-" and carries no hasApiToken field, so every push stripped the flag the edit form reads to decide whether a token is already stored. One 5s tick after the page loaded, editing any non-mTLS node then failed with "Name, address, port and API token are required" — and stayed failed, because setQueryData refreshes dataUpdatedAt, so the query never goes stale and never refetches the intact REST payload. Broadcast the NodeView read contract instead.
This commit is contained in:
@@ -63,7 +63,7 @@ func (j *NodeHeartbeatJob) Run() {
|
||||
if !websocket.HasClients() {
|
||||
return
|
||||
}
|
||||
updated, err := j.nodeService.GetNodeTree()
|
||||
updated, err := j.nodeService.GetNodeTreeView()
|
||||
if err != nil {
|
||||
logger.Warning("node heartbeat: load nodes for broadcast failed:", err)
|
||||
return
|
||||
|
||||
@@ -63,9 +63,6 @@ func BroadcastInbounds(inbounds any) {
|
||||
}
|
||||
}
|
||||
|
||||
// BroadcastNodes broadcasts the fresh node list to all connected clients.
|
||||
// Pushed by NodeHeartbeatJob at the end of each 10s tick so the Nodes page
|
||||
// reflects status / latency / cpu / mem updates without polling.
|
||||
func BroadcastNodes(nodes any) {
|
||||
if hub := GetHub(); hub != nil {
|
||||
hub.Broadcast(MessageTypeNodes, nodes)
|
||||
|
||||
Reference in New Issue
Block a user