Bugfix: update api is unstabled now.relaunch to update config
This commit is contained in:
parent
3deaa4eb51
commit
3c1d220667
@ -15,7 +15,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
var statusItem: NSStatusItem!
|
||||
static let StatusItemIconWidth: CGFloat = NSStatusItem.variableLength * 2
|
||||
|
||||
|
||||
@IBOutlet weak var statusMenu: NSMenu!
|
||||
@IBOutlet weak var proxySettingMenuItem: NSMenuItem!
|
||||
@IBOutlet weak var autoStartMenuItem: NSMenuItem!
|
||||
@ -25,15 +24,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||
signal(SIGPIPE, SIG_IGN)
|
||||
|
||||
|
||||
_ = ProxyConfigManager.install()
|
||||
PFMoveToApplicationsFolderIfNecessary()
|
||||
self.startProxy()
|
||||
|
||||
statusItem = NSStatusBar.system.statusItem(withLength: 57)
|
||||
let view = StatusItemView.create(statusItem: statusItem,statusMenu: statusMenu)
|
||||
statusItem.view = view
|
||||
updateMenuItem()
|
||||
startProxy()
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,10 +30,15 @@ class ApiRequest{
|
||||
}
|
||||
|
||||
static func requestConfigUpdate(callback:@escaping ((Bool)->())){
|
||||
request(ConfigManager.apiUrl + "/configs", method: .put).responseJSON{
|
||||
data in
|
||||
// response is undocumented yet.
|
||||
callback(true)
|
||||
// request(ConfigManager.apiUrl + "/configs", method: .put).responseJSON{
|
||||
// data in
|
||||
// // response is undocumented yet.
|
||||
// callback(true)
|
||||
// }
|
||||
if let path = Bundle.main.resourceURL?.deletingLastPathComponent().deletingLastPathComponent().absoluteString {
|
||||
NSLog("restart \(path)")
|
||||
_ = Process.launchedProcess(launchPath: "/usr/bin/open", arguments: [path])
|
||||
NSApp.terminate(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user