optimize: improve remote control reconnect
This commit is contained in:
parent
7b295cc6ea
commit
f695bc88c1
@ -244,7 +244,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
self.apiPortMenuItem.title = "Api Port: \(ConfigManager.shared.apiPort)"
|
||||
self.ipMenuItem.title = "IP: \(NetworkChangeNotifier.getPrimaryIPAddress() ?? "")"
|
||||
|
||||
ClashStatusTool.checkPortConfig(cfg: config)
|
||||
if RemoteControlManager.selectConfig == nil {
|
||||
ClashStatusTool.checkPortConfig(cfg: config)
|
||||
}
|
||||
|
||||
}.disposed(by: disposeBag)
|
||||
}
|
||||
@ -307,6 +309,17 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
Logger.log("proxy changed to no clashX setting: \(rawProxy)", level: .warning)
|
||||
NSUserNotificationCenter.default.postProxyChangeByOtherAppNotice()
|
||||
}.disposed(by: disposeBag)
|
||||
|
||||
NotificationCenter
|
||||
.default
|
||||
.rx
|
||||
.notification(.systemNetworkStatusIPUpdate).map({ _ in
|
||||
NetworkChangeNotifier.getPrimaryIPAddress(allowIPV6: false)
|
||||
}).bind { [weak self] _ in
|
||||
if RemoteControlManager.selectConfig != nil {
|
||||
self?.resetStreamApi()
|
||||
}
|
||||
}.disposed(by: disposeBag)
|
||||
}
|
||||
|
||||
func updateProxyList(withMenus menus: [NSMenuItem]) {
|
||||
@ -457,6 +470,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
SystemProxyManager.shared.disableProxy()
|
||||
SystemProxyManager.shared.enableProxy()
|
||||
}
|
||||
|
||||
if RemoteControlManager.selectConfig != nil {
|
||||
resetStreamApi()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func healthHeckOnNetworkChange() {
|
||||
@ -469,10 +486,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if RemoteControlManager.selectConfig != nil {
|
||||
resetStreamApi()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ class ApiRequest {
|
||||
|
||||
static func useDirectApi() -> Bool {
|
||||
if ConfigManager.shared.overrideApiURL != nil {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
return ConfigManager.builtInApiMode
|
||||
}
|
||||
@ -412,7 +412,7 @@ extension ApiRequest: WebSocketDelegate {
|
||||
[weak self] _ in
|
||||
if self?.loggingWebSocket?.isConnected == true { return }
|
||||
self?.requestLog()
|
||||
})
|
||||
})
|
||||
loggingWebSocketRetryDelay *= 2
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user