Skip to content

Commit

Permalink
Merge branch 'release/1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuyuzhou committed Oct 19, 2016
2 parents fc11cc7 + 3c77fc9 commit 713bcae
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 156 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Then I rewrite the GUI code by swift.
- XCode 8.0+
- cocoapod 1.0.1+

## Download

From [here](https://github.com/shadowsocks/ShadowsocksX-NG/releases/)

## Fetures

- Use ss-local from shadowsocks-libev 2.4.6
Expand Down
13 changes: 0 additions & 13 deletions ShadowsocksX-NG.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,6 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
083BF8311D82731900831C68 /* SimplePing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimplePing.h; sourceTree = "<group>"; };
083BF8321D82731900831C68 /* SimplePing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimplePing.m; sourceTree = "<group>"; };
083BF8341D82742200831C68 /* NetWorkMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetWorkMonitor.swift; sourceTree = "<group>"; };
083BF8351D82742200831C68 /* PingClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PingClient.swift; sourceTree = "<group>"; };
083BF8381D82759600831C68 /* StatusItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusItemView.swift; sourceTree = "<group>"; };
083BF83A1D8275A800831C68 /* SystemThemeChangeHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemThemeChangeHelper.swift; sourceTree = "<group>"; };
085641E91D7188C400116B27 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
08805F181D878CA5009B53E7 /* PingTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PingTest.swift; sourceTree = "<group>"; };
0880CE3F1D6FE6D900BD39E2 /* example-gui-config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "example-gui-config.json"; sourceTree = "<group>"; };
088EC3961D5F5B8600E40791 /* whitelist.pac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = whitelist.pac; sourceTree = "<group>"; };
088EC3981D5F5BA300E40791 /* whiteiplist.pac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = whiteiplist.pac; sourceTree = "<group>"; };
08AF56C01D6AFA7C00DC4F46 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/PreferencesWindowController.strings"; sourceTree = "<group>"; };
19083CFCED87354F006967FF /* Pods_ShadowsocksX_NGUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ShadowsocksX_NGUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1E7783AEDB4A3BDDC9FF16AC /* libPods-proxy_conf_helper.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-proxy_conf_helper.a"; sourceTree = BUILT_PRODUCTS_DIR; };
283ED1A8E9B711AC65670031 /* Pods_ShadowsocksX_NG.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ShadowsocksX_NG.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -505,7 +493,6 @@
9B3FFF3A1D08CF110019A709 /* qrcode.htm in Resources */,
C6D429941DA75988002A5711 /* privoxy in Resources */,
C6D429991DA76FBC002A5711 /* privoxy.config.example in Resources */,
0880CE401D6FE6D900BD39E2 /* example-gui-config.json in Resources */,
9BEEF06B1D04D4D500FC52B3 /* stop_ss_local.sh in Resources */,
9B3FFF341D08CEF70019A709 /* SWBQRCodeWindowController.xib in Resources */,
9BEEF06C1D04D4D500FC52B3 /* reload_conf_ss_local.sh in Resources */,
Expand Down
32 changes: 15 additions & 17 deletions ShadowsocksX-NG/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
"ShadowsocksRunningMode": "auto",
"LocalSocks5.ListenPort": NSNumber(value: 1086 as UInt16),
"LocalSocks5.ListenAddress": "127.0.0.1",
"PacServer.ListenAddress": "127.0.0.1",
"PacServer.ListenPort":NSNumber(value: 8090 as UInt16),
"LocalSocks5.Timeout": NSNumber(value: 60 as UInt),
"LocalSocks5.EnableUDPRelay": NSNumber(value: false as Bool),
Expand Down Expand Up @@ -163,6 +162,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
updateLaunchAtLoginMenu()

ProxyConfHelper.install()
ProxyConfHelper.startMonitorPAC()
applyConfig()
SyncSSLocal()
}
Expand All @@ -171,10 +171,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
// Insert code here to tear down your application
StopSSLocal()
StopPrivoxy()
ProxyConfHelper.disableProxy("hi")
ProxyConfHelper.disableProxy()
let defaults = UserDefaults.standard
defaults.set(false, forKey: "ShadowsocksOn")
ProxyConfHelper.stopPACServer()
}

func applyConfig() {
Expand All @@ -186,16 +185,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
StartSSLocal()
StartPrivoxy()
if mode == "auto" {
ProxyConfHelper.enablePACProxy("hi")
ProxyConfHelper.enablePACProxy()
} else if mode == "global" {
ProxyConfHelper.enableGlobalProxy()
} else if mode == "manual" {
ProxyConfHelper.disableProxy("hi")
ProxyConfHelper.disableProxy()
}
} else {
StopSSLocal()
StopPrivoxy()
ProxyConfHelper.disableProxy("hi")
ProxyConfHelper.disableProxy()
}
}

Expand Down Expand Up @@ -385,18 +384,17 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
showRunningModeMenuItem.state = defaults.bool(forKey: "ShowRunningModeOnStatusBar") ? 1 : 0

var serverMenuText = "Servers".localized
if let serverProfiles = defaults.array(forKey: "ServerProfiles") {
for v in serverProfiles {
let profile = v as! [String:Any]
if profile["Id"] as! String == defaults.string(forKey: "ActiveServerProfileId")! {
var profileName :String
if profile["Remark"] as! String != "" {
profileName = profile["Remark"] as! String
} else {
profileName = profile["ServerHost"] as! String
}
serverMenuText = "\(serverMenuText) - \(profileName)"

let mgr = ServerProfileManager.instance
for p in mgr.profiles {
if mgr.activeProfileId == p.uuid {
var profileName :String
if !p.remark.isEmpty {
profileName = p.remark
} else {
profileName = p.serverHost
}
serverMenuText = "\(serverMenuText) - \(profileName)"
}
}
serversMenuItem.title = serverMenuText
Expand Down
Loading

0 comments on commit 713bcae

Please sign in to comment.