Compare commits

...
21 Commits
Author SHA1 Message Date
Charlie Qiu 9e231a7b34 Merge branch 'release/1.3.2' 2016-11-01 11:36:46 +08:00
Charlie Qiu 381b9ce634 Update version number to 1.3.2 2016-10-21 23:37:23 +08:00
Charlie Qiu cf2f5d1a9c Fix bug #106 by workaround. 2016-10-21 23:36:05 +08:00
Charlie Qiu d2b8ca1c97 Fix bug #104.
Implement show qrcode by core image generator instead of embed a web view.
2016-10-21 23:27:30 +08:00
Charlie Qiu 082c25f5e2 Fix bug. http preferences 输入框bind需要启用:continuously updates value 2016-10-20 10:58:26 +08:00
Charlie Qiu 969c94eaff Merge branch 'pr/100' into develop 2016-10-20 08:31:33 +08:00
Julien Schmidt e4236f21a1 Corrected Spellings 2016-10-20 01:14:47 +08:00
Charlie Qiu 299abfee7b Fix #98, Don't turn off when app Terminate. 2016-10-19 23:59:52 +08:00
Charlie Qiu 713bcae7b1 Merge branch 'release/1.3.1' 2016-10-19 14:32:40 +08:00
Charlie Qiu 3c77fc9fe9 Fix the project file. 2016-10-19 00:30:53 +08:00
Charlie Qiu 53d41ad27b Update version number to 1.3.1 2016-10-19 00:30:21 +08:00
Charlie Qiu a85fc4e3b4 Disable the rich text attribute of the user pac fule edit control. 2016-10-19 00:26:16 +08:00
Charlie Qiu e5b342c134 Monitor PAC file. Disable then enable the system pac configure after it has been modified. 2016-10-19 00:24:45 +08:00
Charlie Qiu d0ad272198 Refactor pac proxy. 2016-10-18 23:35:17 +08:00
Charlie Qiu 7ad9dc42a0 Fix bug caused by pr #97 2016-10-18 22:18:54 +08:00
Charlie Qiu 5ed5789c31 Merge branch 'pr/97' into develop
# Conflicts:
#	ShadowsocksX-NG/AppDelegate.swift
2016-10-18 22:11:04 +08:00
Charlie Qiu c7211ceb19 Merge commit 'fc11cc78fd9ad96d026485e07e643c751ad4669b' into develop 2016-10-18 16:07:05 +08:00
Qiu Yuzhou fc11cc78fd Merge pull request #92 from linuxbelletian/master
defaults.array(forKey: "ServerProfiles")  would return nil ,but not h…
2016-10-18 16:04:10 +08:00
qinyuhang dd20ebda68 fix crash problem 2016-10-18 15:36:56 +08:00
田兵 22d654dd69 defaults.array(forKey: "ServerProfiles") would return nil ,but not handle 2016-10-17 16:13:42 +08:00
Qiu Yuzhou 8fa7f76faa Add a download link in readme. 2016-10-15 00:33:53 +08:00
19 changed files with 275 additions and 253 deletions
+18 -14
View File
@@ -8,13 +8,13 @@ Next Generation of [ShadowsocksX](https://github.com/shadowsocks/shadowsocks-iOS
## Why? ## Why?
It's hard to maintain the original implement. There are too many unused code in it. It's hard to maintain the original implementation as there is too much unused code in it.
It also embed ss-local source. It's crazy to maintain depandences of ss-local. It also embeds the ss-local source. It's crazy to maintain dependencies of ss-local.
So it's hard to update ss-local version. So it's hard to update the ss-local version.
Now I just copy the ss-local from home brew. Run ss-local executable as a Launch Agent in background. Now I just copied the ss-local from homebrew. Run ss-local executable as a Launch Agent in the background.
Serve pac js file as a file url. So there are only some souce code related to GUI left. Serve PAC js file as a file URL. So there is only some source code related to GUI left.
Then I rewrite the GUI code by swift. Then I will rewrite the GUI code in Swift.
## Requirements ## Requirements
@@ -27,30 +27,34 @@ Then I rewrite the GUI code by swift.
- XCode 8.0+ - XCode 8.0+
- cocoapod 1.0.1+ - cocoapod 1.0.1+
## Download
From [here](https://github.com/shadowsocks/ShadowsocksX-NG/releases/)
## Fetures ## Fetures
- Use ss-local from shadowsocks-libev 2.4.6 - Use ss-local from shadowsocks-libev 2.4.6
- Update PAC by download GFW List from github. - Update PAC by download GFW List from GitHub.
- Show QRCode for current server profile. - Show QRCode for current server profile.
- Scan QRCode from screen. - Scan QRCode from screen.
- Auto launch at login. - Auto launch at login.
- User rules for PAC. - User rules for PAC.
- Support OTA - Support OTA
- An advance preferences panel to configure: - An advanced preferences panel to configure:
- Local socks5 listen address. - Local socks5 listen address.
- Local socks5 listen port. - Local socks5 listen port.
- Local socks5 timeout. - Local socks5 timeout.
- If enable UDP relay. - If enable UDP relay.
- GFW List url. - GFW List URL.
- Manual spesify network service profiles which would be configure the proxy. - Manual specify network service profiles which would be configure the proxy.
- Could reorder shadowsocks profiles by drag & drop in servers preferences panel. - Could reorder shadowsocks profiles by drag & drop in servers preferences panel.
## Different from orignal ShadowsocksX ## Different from orignal ShadowsocksX
Run ss-local as backgroud service through launchd, not in app process. Run ss-local as a background service through launchd, not as an in-app process.
So after you quit the app, the ss-local maybe is still running. So after you quit the app, the ss-local maybe be still running.
Add a manual mode which won't configure the system proxy settings. Added a manual mode which won't configure the system proxy settings.
Then you could configure your apps to use socks5 proxy manual. Then you could configure your apps to use socks5 proxy manual.
## Contributing ## Contributing
@@ -65,5 +69,5 @@ ref: [GitFlow](http://nvie.com/posts/a-successful-git-branching-model/)
## License ## License
The project is released under the terms of GPLv3. The project is released under the terms of the GPLv3.
-25
View File
@@ -30,9 +30,6 @@
9B3FFF291D08A1DF0019A709 /* user-rule.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF281D08A1DF0019A709 /* user-rule.txt */; }; 9B3FFF291D08A1DF0019A709 /* user-rule.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF281D08A1DF0019A709 /* user-rule.txt */; };
9B3FFF321D08CEE40019A709 /* SWBQRCodeWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF311D08CEE40019A709 /* SWBQRCodeWindowController.m */; }; 9B3FFF321D08CEE40019A709 /* SWBQRCodeWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF311D08CEE40019A709 /* SWBQRCodeWindowController.m */; };
9B3FFF341D08CEF70019A709 /* SWBQRCodeWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF331D08CEF70019A709 /* SWBQRCodeWindowController.xib */; }; 9B3FFF341D08CEF70019A709 /* SWBQRCodeWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF331D08CEF70019A709 /* SWBQRCodeWindowController.xib */; };
9B3FFF381D08CF110019A709 /* jquery.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF351D08CF110019A709 /* jquery.min.js */; };
9B3FFF391D08CF110019A709 /* qrcode.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF361D08CF110019A709 /* qrcode.min.js */; };
9B3FFF3A1D08CF110019A709 /* qrcode.htm in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF371D08CF110019A709 /* qrcode.htm */; };
9B3FFF3E1D08D9910019A709 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B3FFF3D1D08D9910019A709 /* SystemConfiguration.framework */; }; 9B3FFF3E1D08D9910019A709 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B3FFF3D1D08D9910019A709 /* SystemConfiguration.framework */; };
9B3FFF471D09CD3B0019A709 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF461D09CD3B0019A709 /* main.m */; }; 9B3FFF471D09CD3B0019A709 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF461D09CD3B0019A709 /* main.m */; };
9B3FFF4C1D09D8F70019A709 /* install_helper.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF4B1D09D8F70019A709 /* install_helper.sh */; }; 9B3FFF4C1D09D8F70019A709 /* install_helper.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF4B1D09D8F70019A709 /* install_helper.sh */; };
@@ -96,18 +93,6 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference 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; }; 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; }; 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; }; 283ED1A8E9B711AC65670031 /* Pods_ShadowsocksX_NG.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ShadowsocksX_NG.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -152,9 +137,6 @@
9B3FFF301D08CEE40019A709 /* SWBQRCodeWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWBQRCodeWindowController.h; sourceTree = "<group>"; }; 9B3FFF301D08CEE40019A709 /* SWBQRCodeWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWBQRCodeWindowController.h; sourceTree = "<group>"; };
9B3FFF311D08CEE40019A709 /* SWBQRCodeWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWBQRCodeWindowController.m; sourceTree = "<group>"; }; 9B3FFF311D08CEE40019A709 /* SWBQRCodeWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWBQRCodeWindowController.m; sourceTree = "<group>"; };
9B3FFF331D08CEF70019A709 /* SWBQRCodeWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SWBQRCodeWindowController.xib; sourceTree = "<group>"; }; 9B3FFF331D08CEF70019A709 /* SWBQRCodeWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SWBQRCodeWindowController.xib; sourceTree = "<group>"; };
9B3FFF351D08CF110019A709 /* jquery.min.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jquery.min.js; sourceTree = "<group>"; };
9B3FFF361D08CF110019A709 /* qrcode.min.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = qrcode.min.js; sourceTree = "<group>"; };
9B3FFF371D08CF110019A709 /* qrcode.htm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = qrcode.htm; sourceTree = "<group>"; };
9B3FFF3B1D08D93B0019A709 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 9B3FFF3B1D08D93B0019A709 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
9B3FFF3D1D08D9910019A709 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 9B3FFF3D1D08D9910019A709 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
9B3FFF441D09CD3B0019A709 /* proxy_conf_helper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = proxy_conf_helper; sourceTree = BUILT_PRODUCTS_DIR; }; 9B3FFF441D09CD3B0019A709 /* proxy_conf_helper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = proxy_conf_helper; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -253,9 +235,6 @@
9BE8FBBD1D0B1FB900CAFD01 /* libcrypto.1.0.0.dylib */, 9BE8FBBD1D0B1FB900CAFD01 /* libcrypto.1.0.0.dylib */,
9B172A6C1D0ADDDD00B87B9A /* Localizable.strings */, 9B172A6C1D0ADDDD00B87B9A /* Localizable.strings */,
9B3FFF4B1D09D8F70019A709 /* install_helper.sh */, 9B3FFF4B1D09D8F70019A709 /* install_helper.sh */,
9B3FFF351D08CF110019A709 /* jquery.min.js */,
9B3FFF361D08CF110019A709 /* qrcode.min.js */,
9B3FFF371D08CF110019A709 /* qrcode.htm */,
9B3FFF281D08A1DF0019A709 /* user-rule.txt */, 9B3FFF281D08A1DF0019A709 /* user-rule.txt */,
9B3FFF261D0898EB0019A709 /* gfwlist.txt */, 9B3FFF261D0898EB0019A709 /* gfwlist.txt */,
9B3FFF221D088E8D0019A709 /* abp.js */, 9B3FFF221D088E8D0019A709 /* abp.js */,
@@ -501,11 +480,8 @@
C6D429971DA75988002A5711 /* stop_privoxy.sh in Resources */, C6D429971DA75988002A5711 /* stop_privoxy.sh in Resources */,
C8E42A6E1D4F2CAF0074C7EA /* UserRulesController.xib in Resources */, C8E42A6E1D4F2CAF0074C7EA /* UserRulesController.xib in Resources */,
9BEEF06A1D04D4D500FC52B3 /* start_ss_local.sh in Resources */, 9BEEF06A1D04D4D500FC52B3 /* start_ss_local.sh in Resources */,
9B3FFF391D08CF110019A709 /* qrcode.min.js in Resources */,
9B3FFF3A1D08CF110019A709 /* qrcode.htm in Resources */,
C6D429941DA75988002A5711 /* privoxy in Resources */, C6D429941DA75988002A5711 /* privoxy in Resources */,
C6D429991DA76FBC002A5711 /* privoxy.config.example in Resources */, C6D429991DA76FBC002A5711 /* privoxy.config.example in Resources */,
0880CE401D6FE6D900BD39E2 /* example-gui-config.json in Resources */,
9BEEF06B1D04D4D500FC52B3 /* stop_ss_local.sh in Resources */, 9BEEF06B1D04D4D500FC52B3 /* stop_ss_local.sh in Resources */,
9B3FFF341D08CEF70019A709 /* SWBQRCodeWindowController.xib in Resources */, 9B3FFF341D08CEF70019A709 /* SWBQRCodeWindowController.xib in Resources */,
9BEEF06C1D04D4D500FC52B3 /* reload_conf_ss_local.sh in Resources */, 9BEEF06C1D04D4D500FC52B3 /* reload_conf_ss_local.sh in Resources */,
@@ -514,7 +490,6 @@
C6D429951DA75988002A5711 /* reload_conf_privoxy.sh in Resources */, C6D429951DA75988002A5711 /* reload_conf_privoxy.sh in Resources */,
9B0BFFEB1D0460A70040E62B /* Assets.xcassets in Resources */, 9B0BFFEB1D0460A70040E62B /* Assets.xcassets in Resources */,
9B2491B71D0ACC3E003BBECC /* AdvPreferencesWindowController.xib in Resources */, 9B2491B71D0ACC3E003BBECC /* AdvPreferencesWindowController.xib in Resources */,
9B3FFF381D08CF110019A709 /* jquery.min.js in Resources */,
9B3FFF271D0898EB0019A709 /* gfwlist.txt in Resources */, 9B3FFF271D0898EB0019A709 /* gfwlist.txt in Resources */,
C6D429931DA75988002A5711 /* install_privoxy.sh in Resources */, C6D429931DA75988002A5711 /* install_privoxy.sh in Resources */,
9BC70EDC1D2E3E3100EDA4CA /* Localizable.strings in Resources */, 9BC70EDC1D2E3E3100EDA4CA /* Localizable.strings in Resources */,
+12 -14
View File
@@ -58,7 +58,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
"ShadowsocksRunningMode": "auto", "ShadowsocksRunningMode": "auto",
"LocalSocks5.ListenPort": NSNumber(value: 1086 as UInt16), "LocalSocks5.ListenPort": NSNumber(value: 1086 as UInt16),
"LocalSocks5.ListenAddress": "127.0.0.1", "LocalSocks5.ListenAddress": "127.0.0.1",
"PacServer.ListenAddress": "127.0.0.1",
"PacServer.ListenPort":NSNumber(value: 8090 as UInt16), "PacServer.ListenPort":NSNumber(value: 8090 as UInt16),
"LocalSocks5.Timeout": NSNumber(value: 60 as UInt), "LocalSocks5.Timeout": NSNumber(value: 60 as UInt),
"LocalSocks5.EnableUDPRelay": NSNumber(value: false as Bool), "LocalSocks5.EnableUDPRelay": NSNumber(value: false as Bool),
@@ -163,6 +162,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
updateLaunchAtLoginMenu() updateLaunchAtLoginMenu()
ProxyConfHelper.install() ProxyConfHelper.install()
ProxyConfHelper.startMonitorPAC()
applyConfig() applyConfig()
SyncSSLocal() SyncSSLocal()
} }
@@ -171,10 +171,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
// Insert code here to tear down your application // Insert code here to tear down your application
StopSSLocal() StopSSLocal()
StopPrivoxy() StopPrivoxy()
ProxyConfHelper.disableProxy("hi") ProxyConfHelper.disableProxy()
let defaults = UserDefaults.standard
defaults.set(false, forKey: "ShadowsocksOn")
ProxyConfHelper.stopPACServer()
} }
func applyConfig() { func applyConfig() {
@@ -186,16 +183,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
StartSSLocal() StartSSLocal()
StartPrivoxy() StartPrivoxy()
if mode == "auto" { if mode == "auto" {
ProxyConfHelper.enablePACProxy("hi") ProxyConfHelper.enablePACProxy()
} else if mode == "global" { } else if mode == "global" {
ProxyConfHelper.enableGlobalProxy() ProxyConfHelper.enableGlobalProxy()
} else if mode == "manual" { } else if mode == "manual" {
ProxyConfHelper.disableProxy("hi") ProxyConfHelper.disableProxy()
} }
} else { } else {
StopSSLocal() StopSSLocal()
StopPrivoxy() StopPrivoxy()
ProxyConfHelper.disableProxy("hi") ProxyConfHelper.disableProxy()
} }
} }
@@ -385,14 +382,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
showRunningModeMenuItem.state = defaults.bool(forKey: "ShowRunningModeOnStatusBar") ? 1 : 0 showRunningModeMenuItem.state = defaults.bool(forKey: "ShowRunningModeOnStatusBar") ? 1 : 0
var serverMenuText = "Servers".localized var serverMenuText = "Servers".localized
for v in defaults.array(forKey: "ServerProfiles")! {
let profile = v as! [String:Any] let mgr = ServerProfileManager.instance
if profile["Id"] as! String == defaults.string(forKey: "ActiveServerProfileId")! { for p in mgr.profiles {
if mgr.activeProfileId == p.uuid {
var profileName :String var profileName :String
if profile["Remark"] as! String != "" { if !p.remark.isEmpty {
profileName = profile["Remark"] as! String profileName = p.remark
} else { } else {
profileName = profile["ServerHost"] as! String profileName = p.serverHost
} }
serverMenuText = "\(serverMenuText) - \(profileName)" serverMenuText = "\(serverMenuText) - \(profileName)"
} }
@@ -12,32 +12,21 @@
</customObject> </customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Advance Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" animationBehavior="default" id="F0z-JX-Cv5"> <window title="Advanced Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<rect key="contentRect" x="562" y="415" width="480" height="416"/> <rect key="contentRect" x="562" y="415" width="480" height="345"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/> <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" id="se5-gp-TjO"> <view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="480" height="416"/> <rect key="frame" x="0.0" y="0.0" width="480" height="345"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="ayu-Tb-kmf"> <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="ayu-Tb-kmf">
<rect key="frame" x="38" y="120" width="405" height="5"/> <rect key="frame" x="41" y="120" width="405" height="5"/>
</box> </box>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="I4a-N9-Tkv">
<rect key="frame" x="48" y="97" width="192" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="188" id="Tny-lh-gfo"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="GFW List URL:" id="dg0-gS-z5V">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="6MD-Ry-R5P"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="6MD-Ry-R5P">
<rect key="frame" x="49" y="20" width="378" height="69"/> <rect key="frame" x="54" y="20" width="378" height="69"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="69" id="NVe-Ir-JCv"/> <constraint firstAttribute="height" constant="69" id="yzO-2D-eTT"/>
</constraints> </constraints>
<textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="fS7-It-ERD"> <textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="fS7-It-ERD">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
@@ -53,7 +42,7 @@
</connections> </connections>
</textField> </textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wCp-nB-dda"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wCp-nB-dda">
<rect key="frame" x="18" y="379" width="439" height="17"/> <rect key="frame" x="18" y="308" width="439" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Don't change these preferences if you have no idea what are they." id="8wL-qv-5nD"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Don't change these preferences if you have no idea what are they." id="8wL-qv-5nD">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -61,10 +50,10 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="JBW-8M-eHP"> <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="JBW-8M-eHP">
<rect key="frame" x="36" y="368" width="405" height="5"/> <rect key="frame" x="36" y="297" width="403" height="5"/>
</box> </box>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="S5h-Xx-HUG"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="S5h-Xx-HUG">
<rect key="frame" x="27" y="306" width="204" height="17"/> <rect key="frame" x="27" y="239" width="204" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Local Socks5 Listen Port:" id="qRs-ow-vVB"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Local Socks5 Listen Port:" id="qRs-ow-vVB">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -72,7 +61,7 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xWv-tc-lQe"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xWv-tc-lQe">
<rect key="frame" x="27" y="343" width="204" height="17"/> <rect key="frame" x="27" y="272" width="204" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Local Socks5 Listen Address:" id="cwr-n0-zwn"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Local Socks5 Listen Address:" id="cwr-n0-zwn">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -80,7 +69,7 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Q2L-Fh-TW1"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Q2L-Fh-TW1">
<rect key="frame" x="237" y="340" width="160" height="22"/> <rect key="frame" x="237" y="269" width="160" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="iRm-V5-3gu"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="iRm-V5-3gu">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -95,7 +84,7 @@
</connections> </connections>
</textField> </textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="e3S-m6-k5Y"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="e3S-m6-k5Y">
<rect key="frame" x="27" y="190" width="204" height="17"/> <rect key="frame" x="27" y="175" width="204" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Timeout:" id="i4l-2S-gOQ"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Timeout:" id="i4l-2S-gOQ">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -103,7 +92,7 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sRP-xs-alR"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sRP-xs-alR">
<rect key="frame" x="237" y="185" width="60" height="22"/> <rect key="frame" x="237" y="173" width="60" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="wjv-Nc-tjX"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="wjv-Nc-tjX">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -119,7 +108,7 @@
</connections> </connections>
</textField> </textField>
<button translatesAutoresizingMaskIntoConstraints="NO" id="DiD-K0-Y43"> <button translatesAutoresizingMaskIntoConstraints="NO" id="DiD-K0-Y43">
<rect key="frame" x="235" y="155" width="219" height="18"/> <rect key="frame" x="235" y="149" width="219" height="18"/>
<buttonCell key="cell" type="check" title="Enable Udp Replay" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="1C3-4s-Apd"> <buttonCell key="cell" type="check" title="Enable Udp Replay" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="1C3-4s-Apd">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
@@ -129,9 +118,9 @@
</connections> </connections>
</button> </button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XQ5-fw-o8t"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XQ5-fw-o8t">
<rect key="frame" x="237" y="303" width="60" height="22"/> <rect key="frame" x="237" y="237" width="60" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="60" id="reo-ha-VKi"/> <constraint firstAttribute="width" constant="60" id="S9f-Rp-2gz"/>
</constraints> </constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="rfR-7k-cS8"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="rfR-7k-cS8">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
@@ -148,10 +137,7 @@
</connections> </connections>
</textField> </textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eoD-7r-Q85"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eoD-7r-Q85">
<rect key="frame" x="303" y="188" width="96" height="17"/> <rect key="frame" x="303" y="175" width="96" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="92" id="xw1-XT-mjQ"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Seconds" id="Gd3-Fm-sWh"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Seconds" id="Gd3-Fm-sWh">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -168,18 +154,16 @@
<binding destination="pR1-Bo-AWz" name="value" keyPath="values.LocalSocks5.EnableVerboseMode" id="Nu9-zu-vUE"/> <binding destination="pR1-Bo-AWz" name="value" keyPath="values.LocalSocks5.EnableVerboseMode" id="Nu9-zu-vUE"/>
</connections> </connections>
</button> </button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Wsf-gl-dkY"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Wsf-gl-dkY">
<rect key="frame" x="90" y="230" width="141" height="17"/> <rect key="frame" x="90" y="207" width="141" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Local PAC Listien Port:" id="DiO-6B-ALO"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Local PAC Listien Port:" id="DiO-6B-ALO">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FoE-i9-Rfb"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FoE-i9-Rfb">
<rect key="frame" x="237" y="227" width="60" height="22"/> <rect key="frame" x="237" y="205" width="60" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="XhZ-XN-MoS"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="XhZ-XN-MoS">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -194,22 +178,12 @@
<outlet property="formatter" destination="uE9-0u-CJW" id="YNn-yx-cWk"/> <outlet property="formatter" destination="uE9-0u-CJW" id="YNn-yx-cWk"/>
</connections> </connections>
</textField> </textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8Co-1p-O4m"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="I4a-N9-Tkv">
<rect key="frame" x="237" y="265" width="160" height="22"/> <rect key="frame" x="52" y="97" width="192" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="Z9Z-Tz-7l4"> <constraint firstAttribute="width" constant="188" id="mcl-Uv-Y6n"/>
<font key="font" metaFont="system"/> </constraints>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="GFW List URL:" id="dg0-gS-z5V">
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="pR1-Bo-AWz" name="value" keyPath="values.PacServer.ListenAddress" id="MkH-lr-4Q7"/>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="agk-yO-9kp">
<rect key="frame" x="73" y="268" width="158" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Local PAC listen Address:" id="tIW-Xu-BJd">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -217,51 +191,57 @@
</textField> </textField>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="xWv-tc-lQe" firstAttribute="baseline" secondItem="Q2L-Fh-TW1" secondAttribute="baseline" id="0ub-69-rbe"/> <constraint firstItem="wCp-nB-dda" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="1TH-Y5-EN7"/>
<constraint firstAttribute="bottom" secondItem="6MD-Ry-R5P" secondAttribute="bottom" constant="20" symbolic="YES" id="1VT-Fs-nNp"/> <constraint firstItem="Q2L-Fh-TW1" firstAttribute="leading" secondItem="xWv-tc-lQe" secondAttribute="trailing" constant="8" symbolic="YES" id="3JQ-t1-YfQ"/>
<constraint firstItem="S5h-Xx-HUG" firstAttribute="leading" secondItem="e3S-m6-k5Y" secondAttribute="leading" id="1Y0-Oh-Ev4"/> <constraint firstItem="FoE-i9-Rfb" firstAttribute="trailing" secondItem="sRP-xs-alR" secondAttribute="trailing" id="5DW-3A-T38"/>
<constraint firstItem="wCp-nB-dda" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="4af-lJ-vAL"/> <constraint firstAttribute="trailing" secondItem="DiD-K0-Y43" secondAttribute="trailing" constant="28" id="5Ss-aV-lwl"/>
<constraint firstItem="xWv-tc-lQe" firstAttribute="leading" secondItem="S5h-Xx-HUG" secondAttribute="leading" id="7E0-aW-12T"/> <constraint firstAttribute="trailing" secondItem="wCp-nB-dda" secondAttribute="trailing" constant="25" id="8Sj-oS-ug5"/>
<constraint firstItem="6MD-Ry-R5P" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="49" id="8CU-pQ-jDz"/> <constraint firstItem="ayu-Tb-kmf" firstAttribute="centerX" secondItem="6MD-Ry-R5P" secondAttribute="centerX" id="9JX-AU-p9u"/>
<constraint firstItem="xWv-tc-lQe" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="29" id="8oq-65-XGK"/> <constraint firstItem="sRP-xs-alR" firstAttribute="leading" secondItem="e3S-m6-k5Y" secondAttribute="trailing" constant="8" symbolic="YES" id="9Ln-JB-XKl"/>
<constraint firstItem="eoD-7r-Q85" firstAttribute="leading" secondItem="sRP-xs-alR" secondAttribute="trailing" constant="8" symbolic="YES" id="GhL-we-2co"/> <constraint firstItem="Q2L-Fh-TW1" firstAttribute="trailing" secondItem="eoD-7r-Q85" secondAttribute="trailing" id="Ddi-cI-3P7"/>
<constraint firstItem="sRP-xs-alR" firstAttribute="leading" secondItem="DiD-K0-Y43" secondAttribute="leading" id="H7k-Nh-YHo"/> <constraint firstItem="Wsf-gl-dkY" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="92" id="Drm-DE-zR4"/>
<constraint firstAttribute="trailing" secondItem="DiD-K0-Y43" secondAttribute="trailing" constant="28" id="H8a-Jg-72h"/> <constraint firstItem="DiD-K0-Y43" firstAttribute="leading" secondItem="qVQ-tJ-cO6" secondAttribute="leading" id="FEU-T2-r8S"/>
<constraint firstItem="XQ5-fw-o8t" firstAttribute="leading" secondItem="sRP-xs-alR" secondAttribute="leading" id="Ij2-mo-WRt"/> <constraint firstItem="xWv-tc-lQe" firstAttribute="leading" secondItem="S5h-Xx-HUG" secondAttribute="leading" id="HDG-YV-pnR"/>
<constraint firstItem="DiD-K0-Y43" firstAttribute="leading" secondItem="qVQ-tJ-cO6" secondAttribute="leading" id="J5O-DE-8O9"/> <constraint firstItem="I4a-N9-Tkv" firstAttribute="top" secondItem="ayu-Tb-kmf" secondAttribute="bottom" constant="8" symbolic="YES" id="IFN-Y7-dx7"/>
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="top" secondItem="JBW-8M-eHP" secondAttribute="bottom" constant="8" symbolic="YES" id="Jkq-uJ-Wv4"/> <constraint firstItem="FoE-i9-Rfb" firstAttribute="top" secondItem="XQ5-fw-o8t" secondAttribute="bottom" constant="10" symbolic="YES" id="Kmf-cm-gih"/>
<constraint firstAttribute="trailing" secondItem="wCp-nB-dda" secondAttribute="trailing" constant="25" id="Mod-B8-1Yl"/> <constraint firstAttribute="trailing" secondItem="ayu-Tb-kmf" secondAttribute="trailing" constant="34" id="LVk-Xo-yXp"/>
<constraint firstItem="wCp-nB-dda" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" symbolic="YES" id="R3i-gt-6zg"/> <constraint firstItem="sRP-xs-alR" firstAttribute="centerY" secondItem="eoD-7r-Q85" secondAttribute="centerY" id="Li6-iE-6AU"/>
<constraint firstItem="DiD-K0-Y43" firstAttribute="trailing" secondItem="qVQ-tJ-cO6" secondAttribute="trailing" id="WaY-S9-VQ2"/> <constraint firstItem="6MD-Ry-R5P" firstAttribute="top" secondItem="I4a-N9-Tkv" secondAttribute="bottom" constant="8" symbolic="YES" id="M7l-Nl-fbE"/>
<constraint firstItem="I4a-N9-Tkv" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="50" id="Wd9-qu-Mx8"/> <constraint firstItem="sRP-xs-alR" firstAttribute="top" secondItem="FoE-i9-Rfb" secondAttribute="bottom" constant="10" symbolic="YES" id="Nf3-lQ-J7p"/>
<constraint firstItem="e3S-m6-k5Y" firstAttribute="top" secondItem="sRP-xs-alR" secondAttribute="top" id="Xmc-dV-VXv"/> <constraint firstItem="FoE-i9-Rfb" firstAttribute="leading" secondItem="Wsf-gl-dkY" secondAttribute="trailing" constant="8" symbolic="YES" id="Q1J-Od-oEq"/>
<constraint firstItem="JBW-8M-eHP" firstAttribute="top" secondItem="wCp-nB-dda" secondAttribute="bottom" constant="8" symbolic="YES" id="Ysd-52-5Fn"/> <constraint firstItem="S5h-Xx-HUG" firstAttribute="leading" secondItem="e3S-m6-k5Y" secondAttribute="leading" id="Rp8-TE-LBs"/>
<constraint firstAttribute="trailing" secondItem="Q2L-Fh-TW1" secondAttribute="trailing" constant="83" id="ZoL-73-xKa"/> <constraint firstItem="wCp-nB-dda" firstAttribute="centerX" secondItem="JBW-8M-eHP" secondAttribute="centerX" id="Uf5-d8-VAG"/>
<constraint firstItem="sRP-xs-alR" firstAttribute="leading" secondItem="e3S-m6-k5Y" secondAttribute="trailing" constant="8" symbolic="YES" id="ZvN-ZN-EVZ"/> <constraint firstItem="ayu-Tb-kmf" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="41" id="Ujd-dM-d4B"/>
<constraint firstItem="sRP-xs-alR" firstAttribute="baseline" secondItem="eoD-7r-Q85" secondAttribute="baseline" id="aXC-g0-ZpB"/> <constraint firstItem="qVQ-tJ-cO6" firstAttribute="top" secondItem="DiD-K0-Y43" secondAttribute="bottom" constant="6" symbolic="YES" id="WUJ-KS-sHp"/>
<constraint firstItem="qVQ-tJ-cO6" firstAttribute="top" secondItem="DiD-K0-Y43" secondAttribute="bottom" constant="12" id="ccj-Fd-7z7"/> <constraint firstItem="xWv-tc-lQe" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="29" id="WsH-Rq-EQo"/>
<constraint firstItem="6MD-Ry-R5P" firstAttribute="top" secondItem="I4a-N9-Tkv" secondAttribute="bottom" constant="8" symbolic="YES" id="dPZ-gY-1am"/> <constraint firstItem="I4a-N9-Tkv" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="54" id="Y5c-vH-Bvw"/>
<constraint firstItem="JBW-8M-eHP" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="36" id="dSL-lu-CVv"/> <constraint firstItem="XQ5-fw-o8t" firstAttribute="top" secondItem="Q2L-Fh-TW1" secondAttribute="bottom" constant="10" symbolic="YES" id="YJa-4z-USU"/>
<constraint firstItem="XQ5-fw-o8t" firstAttribute="top" secondItem="Q2L-Fh-TW1" secondAttribute="bottom" constant="15" id="e6i-xd-BD3"/> <constraint firstItem="e3S-m6-k5Y" firstAttribute="baseline" secondItem="eoD-7r-Q85" secondAttribute="baseline" id="Yfx-Hf-red"/>
<constraint firstItem="ayu-Tb-kmf" firstAttribute="centerX" secondItem="se5-gp-TjO" secondAttribute="centerX" id="edi-Ij-cuc"/> <constraint firstItem="XQ5-fw-o8t" firstAttribute="leading" secondItem="S5h-Xx-HUG" secondAttribute="trailing" constant="8" symbolic="YES" id="ZSX-Wf-s3b"/>
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="leading" secondItem="XQ5-fw-o8t" secondAttribute="leading" id="g40-g1-s29"/> <constraint firstItem="sRP-xs-alR" firstAttribute="leading" secondItem="DiD-K0-Y43" secondAttribute="leading" id="cP0-4c-2tD"/>
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="trailing" secondItem="eoD-7r-Q85" secondAttribute="trailing" id="g4n-5J-iDi"/> <constraint firstItem="xWv-tc-lQe" firstAttribute="baseline" secondItem="Q2L-Fh-TW1" secondAttribute="baseline" id="cjH-5Y-BPd"/>
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="leading" secondItem="xWv-tc-lQe" secondAttribute="trailing" constant="8" symbolic="YES" id="hoH-Lm-ihP"/> <constraint firstItem="I4a-N9-Tkv" firstAttribute="leading" secondItem="6MD-Ry-R5P" secondAttribute="leading" id="fGN-nB-Tp7"/>
<constraint firstItem="XQ5-fw-o8t" firstAttribute="leading" secondItem="S5h-Xx-HUG" secondAttribute="trailing" constant="8" symbolic="YES" id="ibP-Bc-Xhg"/> <constraint firstItem="Q2L-Fh-TW1" firstAttribute="top" secondItem="JBW-8M-eHP" secondAttribute="bottom" constant="8" symbolic="YES" id="fIf-uU-Dis"/>
<constraint firstItem="ayu-Tb-kmf" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="38" id="kkG-sj-u3Y"/> <constraint firstItem="Wsf-gl-dkY" firstAttribute="centerY" secondItem="FoE-i9-Rfb" secondAttribute="centerY" id="fSm-ZO-WGT"/>
<constraint firstItem="ayu-Tb-kmf" firstAttribute="top" secondItem="qVQ-tJ-cO6" secondAttribute="bottom" constant="8" symbolic="YES" id="lza-Z7-YaI"/> <constraint firstItem="DiD-K0-Y43" firstAttribute="trailing" secondItem="qVQ-tJ-cO6" secondAttribute="trailing" id="i1K-yN-yvs"/>
<constraint firstItem="XQ5-fw-o8t" firstAttribute="trailing" secondItem="sRP-xs-alR" secondAttribute="trailing" id="pfd-Yd-goI"/> <constraint firstItem="S5h-Xx-HUG" firstAttribute="centerY" secondItem="XQ5-fw-o8t" secondAttribute="centerY" id="iv1-8j-dpK"/>
<constraint firstItem="JBW-8M-eHP" firstAttribute="centerX" secondItem="6MD-Ry-R5P" secondAttribute="centerX" id="qbH-5m-epu"/> <constraint firstItem="Q2L-Fh-TW1" firstAttribute="leading" secondItem="XQ5-fw-o8t" secondAttribute="leading" id="m95-qm-v0W"/>
<constraint firstItem="I4a-N9-Tkv" firstAttribute="top" secondItem="ayu-Tb-kmf" secondAttribute="bottom" constant="8" symbolic="YES" id="u7y-6r-Vj5"/> <constraint firstItem="XQ5-fw-o8t" firstAttribute="leading" secondItem="FoE-i9-Rfb" secondAttribute="leading" id="q1D-Uw-c6k"/>
<constraint firstItem="DiD-K0-Y43" firstAttribute="top" secondItem="sRP-xs-alR" secondAttribute="bottom" constant="14" id="xlZ-UD-qns"/> <constraint firstItem="JBW-8M-eHP" firstAttribute="top" secondItem="wCp-nB-dda" secondAttribute="bottom" constant="8" symbolic="YES" id="r2h-9S-EeW"/>
<constraint firstItem="S5h-Xx-HUG" firstAttribute="baseline" secondItem="XQ5-fw-o8t" secondAttribute="baseline" id="y3b-k3-eBU"/> <constraint firstItem="JBW-8M-eHP" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="36" id="si5-nv-pTq"/>
<constraint firstItem="wCp-nB-dda" firstAttribute="centerX" secondItem="6MD-Ry-R5P" secondAttribute="centerX" id="yNP-ab-DmI"/> <constraint firstItem="DiD-K0-Y43" firstAttribute="top" secondItem="sRP-xs-alR" secondAttribute="bottom" constant="8" symbolic="YES" id="vty-s2-Oei"/>
<constraint firstItem="FoE-i9-Rfb" firstAttribute="leading" secondItem="sRP-xs-alR" secondAttribute="leading" id="xbo-Fv-kdo"/>
<constraint firstItem="wCp-nB-dda" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" symbolic="YES" id="xxa-Zo-EGP"/>
<constraint firstItem="XQ5-fw-o8t" firstAttribute="trailing" secondItem="FoE-i9-Rfb" secondAttribute="trailing" id="yOU-d6-kg2"/>
<constraint firstAttribute="trailing" secondItem="Q2L-Fh-TW1" secondAttribute="trailing" constant="83" id="yly-wy-CHR"/>
<constraint firstItem="eoD-7r-Q85" firstAttribute="leading" secondItem="sRP-xs-alR" secondAttribute="trailing" constant="8" symbolic="YES" id="ywe-Ph-kz3"/>
<constraint firstItem="ayu-Tb-kmf" firstAttribute="top" secondItem="qVQ-tJ-cO6" secondAttribute="bottom" constant="8" symbolic="YES" id="zH1-MR-VHw"/>
</constraints> </constraints>
</view> </view>
<connections> <connections>
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/> <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
</connections> </connections>
<point key="canvasLocation" x="346" y="328"/> <point key="canvasLocation" x="346" y="292.5"/>
</window> </window>
<numberFormatter formatterBehavior="default10_4" usesGroupingSeparator="NO" groupingSize="0" minimumIntegerDigits="0" maximumIntegerDigits="42" id="uE9-0u-CJW" userLabel="Port Number Formatter"> <numberFormatter formatterBehavior="default10_4" usesGroupingSeparator="NO" groupingSize="0" minimumIntegerDigits="0" maximumIntegerDigits="42" id="uE9-0u-CJW" userLabel="Port Number Formatter">
<real key="minimum" value="128"/> <real key="minimum" value="128"/>
@@ -11,7 +11,7 @@
<window title="HTTP Proxy Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" frameAutosaveName="" animationBehavior="default" id="vS3-DL-Nq3"> <window title="HTTP Proxy Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" frameAutosaveName="" animationBehavior="default" id="vS3-DL-Nq3">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="109" y="131" width="209" height="197"/> <rect key="contentRect" x="109" y="131" width="209" height="197"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/> <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
<view key="contentView" id="Qef-Mj-9z1"> <view key="contentView" id="Qef-Mj-9z1">
<rect key="frame" x="0.0" y="0.0" width="209" height="197"/> <rect key="frame" x="0.0" y="0.0" width="209" height="197"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
@@ -60,7 +60,11 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
<connections> <connections>
<binding destination="Adn-6l-wm4" name="value" keyPath="values.LocalHTTP.ListenAddress" id="YV3-cX-xGk"/> <binding destination="Adn-6l-wm4" name="value" keyPath="values.LocalHTTP.ListenAddress" id="TLb-4n-tsg">
<dictionary key="options">
<bool key="NSContinuouslyUpdatesValue" value="YES"/>
</dictionary>
</binding>
</connections> </connections>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lD1-xm-Qy3"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lD1-xm-Qy3">
@@ -71,7 +75,11 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
<connections> <connections>
<binding destination="Adn-6l-wm4" name="value" keyPath="values.LocalHTTP.ListenPort" id="URg-d3-2U6"/> <binding destination="Adn-6l-wm4" name="value" keyPath="values.LocalHTTP.ListenPort" id="bVc-jE-7Ve">
<dictionary key="options">
<bool key="NSContinuouslyUpdatesValue" value="YES"/>
</dictionary>
</binding>
<outlet property="formatter" destination="ji3-e7-HNW" id="xWV-vJ-7eq"/> <outlet property="formatter" destination="ji3-e7-HNW" id="xWV-vJ-7eq"/>
</connections> </connections>
</textField> </textField>
+4 -4
View File
@@ -79,13 +79,13 @@
</connections> </connections>
</menuItem> </menuItem>
<menuItem isSeparatorItem="YES" id="bMX-qn-Qwi"/> <menuItem isSeparatorItem="YES" id="bMX-qn-Qwi"/>
<menuItem title="Show Running Mode On Status Bar" id="CCV-hX-fVA"> <menuItem title="Show Running Mode In Status Bar" id="CCV-hX-fVA">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
<connections> <connections>
<action selector="showRunningMode:" target="Voe-Tx-rLC" id="PxO-ut-PEx"/> <action selector="showRunningMode:" target="Voe-Tx-rLC" id="PxO-ut-PEx"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem title="Advance Proxy Preference..." id="sbx-yz-3lO"> <menuItem title="Advanced Proxy Preferences..." id="sbx-yz-3lO">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
<connections> <connections>
<action selector="editProxyPreferences:" target="Voe-Tx-rLC" id="Jji-Ea-Sy8"/> <action selector="editProxyPreferences:" target="Voe-Tx-rLC" id="Jji-Ea-Sy8"/>
@@ -120,13 +120,13 @@
</items> </items>
</menu> </menu>
</menuItem> </menuItem>
<menuItem title="Advance Preference ..." id="bZ3-fy-34d"> <menuItem title="Advanced Preferences ..." id="bZ3-fy-34d">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
<connections> <connections>
<action selector="editAdvPreferences:" target="Voe-Tx-rLC" id="mEF-XS-HJE"/> <action selector="editAdvPreferences:" target="Voe-Tx-rLC" id="mEF-XS-HJE"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem title="HTTP Proxy Preference ..." id="uEp-Gz-cu0"> <menuItem title="HTTP Proxy Preferences ..." id="uEp-Gz-cu0">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
<connections> <connections>
<action selector="editHTTPPreferences:" target="Voe-Tx-rLC" id="tkC-e3-PH9"/> <action selector="editHTTPPreferences:" target="Voe-Tx-rLC" id="tkC-e3-PH9"/>
@@ -13,7 +13,7 @@
</customObject> </customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Advance Proxy Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5"> <window title="Advanced Proxy Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="503" y="308" width="298" height="311"/> <rect key="contentRect" x="503" y="308" width="298" height="311"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/> <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
@@ -58,7 +58,7 @@ Gw
<rect key="frame" x="1" y="1" width="423" height="187"/> <rect key="frame" x="1" y="1" width="423" height="187"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textView ambiguous="YES" importsGraphics="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="4yV-hS-knY"> <textView ambiguous="YES" importsGraphics="NO" richText="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="4yV-hS-knY">
<rect key="frame" x="0.0" y="0.0" width="423" height="187"/> <rect key="frame" x="0.0" y="0.0" width="423" height="187"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+1 -1
View File
@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.3</string> <string>1.3.2</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
+3 -5
View File
@@ -14,14 +14,12 @@
+ (void)install; + (void)install;
+ (void)enablePACProxy:(NSString*) PACFilePath; + (void)enablePACProxy;
+ (void)enableGlobalProxy; + (void)enableGlobalProxy;
+ (void)disableProxy:(NSString*) PACFilePath; + (void)disableProxy;
+ (NSString*)startPACServer:(NSString*) PACFilePath; + (void)startMonitorPAC;
+ (void)stopPACServer;
@end @end
+90 -32
View File
@@ -14,6 +14,7 @@
@implementation ProxyConfHelper @implementation ProxyConfHelper
GCDWebServer *webServer =nil; GCDWebServer *webServer =nil;
FSEventStreamRef fsEventStream;
+ (BOOL)isVersionOk { + (BOOL)isVersionOk {
NSTask *task; NSTask *task;
@@ -114,14 +115,18 @@ GCDWebServer *webServer =nil;
} }
} }
+ (void)enablePACProxy:(NSString*) PACFilePath { + (NSString*)getPACFilePath {
return [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @".ShadowsocksX-NG/gfwlist.js"];
}
+ (void)enablePACProxy {
//start server here and then using the string next line //start server here and then using the string next line
//next two lines can open gcdwebserver and work around pac file //next two lines can open gcdwebserver and work around pac file
NSString *PACURLString = [self startPACServer: PACFilePath];//hi 可以切换成定制pac文件路径来达成使用定制文件路径 NSString* PACFilePath = [self getPACFilePath];
NSURL* url = [NSURL URLWithString: PACURLString]; [self startPACServer: PACFilePath];
// NSString* urlString = [NSString stringWithFormat:@"%@/.ShadowsocksX-NG/gfwlist.js", NSHomeDirectory()];
// NSURL* url = [NSURL fileURLWithPath:urlString]; NSURL* url = [NSURL URLWithString: [self getHttpPACUrl]];
NSMutableArray* args = [@[@"--mode", @"auto", @"--pac-url", [url absoluteString]]mutableCopy]; NSMutableArray* args = [@[@"--mode", @"auto", @"--pac-url", [url absoluteString]]mutableCopy];
[self addArguments4ManualSpecifyNetworkServices:args]; [self addArguments4ManualSpecifyNetworkServices:args];
@@ -134,24 +139,23 @@ GCDWebServer *webServer =nil;
NSMutableArray* args = [@[@"--mode", @"global", @"--port" NSMutableArray* args = [@[@"--mode", @"global", @"--port"
, [NSString stringWithFormat:@"%lu", (unsigned long)port]]mutableCopy]; , [NSString stringWithFormat:@"%lu", (unsigned long)port]]mutableCopy];
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTPOn"] && [[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTP.FollowGlobel"]) { // Because issue #106 https://github.com/shadowsocks/ShadowsocksX-NG/issues/106
NSUInteger privoxyPort = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalHTTP.ListenPort"]; // Comment below out.
// if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTPOn"] && [[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTP.FollowGlobel"]) {
[args addObject:@"--privoxy-port"]; // NSUInteger privoxyPort = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalHTTP.ListenPort"];
[args addObject:[NSString stringWithFormat:@"%lu", (unsigned long)privoxyPort]]; //
} // [args addObject:@"--privoxy-port"];
// [args addObject:[NSString stringWithFormat:@"%lu", (unsigned long)privoxyPort]];
// }
[self addArguments4ManualSpecifyNetworkServices:args]; [self addArguments4ManualSpecifyNetworkServices:args];
[self callHelper:args]; [self callHelper:args];
[self stopPACServer]; [self stopPACServer];
} }
+ (void)disableProxy:(NSString*) PACFilePath { + (void)disableProxy {
// 带上所有参数是为了判断是否原有代理设置是否由ssx-ng设置的。如果是用户手工设置的其他配置,则不进行清空。 // 带上所有参数是为了判断是否原有代理设置是否由ssx-ng设置的。如果是用户手工设置的其他配置,则不进行清空。
// NSString* urlString = [NSString stringWithFormat:@"%@/.ShadowsocksX-NG/gfwlist.js", NSHomeDirectory()]; NSURL* url = [NSURL URLWithString: [self getHttpPACUrl]];
// NSURL* url = [NSURL fileURLWithPath:urlString];
NSString *PACURLString = [self startPACServer: PACFilePath];//hi 可以切换成定制pac文件路径来达成使用定制文件路径
NSURL* url = [NSURL URLWithString: PACURLString];
NSUInteger port = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalSocks5.ListenPort"]; NSUInteger port = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalSocks5.ListenPort"];
NSMutableArray* args = [@[@"--mode", @"off" NSMutableArray* args = [@[@"--mode", @"off"
@@ -163,28 +167,41 @@ GCDWebServer *webServer =nil;
[self stopPACServer]; [self stopPACServer];
} }
+ (NSString*)startPACServer:(NSString*) PACFilePath { + (NSString*)getHttpPACUrl {
//接受参数为以后使用定制PAC文件
NSData * originalPACData;
NSString * routerPath = @"/proxy.pac"; NSString * routerPath = @"/proxy.pac";
if ([PACFilePath isEqual: @"hi"]) {//用默认路径来代替
PACFilePath = [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @".ShadowsocksX-NG/gfwlist.js"]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
originalPACData = [NSData dataWithContentsOfFile: [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @".ShadowsocksX-NG/gfwlist.js"]];
}else{//用定制路径来代替 NSString * address = @"127.0.0.1";
originalPACData = [NSData dataWithContentsOfFile: [NSString stringWithFormat:@"%@/%@/%@", NSHomeDirectory(), @".ShadowsocksX-NG", PACFilePath]]; int port = (short)[defaults integerForKey:@"PacServer.ListenPort"];
routerPath = [NSString stringWithFormat:@"/%@",PACFilePath];
} return [NSString stringWithFormat:@"%@%@:%d%@",@"http://",address,port,routerPath];
}
+ (void)startPACServer:(NSString*) PACFilePath {
[self stopPACServer]; [self stopPACServer];
NSString * routerPath = @"/proxy.pac";
NSData* originalPACData = [NSData dataWithContentsOfFile:PACFilePath];
webServer = [[GCDWebServer alloc] init]; webServer = [[GCDWebServer alloc] init];
[webServer addHandlerForMethod:@"GET" path:routerPath requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest *request) { [webServer addHandlerForMethod:@"GET"
return [GCDWebServerDataResponse responseWithData: originalPACData contentType:@"application/x-ns-proxy-autoconfig"]; path:routerPath
requestClass:[GCDWebServerRequest class]
processBlock:^GCDWebServerResponse *(GCDWebServerRequest *request)
{
GCDWebServerDataResponse* resp = [GCDWebServerDataResponse responseWithData:originalPACData
contentType:@"application/x-ns-proxy-autoconfig"];
return resp;
} }
]; ];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString * address = [defaults stringForKey:@"PacServer.ListenAddress"];
int port = (short)[defaults integerForKey:@"PacServer.ListenPort"]; int port = (short)[defaults integerForKey:@"PacServer.ListenPort"];
[webServer startWithOptions:@{@"BindToLocalhost":@YES, @"Port":@(port)} error:nil]; [webServer startWithOptions:@{@"BindToLocalhost":@YES, @"Port":@(port)} error:nil];
return [NSString stringWithFormat:@"%@%@:%d%@",@"http://",address,port,routerPath];
} }
+ (void)stopPACServer { + (void)stopPACServer {
@@ -194,4 +211,45 @@ GCDWebServer *webServer =nil;
} }
} }
void onPACChange(
ConstFSEventStreamRef streamRef,
void *clientCallBackInfo,
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[])
{
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
if ([defaults boolForKey:@"ShadowsocksOn"]) {
if ([[defaults stringForKey:@"ShadowsocksRunningMode"] isEqualToString:@"auto"]) {
[ProxyConfHelper disableProxy];
[ProxyConfHelper enablePACProxy];
}
}
}
+ (void)startMonitorPAC {
NSString* PACFilePath = [self getPACFilePath];
if (fsEventStream) {
return;
}
CFStringRef mypath = (__bridge CFStringRef)(PACFilePath);
CFArrayRef pathsToWatch = CFArrayCreate(NULL, (const void **)&mypath, 1, NULL);
void *callbackInfo = NULL; // could put stream-specific data here.
CFAbsoluteTime latency = 3.0; /* Latency in seconds */
/* Create the stream, passing in a callback */
fsEventStream = FSEventStreamCreate(NULL,
&onPACChange,
callbackInfo,
pathsToWatch,
kFSEventStreamEventIdSinceNow, /* Or a previous event ID */
latency,
kFSEventStreamCreateFlagNone /* Flags explained in reference */
);
FSEventStreamScheduleWithRunLoop(fsEventStream, [[NSRunLoop mainRunLoop] getCFRunLoop], (__bridge CFStringRef)NSDefaultRunLoopMode);
FSEventStreamStart(fsEventStream);
}
@end @end
@@ -37,7 +37,7 @@ class ProxyPreferencesController: NSWindowController, NSTableViewDataSource, NST
} }
@IBAction func ok(_ sender: NSObject){ @IBAction func ok(_ sender: NSObject){
ProxyConfHelper.disableProxy("hi") ProxyConfHelper.disableProxy()
let defaults = UserDefaults.standard let defaults = UserDefaults.standard
defaults.setValue(selectedNetworkServices.allObjects, forKeyPath: "Proxy4NetworkServices") defaults.setValue(selectedNetworkServices.allObjects, forKeyPath: "Proxy4NetworkServices")
+2 -2
View File
@@ -9,9 +9,9 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h> #import <WebKit/WebKit.h>
@interface SWBQRCodeWindowController : NSWindowController <WebFrameLoadDelegate> @interface SWBQRCodeWindowController : NSWindowController
@property (nonatomic, strong) IBOutlet WebView *webView;
@property (nonatomic, copy) NSString *qrCode; @property (nonatomic, copy) NSString *qrCode;
@property (nonatomic, weak) NSImageView *imageView;
@end @end
+47 -8
View File
@@ -7,6 +7,7 @@
// //
#import "SWBQRCodeWindowController.h" #import "SWBQRCodeWindowController.h"
@import CoreImage;
@interface SWBQRCodeWindowController () @interface SWBQRCodeWindowController ()
@@ -18,18 +19,56 @@
[super windowDidLoad]; [super windowDidLoad];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
[self.webView.mainFrame loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"qrcode" withExtension:@"htm"]]]; [self setQRCode:self.qrCode];
self.webView.frameLoadDelegate = self;
} }
-(void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { - (void)setQRCode:(NSString*) qrCode {
if (self.qrCode) { CGImageRef cgImgRef = [self createQRImageForString:qrCode size:CGSizeMake(250, 250)];
[self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"genCode('%@')", _qrCode]];
} NSImage *image = [[NSImage alloc]initWithCGImage:cgImgRef size:CGSizeMake(250, 250)];
self.imageView.image = image;
} }
-(void)dealloc { - (CGImageRef)createQRImageForString:(NSString *)string size:(CGSize)size {
self.webView.frameLoadDelegate = nil; // Setup the QR filter with our string
CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
[filter setDefaults];
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
[filter setValue:data forKey:@"inputMessage"];
CIImage *image = [filter valueForKey:@"outputImage"];
// Calculate the size of the generated image and the scale for the desired image size
CGRect extent = CGRectIntegral(image.extent);
CGFloat scale = MIN(size.width / CGRectGetWidth(extent), size.height / CGRectGetHeight(extent));
// Since CoreImage nicely interpolates, we need to create a bitmap image that we'll draw into
// a bitmap context at the desired size;
size_t width = CGRectGetWidth(extent) * scale;
size_t height = CGRectGetHeight(extent) * scale;
CGColorSpaceRef cs = CGColorSpaceCreateDeviceGray();
CGContextRef bitmapRef = CGBitmapContextCreate(nil, width, height, 8, 0, cs, (CGBitmapInfo)kCGImageAlphaNone);
#if TARGET_OS_IPHONE
CIContext *context = [CIContext contextWithOptions:nil];
#else
CIContext *context = [CIContext contextWithCGContext:bitmapRef options:nil];
#endif
CGImageRef bitmapImage = [context createCGImage:image fromRect:extent];
CGContextSetInterpolationQuality(bitmapRef, kCGInterpolationNone);
CGContextScaleCTM(bitmapRef, scale, scale);
CGContextDrawImage(bitmapRef, extent, bitmapImage);
// Create an image with the contents of our bitmap
CGImageRef scaledImage = CGBitmapContextCreateImage(bitmapRef);
// Cleanup
CGContextRelease(bitmapRef);
CGImageRelease(bitmapImage);
return scaledImage;
} }
@end @end
+10 -17
View File
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="10117"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
</dependencies> </dependencies>
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="SWBQRCodeWindowController"> <customObject id="-2" userLabel="File's Owner" customClass="SWBQRCodeWindowController">
<connections> <connections>
<outlet property="webView" destination="ojI-LR-jEw" id="bpE-vv-uIe"/> <outlet property="imageView" destination="yRy-QH-TEe" id="aa5-Ri-k04"/>
<outlet property="window" destination="QvC-M9-y7g" id="HLy-eJ-5RD"/> <outlet property="window" destination="QvC-M9-y7g" id="HLy-eJ-5RD"/>
</connections> </connections>
</customObject> </customObject>
@@ -16,24 +16,17 @@
<window title="QR Code" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" animationBehavior="default" id="QvC-M9-y7g"> <window title="QR Code" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<rect key="contentRect" x="566" y="456" width="250" height="250"/> <rect key="contentRect" x="566" y="456" width="250" height="250"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/> <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" id="EiT-Mj-1SZ"> <view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="250" height="250"/> <rect key="frame" x="0.0" y="0.0" width="250" height="250"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<webView translatesAutoresizingMaskIntoConstraints="NO" id="ojI-LR-jEw"> <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yRy-QH-TEe">
<rect key="frame" x="0.0" y="0.0" width="250" height="250"/> <rect key="frame" x="0.0" y="0.0" width="250" height="250"/>
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12"> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<nil key="identifier"/> <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="iAJ-tw-LNU"/>
</webPreferences> </imageView>
</webView>
</subviews> </subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="ojI-LR-jEw" secondAttribute="trailing" id="ImJ-r1-FF9"/>
<constraint firstAttribute="bottom" secondItem="ojI-LR-jEw" secondAttribute="bottom" id="LQv-2G-kyf"/>
<constraint firstItem="ojI-LR-jEw" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="kok-J1-X08"/>
<constraint firstItem="ojI-LR-jEw" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="voV-aN-Ggt"/>
</constraints>
</view> </view>
</window> </window>
</objects> </objects>
-2
View File
File diff suppressed because one or more lines are too long
-28
View File
@@ -1,28 +0,0 @@
<!doctype html>
<script src="jquery.min.js">
</script>
<script src="qrcode.min.js">
</script>
<style>
body {
padding: 10px;
margin: 0;
}
#qrcode {
width:230px;
height:230px;
}
</style>
<div id="qrcode"></div>
<script type="text/javascript">
function genCode(code) {
new QRCode("qrcode", {
text: code,
width: 230,
height: 230,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
}
</script>
-1
View File
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
/* Class = "NSWindow"; title = "Advance Proxy Preferences"; ObjectID = "F0z-JX-Cv5"; */ /* Class = "NSWindow"; title = "Advanced Proxy Preferences"; ObjectID = "F0z-JX-Cv5"; */
"F0z-JX-Cv5.title" = "高级代理设置"; "F0z-JX-Cv5.title" = "高级代理设置";
/* Class = "NSButtonCell"; title = "Auto Configure"; ObjectID = "FLv-D9-CRw"; */ /* Class = "NSButtonCell"; title = "Auto Configure"; ObjectID = "FLv-D9-CRw"; */