Net core: subscription fetched through the exit, hourly, and on demand

The cluster subscription host is unreachable directly from home: the provider pull had
failed with EOF since day one and the node list went stale (a new node, Aurora, never
showed up). The provider now downloads through «exit», every hour instead of 12, and
netctl refresh (BroV: «Обновить список узлов») pulls it now and reports added/removed
nodes, without a reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maksarsanjeev
2026-10-12 20:36:05 +03:00
parent b11d778b04
commit 0586b3c7e9
3 changed files with 44 additions and 3 deletions
+30
View File
@@ -276,6 +276,24 @@ final class NetCore: ObservableObject {
await refresh()
}
/// Re-downloads the cluster subscription now (new nodes appear without a reload).
func refreshNodes() async {
busy = true
let r = await call(["cmd": "refresh"], timeout: 40)
busy = false
if r?["ok"] as? Bool == true {
let added = r?["added"] as? [String] ?? [], removed = r?["removed"] as? [String] ?? []
lastError = added.isEmpty && removed.isEmpty ? "Список узлов актуален."
: ([added.isEmpty ? nil : "Новые узлы: " + added.joined(separator: ", "),
removed.isEmpty ? nil : "Пропали: " + removed.joined(separator: ", ")].compactMap { $0 }.joined(separator: ". ") + ".")
SoundEngine.shared.play("pop")
} else {
lastError = "Не удалось обновить подписку: \(r?["error"] as? String ?? "помощник не ответил")."
}
await refresh()
await measure()
}
/// VLESS nodes come from the subscription: hiding one rebuilds the core config.
static func needsReload(_ name: String) -> Bool { !name.hasPrefix("AWG ") }
@@ -458,6 +476,18 @@ struct NetPanel: View {
}
}
if !net.hidden.isEmpty { HiddenSection(net: net) }
Button { Task { await net.refreshNodes() } } label: {
HStack(spacing: 5) {
Image(systemName: "arrow.triangle.2.circlepath").font(.system(size: 11))
Text("Обновить список узлов").font(.system(size: 11.5, weight: .medium))
}
.foregroundColor(Color(hex: "#8E939C"))
.padding(.horizontal, 8).padding(.vertical, 6)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
.disabled(net.busy)
.help("Скачать подписку кластера сейчас — новые узлы появятся сразу")
}
.frame(width: 230)