Net core: add single vless:// keys from BroV

- add_key accepts a vless:// link (uuid, host, port, Reality pbk checked; duplicates
  refused; the name from #fragment, made unique). Stored in keys/vless.txt (root, 600),
  served as the file provider vless-keys, which joins «ai-out» and «Авто» and the hide
  filter. The first key reloads the core (the provider appears), later ones only reload
  the provider. state reports vless-keys delays.
- BroV: «Добавить подключение» takes vpn:// or vless://.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maksarsanjeev
2026-10-12 20:20:49 +03:00
parent 882632b7ce
commit b11d778b04
4 changed files with 87 additions and 12 deletions
+7 -4
View File
@@ -229,10 +229,13 @@ final class NetCore: ObservableObject {
await refresh()
}
/// Sends a pasted vpn:// key to the helper (it checks, stores and tests it as root).
/// Sends a pasted vpn:// (Amnezia) or vless:// key to the helper (it checks, stores and
/// tests it as root).
func addAmneziaKey(_ text: String) async -> (ok: Bool, message: String) {
let key = text.trimmingCharacters(in: .whitespacesAndNewlines)
guard key.hasPrefix("vpn://") else { return (false, "Ключ должен начинаться с vpn://") }
guard key.hasPrefix("vpn://") || key.hasPrefix("vless://") else {
return (false, "Ключ должен начинаться с vpn:// (Амнезия) или vless://")
}
guard let r = await call(["cmd": "add_key", "text": key], timeout: 30) else {
return (false, "Помощник сетевого ядра не отвечает.")
}
@@ -689,8 +692,8 @@ struct AddAmneziaKeyView: View {
var body: some View {
VStack(alignment: .leading, spacing: 10) {
Text("Новое подключение Амнезии").font(.system(size: 13, weight: .semibold))
Text("Вставь ключ vpn:// из приложения Amnezia (Поделиться → AmneziaWG или ключ целиком).")
Text("Новое подключение").font(.system(size: 13, weight: .semibold))
Text("Вставь ключ vpn:// из приложения Amnezia или ссылку vless://. VLESS появится среди выходов и войдёт в «Авто»; первый такой ключ перезапустит ядро — соединения на секунду переподключатся.")
.font(.system(size: 11)).foregroundColor(Color(hex: "#8E939C"))
.fixedSize(horizontal: false, vertical: true)
TextEditor(text: $text)