Master keys tab: same columns as users, device IPs, per-key summary

Status, priority/torrent chips and IP columns like the users tab; the API
returns each device's IP per server. The key row sums its devices (online,
priority, traffic); key UUID and device ID sit under the name, copy on click.
This commit is contained in:
2026-10-19 12:23:21 +03:00
parent ea91265674
commit d6fc2049c3
5 changed files with 118 additions and 43 deletions
+5 -1
View File
@@ -437,10 +437,14 @@ func (s *Sub) masterDevices(m *masterRow) ([]any, error) {
st = &devStat{}
}
okN := 0
ips := []any{} // IP устройства на каждом сервере ключа, где он уже выдан
for _, l := range links {
if l.PeerPub.Valid && l.PeerPub.String == d.PubKey && l.IP.Valid && l.IP.String != "" {
okN++
}
if l.IP.Valid && l.IP.String != "" {
ips = append(ips, jsjson.Object{{Key: "server_id", Val: l.ServerID}, {Key: "ip", Val: l.IP.String}})
}
}
prio := "normal"
if st.background {
@@ -452,7 +456,7 @@ func (s *Sub) masterDevices(m *masterRow) ([]any, error) {
{Key: "rekey_requested", Val: d.RekeyRequested == 1}, {Key: "online", Val: st.online}, {Key: "lastHandshake", Val: st.lastHS},
{Key: "rx", Val: st.rx}, {Key: "tx", Val: st.tx}, {Key: "priority", Val: prio},
{Key: "torrent", Val: st.torrent},
{Key: "servers_total", Val: len(links)}, {Key: "servers_ok", Val: okN},
{Key: "servers_total", Val: len(links)}, {Key: "servers_ok", Val: okN}, {Key: "ips", Val: ips},
})
}
return out, nil