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