mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-15 12:53:41 +00:00
Preserve existing profile connections when opening more pages
This commit is contained in:
1 parent
ca98806dcc
commit
c47b735fc4
8 files changed
+46
-11
No files matched your search
+6
@@ -5,6 +5,7 @@ import Network
|
||||
import Flutter
|
||||
|
||||
final class GopeedProfiles {
|
||||
private static var proxyURLs: [String: String] = [:]
|
||||
private static var stores: [String: WKWebsiteDataStore] = [:]
|
||||
static func store(_ identifier: String) -> WKWebsiteDataStore? { stores[identifier] }
|
||||
|
||||
@@ -19,11 +20,16 @@ final class GopeedProfiles {
|
||||
result(FlutterError(code: "UNAVAILABLE", message: "Isolated WebView profiles and proxy require macOS 14 / iOS 17 or newer and valid host configuration", details: nil))
|
||||
return
|
||||
}
|
||||
if stores[identifier] != nil && proxyURLs[identifier] == proxyURL {
|
||||
result(true)
|
||||
return
|
||||
}
|
||||
let store = stores[identifier] ?? WKWebsiteDataStore(forIdentifier: uuid)
|
||||
let endpoint = nw_endpoint_create_host(host, String(port))
|
||||
let proxy = nw_proxy_config_create_socksv5(endpoint)
|
||||
store.__proxyConfigurations = [proxy]
|
||||
stores[identifier] = store
|
||||
proxyURLs[identifier] = proxyURL
|
||||
result(true)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user