misc: sync core between ClashX and ClashXPro

This commit is contained in:
yicheng 2023-09-05 09:46:04 +08:00
parent 35fd4716bc
commit 4df2c0bec6
4 changed files with 22 additions and 6 deletions

View File

@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/sindresorhus/KeyboardShortcuts.git",
"state" : {
"revision" : "b878f8132be59576fc87e39405b1914eff9f55d3",
"version" : "1.14.1"
"revision" : "8b1a9ce78c2f35c8a55dcc95897573abd2cc4f6e",
"version" : "1.13.0"
}
}
],

View File

@ -175,7 +175,8 @@ class RemoteConfigManager {
if ICloudManager.shared.useiCloud.value {
ConfigFileManager.shared.stopWatchConfigFile()
} else if config.name == ConfigManager.selectConfigName {
}
if config.name == ConfigManager.selectConfigName {
ConfigFileManager.shared.pauseForNextChange()
}

View File

@ -18,9 +18,6 @@ enum Settings {
@UserDefault("disableNoti", defaultValue: false)
static var disableNoti: Bool
@UserDefault("usePacMode", defaultValue: false)
static var usePacMode: Bool
@UserDefault("configAutoUpdateInterval", defaultValue: 48*60*60)
static var configAutoUpdateInterval: TimeInterval

View File

@ -128,6 +128,24 @@ class NetworkChangeNotifier {
return dict?[kSCDynamicStorePropNetPrimaryInterface as String]
}
static func getPrimaryIsDhcp() -> Bool {
let store = SCDynamicStoreCreate(nil, "ClashX" as CFString, nil, nil)
if store == nil {
return false
}
let key = SCDynamicStoreKeyCreateNetworkGlobalEntity(nil, kSCDynamicStoreDomainState, kSCEntNetIPv4)
let dict = SCDynamicStoreCopyValue(store, key) as? [String: String]
guard let serviceID = dict?[kSCDynamicStorePropNetPrimaryService as String] else { return false }
let dhcpInfoKey = SCDynamicStoreKeyCreateNetworkServiceEntity(nil,
kSCDynamicStoreDomainState,
serviceID as CFString,
kSCEntNetDHCP)
let dhcpInfo = SCDynamicStoreCopyValue(store, dhcpInfoKey) as? [String: Any]
return dhcpInfo != nil
}
static func getCurrentDns() -> [String] {
let store = SCDynamicStoreCreate(nil, "ClashX" as CFString, nil, nil)
if store == nil {