feat(panel): reskin backend — node sortIndex, presence/speed, /api/system, credentials, subscription aggregation (Node+Go parity)

This commit is contained in:
aaaamoooo
2026-10-21 03:16:30 +08:00
parent c6f6b9dbea
commit d287bb9be9
23 changed files with 3370 additions and 146 deletions
+30
View File
@@ -272,6 +272,10 @@ func (a *App) housekeeping() {
return
}
a.getSessions().Prune()
// System-status sampling + due external-source refreshes (outside the
// transaction; fetches must not hold the store lock).
a.monitor().Sample(a.store.Snapshot(), false)
a.RefreshDueSources()
}
// ---------- main ----------
@@ -361,6 +365,32 @@ func run() error {
}
}
// Node sort order migration (idempotent): unless the stored
// sortIndex values are exactly the permutation 0..n-1, renumber by
// storage order. Mirrors the Node implementation's boot migration.
{
nodes := store.Snapshot().Nodes
seen := map[int]bool{}
valid := true
for _, node := range nodes {
if node.SortIndex < 0 || node.SortIndex >= len(nodes) || seen[node.SortIndex] {
valid = false
break
}
seen[node.SortIndex] = true
}
if !valid {
if _, err := store.Transaction(func(d *Data) (any, error) {
for index, node := range d.Nodes {
node.SortIndex = index
}
return nil, nil
}); err != nil {
return err
}
}
}
app := NewApp(store, nil, NewOrchestrator(store))
app.replaceSessions(NewSessionManager(app.sessionHours()))