Fixes bug.
ss-local has not been restarted after modified the current profile.
This commit is contained in:
@ -116,7 +116,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
|||||||
|
|
||||||
_ = notifyCenter.rx.notification(NOTIFY_CONF_CHANGED)
|
_ = notifyCenter.rx.notification(NOTIFY_CONF_CHANGED)
|
||||||
.subscribe(onNext: { noti in
|
.subscribe(onNext: { noti in
|
||||||
SyncSSLocal()
|
|
||||||
self.applyConfig()
|
self.applyConfig()
|
||||||
self.updateCopyHttpProxyExportMenu()
|
self.updateCopyHttpProxyExportMenu()
|
||||||
})
|
})
|
||||||
|
@ -70,8 +70,10 @@ func generateSSLocalLauchAgentPlist() -> Bool {
|
|||||||
dict.write(toFile: plistFilepath, atomically: true)
|
dict.write(toFile: plistFilepath, atomically: true)
|
||||||
let Sha1Sum = getFileSHA1Sum(plistFilepath)
|
let Sha1Sum = getFileSHA1Sum(plistFilepath)
|
||||||
if oldSha1Sum != Sha1Sum {
|
if oldSha1Sum != Sha1Sum {
|
||||||
|
NSLog("generateSSLocalLauchAgentPlist - File has been changed.")
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
NSLog("generateSSLocalLauchAgentPlist - File has not been changed.")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,12 +127,14 @@ func writeSSLocalConfFile(_ conf:[String:AnyObject]) -> Bool {
|
|||||||
|
|
||||||
let oldSum = getFileSHA1Sum(filepath)
|
let oldSum = getFileSHA1Sum(filepath)
|
||||||
try data.write(to: URL(fileURLWithPath: filepath), options: .atomic)
|
try data.write(to: URL(fileURLWithPath: filepath), options: .atomic)
|
||||||
let newSum = getFileSHA1Sum(filepath)
|
let newSum = data.sha1()
|
||||||
|
|
||||||
if oldSum == newSum {
|
if oldSum == newSum {
|
||||||
|
NSLog("writeSSLocalConfFile - File has not been changed.")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSLog("writeSSLocalConfFile - File has been changed.")
|
||||||
return true
|
return true
|
||||||
} catch {
|
} catch {
|
||||||
NSLog("Write ss-local file failed.")
|
NSLog("Write ss-local file failed.")
|
||||||
|
@ -48,14 +48,6 @@ class ServerProfileManager: NSObject {
|
|||||||
if getActiveProfile() == nil {
|
if getActiveProfile() == nil {
|
||||||
activeProfileId = nil
|
activeProfileId = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if activeProfileId != nil {
|
|
||||||
defaults.set(activeProfileId, forKey: "ActiveServerProfileId")
|
|
||||||
_ = writeSSLocalConfFile((getActiveProfile()?.toJsonConfig())!)
|
|
||||||
} else {
|
|
||||||
defaults.removeObject(forKey: "ActiveServerProfileId")
|
|
||||||
removeSSLocalConfFile()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getActiveProfile() -> ServerProfile? {
|
func getActiveProfile() -> ServerProfile? {
|
||||||
|
Reference in New Issue
Block a user