Merge branch 'release/1.1'

This commit is contained in:
Charlie Qiu
2016-07-06 19:50:34 +08:00
38 changed files with 583 additions and 96 deletions

View File

@ -1,6 +1,6 @@
# ShadowsocksX-NG
Current version is 1.0 Beta
Current version is 1.1
[![Build Status](https://travis-ci.org/qiuyuzhou/ShadowsocksX-NG.svg?branch=develop)](https://travis-ci.org/qiuyuzhou/ShadowsocksX-NG)

View File

@ -17,6 +17,7 @@
9B0BFFEB1D0460A70040E62B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9B0BFFEA1D0460A70040E62B /* Assets.xcassets */; };
9B0BFFEE1D0460A70040E62B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B0BFFEC1D0460A70040E62B /* MainMenu.xib */; };
9B0BFFF91D0460A70040E62B /* ShadowsocksX_NGTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B0BFFF81D0460A70040E62B /* ShadowsocksX_NGTests.swift */; };
9B0D55461D2CC85400A4A8E2 /* ProxyPreferencesController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B0D55481D2CC85400A4A8E2 /* ProxyPreferencesController.xib */; };
9B172A6A1D0ADDDD00B87B9A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9B172A6C1D0ADDDD00B87B9A /* Localizable.strings */; };
9B2491B41D0ACC3A003BBECC /* PreferencesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B2491B61D0ACC3A003BBECC /* PreferencesWindowController.xib */; };
9B2491B71D0ACC3E003BBECC /* AdvPreferencesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B2491B91D0ACC3E003BBECC /* AdvPreferencesWindowController.xib */; };
@ -38,6 +39,9 @@
9B3FFF4C1D09D8F70019A709 /* install_helper.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF4B1D09D8F70019A709 /* install_helper.sh */; };
9B3FFF4F1D09D9D50019A709 /* ProxyConfHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF4E1D09D9D50019A709 /* ProxyConfHelper.m */; };
9B3FFF541D09E2D10019A709 /* proxy_conf_helper in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF441D09CD3B0019A709 /* proxy_conf_helper */; };
9BA04B231D23D5A5005AAD7F /* ProxyConfTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */; };
9BA04B261D24044D005AAD7F /* ProxyPreferencesController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BA04B241D24044D005AAD7F /* ProxyPreferencesController.swift */; };
9BB706A71D1B982300551F0E /* SWBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BB706A51D1B982300551F0E /* SWBApplication.m */; };
9BE8FBBF1D0B211600CAFD01 /* libcrypto.1.0.0.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9BE8FBBD1D0B1FB900CAFD01 /* libcrypto.1.0.0.dylib */; };
9BEEF0691D04D4D500FC52B3 /* install_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0651D04CB8500FC52B3 /* install_ss_local.sh */; };
9BEEF06A1D04D4D500FC52B3 /* start_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0661D04CE8D00FC52B3 /* start_ss_local.sh */; };
@ -104,13 +108,15 @@
9B0BFFF41D0460A70040E62B /* ShadowsocksX-NGTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ShadowsocksX-NGTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
9B0BFFF81D0460A70040E62B /* ShadowsocksX_NGTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShadowsocksX_NGTests.swift; sourceTree = "<group>"; };
9B0BFFFA1D0460A70040E62B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9B0D55451D2CC1B800A4A8E2 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainMenu.strings"; sourceTree = "<group>"; };
9B0D554A1D2CC85E00A4A8E2 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/ProxyPreferencesController.strings"; sourceTree = "<group>"; };
9B0D554B1D2CC87400A4A8E2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ProxyPreferencesController.xib; sourceTree = "<group>"; };
9B172A5D1D0ACEA100B87B9A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/AdvPreferencesWindowController.strings"; sourceTree = "<group>"; };
9B172A601D0ADA5B00B87B9A /* genstrings.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = genstrings.py; sourceTree = "<group>"; };
9B172A6B1D0ADDDD00B87B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
9B172A6D1D0ADDE800B87B9A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
9B2491B51D0ACC3A003BBECC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreferencesWindowController.xib; sourceTree = "<group>"; };
9B2491B81D0ACC3E003BBECC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AdvPreferencesWindowController.xib; sourceTree = "<group>"; };
9B2491BC1D0ACC49003BBECC /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainMenu.strings"; sourceTree = "<group>"; };
9B3FFF0C1D05FEB30019A709 /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
9B3FFF131D0705810019A709 /* Notifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = "<group>"; };
9B3FFF151D072FDE0019A709 /* LaunchAtLoginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchAtLoginController.h; sourceTree = "<group>"; };
@ -136,6 +142,11 @@
9B3FFF4E1D09D9D50019A709 /* ProxyConfHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProxyConfHelper.m; sourceTree = "<group>"; };
9B3FFF501D09DAEA0019A709 /* proxy_conf_helper_version.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = proxy_conf_helper_version.h; sourceTree = "<group>"; };
9B3FFF511D09DBA20019A709 /* ShadowsocksX-NG-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ShadowsocksX-NG-Bridging-Header.h"; sourceTree = "<group>"; };
9BA04B211D23D5A5005AAD7F /* ProxyConfTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyConfTool.h; sourceTree = "<group>"; };
9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProxyConfTool.m; sourceTree = "<group>"; };
9BA04B241D24044D005AAD7F /* ProxyPreferencesController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProxyPreferencesController.swift; sourceTree = "<group>"; };
9BB706A51D1B982300551F0E /* SWBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWBApplication.m; sourceTree = "<group>"; };
9BB706A61D1B982300551F0E /* SWBApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWBApplication.h; sourceTree = "<group>"; };
9BE8FBBD1D0B1FB900CAFD01 /* libcrypto.1.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libcrypto.1.0.0.dylib; sourceTree = "<group>"; };
9BE8FBC11D0B71CF00CAFD01 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/PreferencesWindowController.strings"; sourceTree = "<group>"; };
9BEEF0651D04CB8500FC52B3 /* install_ss_local.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = install_ss_local.sh; sourceTree = "<group>"; };
@ -247,6 +258,8 @@
9B0BFFE71D0460A70040E62B /* ShadowsocksX-NG */ = {
isa = PBXGroup;
children = (
9BB706A51D1B982300551F0E /* SWBApplication.m */,
9BB706A61D1B982300551F0E /* SWBApplication.h */,
9B3FFF511D09DBA20019A709 /* ShadowsocksX-NG-Bridging-Header.h */,
9B3FFF151D072FDE0019A709 /* LaunchAtLoginController.h */,
9B3FFF161D072FDE0019A709 /* LaunchAtLoginController.m */,
@ -267,6 +280,8 @@
9B3FFF4D1D09D9D50019A709 /* ProxyConfHelper.h */,
9B3FFF4E1D09D9D50019A709 /* ProxyConfHelper.m */,
9B3FFF501D09DAEA0019A709 /* proxy_conf_helper_version.h */,
9BA04B211D23D5A5005AAD7F /* ProxyConfTool.h */,
9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */,
);
path = "ShadowsocksX-NG";
sourceTree = "<group>";
@ -290,6 +305,8 @@
9B2491B61D0ACC3A003BBECC /* PreferencesWindowController.xib */,
9BEEF0791D05631500FC52B3 /* AdvPreferencesWindowController.swift */,
9B2491B91D0ACC3E003BBECC /* AdvPreferencesWindowController.xib */,
9BA04B241D24044D005AAD7F /* ProxyPreferencesController.swift */,
9B0D55481D2CC85400A4A8E2 /* ProxyPreferencesController.xib */,
);
name = UI;
sourceTree = "<group>";
@ -431,6 +448,7 @@
9B3FFF541D09E2D10019A709 /* proxy_conf_helper in Resources */,
9BEEF0691D04D4D500FC52B3 /* install_ss_local.sh in Resources */,
9B172A6A1D0ADDDD00B87B9A /* Localizable.strings in Resources */,
9B0D55461D2CC85400A4A8E2 /* ProxyPreferencesController.xib in Resources */,
9B2491B41D0ACC3A003BBECC /* PreferencesWindowController.xib in Resources */,
9B3FFF291D08A1DF0019A709 /* user-rule.txt in Resources */,
9BEEF06A1D04D4D500FC52B3 /* start_ss_local.sh in Resources */,
@ -593,9 +611,11 @@
files = (
9B3FFF171D072FDE0019A709 /* LaunchAtLoginController.m in Sources */,
9B3FFF4F1D09D9D50019A709 /* ProxyConfHelper.m in Sources */,
9BB706A71D1B982300551F0E /* SWBApplication.m in Sources */,
9B3FFF1E1D0732660019A709 /* Utils.m in Sources */,
9B3FFF321D08CEE40019A709 /* SWBQRCodeWindowController.m in Sources */,
9B3FFF211D08826E0019A709 /* PACUtils.swift in Sources */,
9BA04B261D24044D005AAD7F /* ProxyPreferencesController.swift in Sources */,
9B3FFF141D0705810019A709 /* Notifications.swift in Sources */,
9BEEF0701D04DDB100FC52B3 /* ServerProfileManager.swift in Sources */,
9BEEF07B1D05631500FC52B3 /* AdvPreferencesWindowController.swift in Sources */,
@ -603,6 +623,7 @@
9B3FFF0D1D05FEB30019A709 /* Utils.swift in Sources */,
9BEEF0751D04EF3E00FC52B3 /* PreferencesWindowController.swift in Sources */,
9B0BFFE91D0460A70040E62B /* AppDelegate.swift in Sources */,
9BA04B231D23D5A5005AAD7F /* ProxyConfTool.m in Sources */,
9BEEF0781D04FE8A00FC52B3 /* LaunchAgentUtils.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -643,11 +664,20 @@
isa = PBXVariantGroup;
children = (
9B0BFFED1D0460A70040E62B /* Base */,
9B2491BC1D0ACC49003BBECC /* zh-Hans */,
9B0D55451D2CC1B800A4A8E2 /* zh-Hans */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
9B0D55481D2CC85400A4A8E2 /* ProxyPreferencesController.xib */ = {
isa = PBXVariantGroup;
children = (
9B0D554A1D2CC85E00A4A8E2 /* zh-Hans */,
9B0D554B1D2CC87400A4A8E2 /* Base */,
);
name = ProxyPreferencesController.xib;
sourceTree = "<group>";
};
9B172A6C1D0ADDDD00B87B9A /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (

View File

@ -15,6 +15,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
var qrcodeWinCtrl: SWBQRCodeWindowController!
var preferencesWinCtrl: PreferencesWindowController!
var advPreferencesWinCtrl: AdvPreferencesWindowController!
var proxyPreferencesWinCtrl: ProxyPreferencesController!
var launchAtLoginController: LaunchAtLoginController = LaunchAtLoginController()
@ -52,7 +53,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
"LocalSocks5.Timeout": NSNumber(unsignedInteger: 60),
"LocalSocks5.EnableUDPRelay": NSNumber(bool: false),
"LocalSocks5.EnableVerboseMode": NSNumber(bool: false),
"GFWListURL": "https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt"
"GFWListURL": "https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt",
"AutoConfigureNetworkServices": NSNumber(bool: true)
])
statusItem = NSStatusBar.systemStatusBar().statusItemWithLength(20)
@ -63,6 +65,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
let notifyCenter = NSNotificationCenter.defaultCenter()
notifyCenter.addObserverForName(NOTIFY_ADV_PROXY_CONF_CHANGED, object: nil, queue: nil
, usingBlock: {
(note) in
self.applyConfig()
}
)
notifyCenter.addObserverForName(NOTIFY_SERVER_PROFILES_CHANGED, object: nil, queue: nil
, usingBlock: {
(note) in
@ -81,7 +89,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
if let userInfo = note.userInfo {
let urls: [NSURL] = userInfo["urls"] as! [NSURL]
let mgr = ServerProfileManager()
let mgr = ServerProfileManager.instance
var isChanged = false
for url in urls {
@ -191,8 +199,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
@IBAction func showQRCodeForCurrentServer(sender: NSMenuItem) {
var errMsg: String?
let mgr = ServerProfileManager()
if let profile = mgr.getActiveProfile() {
if let profile = ServerProfileManager.instance.getActiveProfile() {
if profile.isValid() {
// Show window
if qrcodeWinCtrl != nil{
@ -273,9 +280,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
ctrl.window?.makeKeyAndOrderFront(self)
}
@IBAction func editProxyPreferences(sender: NSObject) {
if proxyPreferencesWinCtrl != nil {
proxyPreferencesWinCtrl.close()
}
proxyPreferencesWinCtrl = ProxyPreferencesController(windowNibName: "ProxyPreferencesController")
proxyPreferencesWinCtrl.showWindow(self)
NSApp.activateIgnoringOtherApps(true)
proxyPreferencesWinCtrl.window?.makeKeyAndOrderFront(self)
}
@IBAction func selectServer(sender: NSMenuItem) {
let index = sender.tag
let spMgr = ServerProfileManager()
let spMgr = ServerProfileManager.instance
let newProfile = spMgr.profiles[index]
if newProfile.uuid != spMgr.activeProfileId {
spMgr.setActiveProfiledId(newProfile.uuid)
@ -345,7 +362,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
}
func updateServersMenu() {
let mgr = ServerProfileManager()
let mgr = ServerProfileManager.instance
serversMenuItem.submenu?.removeAllItems()
let preferencesItem = serversPreferencesMenuItem

View File

@ -3,61 +3,61 @@
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "Icon_16x16.png",
"filename" : "icon_16x16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "Icon_16x16@2x.png",
"filename" : "icon_16x16@2x.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "Icon_32x32.png",
"filename" : "icon_32x32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "Icon_32x32@2x.png",
"filename" : "icon_32x32@2x.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "Icon_128x128.png",
"filename" : "icon_128x128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "Icon_128x128@2x.png",
"filename" : "icon_128x128@2x.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "Icon_256x256.png",
"filename" : "icon_256x256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "Icon_256x256@2x.png",
"filename" : "icon_256x256@2x.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "Icon_512x512.png",
"filename" : "icon_512x512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "Icon_512x512@2x.png",
"filename" : "icon_512x512@2x.png",
"scale" : "2x"
}
],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 927 B

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 KiB

After

Width:  |  Height:  |  Size: 195 KiB

View File

@ -14,10 +14,10 @@
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="ShadowsocksX_NG" customModuleProvider="target">
<connections>
<outlet property="RunningStatusMenuItem" destination="fzk-mE-CEV" id="R4x-gK-Qcw"/>
<outlet property="autoModeMenuItem" destination="hOa-5N-3ik" id="en3-ni-jqC"/>
<outlet property="globalModeMenuItem" destination="3Sa-e9-VXX" id="UKI-yu-DEK"/>
<outlet property="autoModeMenuItem" destination="r07-Gu-aEz" id="9aH-pQ-Rgi"/>
<outlet property="globalModeMenuItem" destination="Mw3-Jm-eXA" id="ar5-Yx-3ze"/>
<outlet property="lanchAtLoginMenuItem" destination="eUq-p7-ICK" id="w4p-0c-DZn"/>
<outlet property="manualModeMenuItem" destination="vRc-N6-z1e" id="jp0-vj-pTX"/>
<outlet property="manualModeMenuItem" destination="8PR-gs-c5N" id="9qz-mU-5kt"/>
<outlet property="runningStatusMenuItem" destination="fzk-mE-CEV" id="Vwm-Rg-Ykn"/>
<outlet property="serversMenuItem" destination="u5M-hQ-VSc" id="8gp-SY-Y4U"/>
<outlet property="serversPreferencesMenuItem" destination="M5r-E7-44f" id="voe-SX-k6a"/>
@ -26,7 +26,7 @@
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="ShadowsocksX-NE" id="Hob-KD-bx9">
<menu title="ShadowsocksX-NG" id="Hob-KD-bx9">
<items>
<menuItem title="Showsocks: On" enabled="NO" id="fzk-mE-CEV">
<modifierMask key="keyEquivalentModifierMask"/>
@ -38,23 +38,37 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="LXP-yK-yQu"/>
<menuItem title="Auto Mode By PAC" id="hOa-5N-3ik">
<menuItem title="Proxy" id="diI-fB-Rss">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="selectPACMode:" target="Voe-Tx-rLC" id="OwN-Md-pIC"/>
</connections>
</menuItem>
<menuItem title="Global Mode" id="3Sa-e9-VXX">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="selectGlobalMode:" target="Voe-Tx-rLC" id="l4X-GP-hlH"/>
</connections>
</menuItem>
<menuItem title="Manual Mode" id="vRc-N6-z1e">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="selectManualMode:" target="Voe-Tx-rLC" id="vNk-P9-UQj"/>
</connections>
<menu key="submenu" title="Proxy" id="YZp-bf-L40">
<items>
<menuItem title="Auto Mode By PAC" id="r07-Gu-aEz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="selectPACMode:" target="Voe-Tx-rLC" id="l36-cd-xl7"/>
</connections>
</menuItem>
<menuItem title="Global Mode" id="Mw3-Jm-eXA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="selectGlobalMode:" target="Voe-Tx-rLC" id="7QH-HB-B2e"/>
</connections>
</menuItem>
<menuItem title="Manual Mode" id="8PR-gs-c5N">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="selectManualMode:" target="Voe-Tx-rLC" id="Xxb-28-6fi"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bMX-qn-Qwi"/>
<menuItem title="Advance Proxy Preference..." id="sbx-yz-3lO">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="editProxyPreferences:" target="Voe-Tx-rLC" id="Jji-Ea-Sy8"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="kkf-gh-O8t"/>
<menuItem title="Servers" id="u5M-hQ-VSc">

View File

@ -339,7 +339,7 @@ DQ
<point key="canvasLocation" x="391" y="222"/>
</window>
<numberFormatter formatterBehavior="default10_4" usesGroupingSeparator="NO" groupingSize="0" minimumIntegerDigits="0" maximumIntegerDigits="42" id="QZc-kt-D7Z" userLabel="Port Number Formatter">
<real key="minimum" value="128"/>
<real key="minimum" value="1"/>
<real key="maximum" value="65535"/>
</numberFormatter>
</objects>

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ProxyPreferencesController" customModule="ShadowsocksX_NG" customModuleProvider="target">
<connections>
<outlet property="autoConfigCheckBox" destination="al4-wo-BVS" id="y3x-oN-Wn7"/>
<outlet property="tableView" destination="tdp-Lr-L64" id="yJ0-tP-gVw"/>
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<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">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="503" y="308" width="298" height="311"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="298" height="311"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="al4-wo-BVS">
<rect key="frame" x="18" y="275" width="262" height="18"/>
<buttonCell key="cell" type="check" title="Auto Configure" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="FLv-D9-CRw">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="-2" name="value" keyPath="autoConfigureNetworkServices" id="SgV-RH-wUe"/>
</connections>
</button>
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="657-dv-Val">
<rect key="frame" x="20" y="61" width="258" height="199"/>
<clipView key="contentView" ambiguous="YES" id="i6C-d3-Rpb">
<rect key="frame" x="1" y="1" width="256" height="197"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" id="tdp-Lr-L64">
<rect key="frame" x="0.0" y="0.0" width="256" height="197"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn width="253" minWidth="40" maxWidth="1000" id="26S-Kb-zSc">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<buttonCell key="dataCell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" inset="2" id="ucF-02-bm8">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<connections>
<binding destination="-2" name="enabled" keyPath="autoConfigureNetworkServices" id="XkV-FH-93a">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</tableColumn>
</tableColumns>
<connections>
<outlet property="dataSource" destination="-2" id="e18-9E-A4F"/>
<outlet property="delegate" destination="-2" id="8UX-DB-agU"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="3sC-hI-IvB">
<rect key="frame" x="-7" y="-14" width="0.0" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="6OR-N8-MXx">
<rect key="frame" x="-14" y="-7" width="15" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ulk-V7-E4w">
<rect key="frame" x="203" y="13" width="81" height="32"/>
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="rWE-M6-TvV">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
DQ
</string>
</buttonCell>
<connections>
<action selector="ok:" target="-2" id="GTx-sb-ino"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NVO-zo-7QI">
<rect key="frame" x="122" y="13" width="81" height="32"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="lsQ-1C-OhG">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
Gw
</string>
</buttonCell>
<connections>
<action selector="cancel:" target="-2" id="bId-aB-i6V"/>
</connections>
</button>
</subviews>
</view>
<connections>
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
</connections>
<point key="canvasLocation" x="360" y="335.5"/>
</window>
<userDefaultsController representsSharedInstance="YES" id="vMm-BK-U3M"/>
</objects>
</document>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@ -36,7 +36,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>3</string>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
@ -48,6 +48,6 @@
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<string>SWBApplication</string>
</dict>
</plist>

View File

@ -9,9 +9,9 @@
import Foundation
let SS_LOCAL_VERSION = "2.4.6"
let APP_SUPPORT_DIR = "/Library/Application Support/ShadowsocksX-NE/"
let APP_SUPPORT_DIR = "/Library/Application Support/ShadowsocksX-NG/"
let LAUNCH_AGENT_DIR = "/Library/LaunchAgents/"
let LAUNCH_AGENT_CONF_NAME = "com.qiuyuzhou.shadowsocksX-NE.local.plist"
let LAUNCH_AGENT_CONF_NAME = "com.qiuyuzhou.shadowsocksX-NG.local.plist"
func getFileSHA1Sum(filepath: String) -> String {
@ -44,7 +44,7 @@ func generateSSLocalLauchAgentPlist() -> Bool {
// For a complete listing of the keys, see the launchd.plist manual page.
let dict: NSMutableDictionary = [
"Label": "com.qiuyuzhou.shadowsocksX-NE.local",
"Label": "com.qiuyuzhou.shadowsocksX-NG.local",
"WorkingDirectory": NSHomeDirectory() + APP_SUPPORT_DIR,
"KeepAlive": true,
"StandardOutPath": logFilePath,
@ -147,7 +147,7 @@ func removeSSLocalConfFile() {
func SyncSSLocal() {
var changed: Bool = false
changed = changed || generateSSLocalLauchAgentPlist()
let mgr = ServerProfileManager()
let mgr = ServerProfileManager.instance
if mgr.activeProfileId != nil {
changed = changed || writeSSLocalConfFile((mgr.getActiveProfile()?.toJsonConfig())!)

View File

@ -9,4 +9,5 @@
import Foundation
let NOTIFY_SERVER_PROFILES_CHANGED = "NOTIFY_SERVER_PROFILES_CHANGED"
let NOTIFY_ADV_PROXY_CONF_CHANGED = "NOTIFY_ADV_PROXY_CONF_CHANGED"
let NOTIFY_ADV_CONF_CHANGED = "NOTIFY_ADV_CONF_CHANGED"

View File

@ -9,7 +9,9 @@
import Foundation
import Alamofire
let PACRulesDirPath = NSHomeDirectory() + "/.ShadowsocksX-NE/"
let OldErrorPACRulesDirPath = NSHomeDirectory() + "/.ShadowsocksX-NE/"
let PACRulesDirPath = NSHomeDirectory() + "/.ShadowsocksX-NG/"
let PACUserRuleFilePath = PACRulesDirPath + "user-rule.txt"
let PACFilePath = PACRulesDirPath + "gfwlist.js"
let GFWListFilePath = PACRulesDirPath + "gfwlist.txt"
@ -17,12 +19,23 @@ let GFWListFilePath = PACRulesDirPath + "gfwlist.txt"
// Because of LocalSocks5.ListenPort may be changed
func SyncPac() {
var needGenerate = false
let nowSocks5Port = NSUserDefaults.standardUserDefaults().integerForKey("LocalSocks5.ListenPort")
let oldSocks5Port = NSUserDefaults.standardUserDefaults().integerForKey("LocalSocks5.ListenPort.Old")
if nowSocks5Port != oldSocks5Port {
GeneratePACFile()
needGenerate = true
NSUserDefaults.standardUserDefaults().setInteger(nowSocks5Port, forKey: "LocalSocks5.ListenPort.Old")
}
let fileMgr = NSFileManager.defaultManager()
if !fileMgr.fileExistsAtPath(PACRulesDirPath) {
needGenerate = true
}
if needGenerate {
GeneratePACFile()
}
}
@ -30,8 +43,12 @@ func GeneratePACFile() -> Bool {
let fileMgr = NSFileManager.defaultManager()
// Maker the dir if rulesDirPath is not exesited.
if !fileMgr.fileExistsAtPath(PACRulesDirPath) {
try! fileMgr.createDirectoryAtPath(PACRulesDirPath
, withIntermediateDirectories: true, attributes: nil)
if fileMgr.fileExistsAtPath(OldErrorPACRulesDirPath) {
try! fileMgr.moveItemAtPath(OldErrorPACRulesDirPath, toPath: PACRulesDirPath)
} else {
try! fileMgr.createDirectoryAtPath(PACRulesDirPath
, withIntermediateDirectories: true, attributes: nil)
}
}
// If gfwlist.txt is not exsited, copy from bundle
@ -40,7 +57,7 @@ func GeneratePACFile() -> Bool {
try! fileMgr.copyItemAtPath(src!, toPath: GFWListFilePath)
}
// If gfwlist.txt is not exsited, copy from bundle
// If user-rule.txt is not exsited, copy from bundle
if !fileMgr.fileExistsAtPath(PACUserRuleFilePath) {
let src = NSBundle.mainBundle().pathForResource("user-rule", ofType: "txt")
try! fileMgr.copyItemAtPath(src!, toPath: PACUserRuleFilePath)

View File

@ -36,7 +36,7 @@ class PreferencesWindowController: NSWindowController
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
defaults = NSUserDefaults.standardUserDefaults()
profileMgr = ServerProfileManager()
profileMgr = ServerProfileManager.instance
methodTextField.addItemsWithObjectValues([
"aes-128-cfb",

View File

@ -99,19 +99,46 @@
}
}
+ (void)addArguments4ManualSpecifyNetworkServices:(NSMutableArray*) args {
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
if (![defaults boolForKey:@"AutoConfigureNetworkServices"]) {
NSArray* serviceKeys = [defaults arrayForKey:@"Proxy4NetworkServices"];
if (serviceKeys) {
for (NSString* key in serviceKeys) {
[args addObject:@"--network-service"];
[args addObject:key];
}
}
}
}
+ (void)enablePACProxy {
NSString* urlString = [NSString stringWithFormat:@"%@/.ShadowsocksX-NE/gfwlist.js", NSHomeDirectory()];
NSString* urlString = [NSString stringWithFormat:@"%@/.ShadowsocksX-NG/gfwlist.js", NSHomeDirectory()];
NSURL* url = [NSURL fileURLWithPath:urlString];
[self callHelper:@[@"--mode", @"auto", @"--pac-url", [url absoluteString]]];
NSMutableArray* args = [@[@"--mode", @"auto", @"--pac-url", [url absoluteString]]mutableCopy];
[self addArguments4ManualSpecifyNetworkServices:args];
[self callHelper:args];
}
+ (void)enableGlobalProxy {
NSUInteger port = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalSocks5.ListenPort"];
[self callHelper:@[@"--mode", @"global", @"--port", [NSString stringWithFormat:@"%lu", (unsigned long)port] ]];
NSMutableArray* args = [@[@"--mode", @"global", @"--port"
, [NSString stringWithFormat:@"%lu", (unsigned long)port]]mutableCopy];
[self addArguments4ManualSpecifyNetworkServices:args];
[self callHelper:args];
}
+ (void)disableProxy {
[self callHelper:@[@"--mode", @"off"]];
NSMutableArray* args = [@[@"--mode", @"off"]mutableCopy];
[self addArguments4ManualSpecifyNetworkServices:args];
[self callHelper:args];
}
@end

View File

@ -0,0 +1,16 @@
//
// ProxyConfTool.h
// ShadowsocksX-NG
//
// Created by 邱宇舟 on 16/6/29.
// Copyright © 2016年 qiuyuzhou. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ProxyConfTool : NSObject
+(NSArray*)networkServicesList;
@end

View File

@ -0,0 +1,52 @@
//
// ProxyConfTool.m
// ShadowsocksX-NG
//
// Created by on 16/6/29.
// Copyright © 2016 qiuyuzhou. All rights reserved.
//
#import "ProxyConfTool.h"
#import <SystemConfiguration/SystemConfiguration.h>
//https://developer.apple.com/library/mac/documentation/Networking/Conceptual/SystemConfigFrameworks/SC_Intro/SC_Intro.html
@implementation ProxyConfTool
+(NSArray*)networkServicesList {
NSMutableArray* results = [NSMutableArray array];
SCPreferencesRef prefRef = SCPreferencesCreate(nil, CFSTR("Shadowsocks"), nil);
NSDictionary *sets = (__bridge NSDictionary *)SCPreferencesGetValue(prefRef, kSCPrefNetworkServices);
//
for (NSString *key in [sets allKeys]) {
NSMutableDictionary *service = [sets objectForKey:key];
NSString *userDefinedName = [service valueForKey:(__bridge NSString *)kSCPropUserDefinedName];
// NSString *hardware = [service valueForKeyPath:@"Interface.Hardware"];
// NSString *deviceName = [service valueForKeyPath:@"Interface.DeviceName"];
// NSString *deviceType = [service valueForKeyPath:@"Interface.Type"];
BOOL isActive = ![service objectForKey:(NSString *)kSCResvInactive];
// NSLog(@"%@", hardware);
// NSLog(@"%@-------------------", key);
// for(NSString* key in service) {
// NSLog(@"key=%@ value=%@", key, [service objectForKey:key]);
// }
//
if (isActive) {
if (isActive && userDefinedName) {
NSDictionary* v = @{
@"key": key,
@"userDefinedName": userDefinedName,
};
[results addObject:v];
}
}
}
return results;
}
@end

View File

@ -0,0 +1,93 @@
//
// ProxyPreferencesController.swift
// ShadowsocksX-NG
//
// Created by on 16/6/29.
// Copyright © 2016 qiuyuzhou. All rights reserved.
//
import Cocoa
class ProxyPreferencesController: NSWindowController, NSTableViewDataSource, NSTableViewDelegate {
var networkServices: NSArray!
var selectedNetworkServices: NSMutableSet!
var autoConfigureNetworkServices: Bool = true
@IBOutlet var autoConfigCheckBox: NSButton!
@IBOutlet var tableView: NSTableView!
override func windowDidLoad() {
super.windowDidLoad()
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
let defaults = NSUserDefaults.standardUserDefaults()
self.setValue(defaults.boolForKey("AutoConfigureNetworkServices"), forKey: "autoConfigureNetworkServices")
if let services = defaults.arrayForKey("Proxy4NetworkServices") {
selectedNetworkServices = NSMutableSet(array: services)
} else {
selectedNetworkServices = NSMutableSet()
}
networkServices = ProxyConfTool.networkServicesList()
tableView.reloadData()
}
@IBAction func ok(sender: NSObject){
ProxyConfHelper.disableProxy()
let defaults = NSUserDefaults.standardUserDefaults()
defaults.setValue(selectedNetworkServices.allObjects, forKeyPath: "Proxy4NetworkServices")
defaults.setBool(autoConfigureNetworkServices, forKey: "AutoConfigureNetworkServices")
defaults.synchronize()
window?.performClose(self)
NSNotificationCenter.defaultCenter()
.postNotificationName(NOTIFY_ADV_PROXY_CONF_CHANGED, object: nil)
}
@IBAction func cancel(sender: NSObject){
window?.performClose(self)
}
//--------------------------------------------------
// For NSTableViewDataSource
func numberOfRowsInTableView(tableView: NSTableView) -> Int {
if networkServices != nil {
return networkServices.count
}
return 0;
}
func tableView(tableView: NSTableView, objectValueForTableColumn tableColumn: NSTableColumn?
, row: Int) -> AnyObject? {
let cell = tableColumn!.dataCell as! NSButtonCell
let key = networkServices[row]["key"] as! String
if selectedNetworkServices.containsObject(key) {
cell.state = 1
} else {
cell.state = 0
}
let userDefinedName = networkServices[row]["userDefinedName"] as! String
cell.title = userDefinedName
return cell
}
func tableView(tableView: NSTableView, setObjectValue object: AnyObject?
, forTableColumn tableColumn: NSTableColumn?, row: Int) {
let key = networkServices[row]["key"] as! String
// NSLog("%d", object!.integerValue)
if object!.integerValue == 1 {
selectedNetworkServices.addObject(key)
} else {
selectedNetworkServices.removeObject(key)
}
}
}

View File

@ -0,0 +1,11 @@
//
// Created by clowwindy on 3/1/14.
// Copyright (c) 2014 clowwindy. All rights reserved.
//
#import <Foundation/Foundation.h>
@import AppKit;
@interface SWBApplication : NSApplication
@end

View File

@ -0,0 +1,49 @@
//
// Created by clowwindy on 3/1/14.
// Copyright (c) 2014 clowwindy. All rights reserved.
//
#import "SWBApplication.h"
@implementation SWBApplication {
}
// Enable Key Shortcuts
// http://stackoverflow.com/questions/970707/cocoa-keyboard-shortcuts-in-dialog-without-an-edit-menu
- (void) sendEvent:(NSEvent *)event {
if ([event type] == NSKeyDown) {
if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == NSCommandKeyMask) {
if ([[event charactersIgnoringModifiers] isEqualToString:@"x"]) {
if ([self sendAction:@selector(cut:) to:nil from:self])
return;
}
else if ([[event charactersIgnoringModifiers] isEqualToString:@"c"]) {
if ([self sendAction:@selector(copy:) to:nil from:self])
return;
}
else if ([[event charactersIgnoringModifiers] isEqualToString:@"v"]) {
if ([self sendAction:@selector(paste:) to:nil from:self])
return;
}
else if ([[event charactersIgnoringModifiers] isEqualToString:@"z"]) {
if ([self sendAction:@selector(undo:) to:nil from:self])
return;
}
else if ([[event charactersIgnoringModifiers] isEqualToString:@"a"]) {
if ([self sendAction:@selector(selectAll:) to:nil from:self])
return;
}
}
else if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSShiftKeyMask)) {
if ([[event charactersIgnoringModifiers] isEqualToString:@"Z"]) {
if ([self sendAction:@selector(redo:) to:nil from:self])
return;
}
}
}
[super sendEvent:event];
}
@end

View File

@ -10,10 +10,12 @@ import Cocoa
class ServerProfileManager: NSObject {
static let instance:ServerProfileManager = ServerProfileManager()
var profiles:[ServerProfile]
var activeProfileId: String?
override init() {
private override init() {
profiles = [ServerProfile]()
let defaults = NSUserDefaults.standardUserDefaults()

View File

@ -7,4 +7,5 @@
#import "LaunchAtLoginController.h"
#import "SWBQRCodeWindowController.h"
#import "Utils.h"
#import "ProxyConfHelper.h"
#import "ProxyConfHelper.h"
#import "ProxyConfTool.h"

View File

@ -8,11 +8,11 @@
cd `dirname "${BASH_SOURCE[0]}"`
mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local-2.4.6"
cp -f ss-local "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local-2.4.6/"
rm -f "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local"
ln -s "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local-2.4.6/ss-local" "$HOME/Library/Application Support/ShadowsocksX-NE/ss-local"
mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local-2.4.6"
cp -f ss-local "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local-2.4.6/"
rm -f "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local"
ln -s "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local-2.4.6/ss-local" "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local"
cp -f libcrypto.1.0.0.dylib "$HOME/Library/Application Support/ShadowsocksX-NE/"
cp -f libcrypto.1.0.0.dylib "$HOME/Library/Application Support/ShadowsocksX-NG/"
echo done

View File

@ -9,6 +9,6 @@
#ifndef proxy_conf_helper_version_h
#define proxy_conf_helper_version_h
#define kProxyConfHelperVersion @"1.1.0"
#define kProxyConfHelperVersion @"1.2.0"
#endif /* proxy_conf_helper_version_h */

View File

@ -6,7 +6,7 @@
# Created by 邱宇舟 on 16/6/6.
# Copyright © 2016年 qiuyuzhou. All rights reserved.
#launchctl kill SIGHUP "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NE.local.plist"
#launchctl kill SIGHUP "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist"
launchctl unload "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NE.local.plist"
launchctl load "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NE.local.plist"
launchctl unload "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist"
launchctl load "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist"

View File

@ -6,4 +6,4 @@
# Created by 邱宇舟 on 16/6/6.
# Copyright © 2016年 qiuyuzhou. All rights reserved.
launchctl load "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NE.local.plist"
launchctl load "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist"

View File

@ -8,4 +8,4 @@
launchctl unload "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NE.local.plist"
launchctl unload "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist"

View File

@ -1,60 +1,69 @@
/* Class = "NSMenuItem"; title = "Global Mode"; ObjectID = "3Sa-e9-VXX"; */
"3Sa-e9-VXX.title" = "全局模式";
/* Class = "NSMenuItem"; title = "Apply User Rules For PAC"; ObjectID = "6qf-cg-HXc"; */
/* Class = "NSMenuItem"; title = "应用用户自定规则到 PAC"; ObjectID = "6qf-cg-HXc"; */
"6qf-cg-HXc.title" = "应用用户自定规则到 PAC";
/* Class = "NSMenu"; title = "Servers"; ObjectID = "9Y1-db-3HK"; */
/* Class = "NSMenuItem"; title = "手动模式"; ObjectID = "8PR-gs-c5N"; */
"8PR-gs-c5N.title" = "手动模式";
/* Class = "NSMenu"; title = "服务器"; ObjectID = "9Y1-db-3HK"; */
"9Y1-db-3HK.title" = "服务器";
/* Class = "NSMenuItem"; title = "Turn ShadowsocksX On"; ObjectID = "GSu-Tf-StS"; */
/* Class = "NSMenuItem"; title = "打开 ShadowsocksX"; ObjectID = "GSu-Tf-StS"; */
"GSu-Tf-StS.title" = "打开 ShadowsocksX";
/* Class = "NSMenu"; title = "ShadowsocksX-NE"; ObjectID = "Hob-KD-bx9"; */
"Hob-KD-bx9.title" = "ShadowsocksX-NE";
/* Class = "NSMenu"; title = "ShadowsocksX-NG"; ObjectID = "Hob-KD-bx9"; */
"Hob-KD-bx9.title" = "ShadowsocksX-NG";
/* Class = "NSMenuItem"; title = "Show Logs..."; ObjectID = "Jfy-sf-Fhl"; */
/* Class = "NSMenuItem"; title = "显示日志..."; ObjectID = "Jfy-sf-Fhl"; */
"Jfy-sf-Fhl.title" = "显示日志...";
/* Class = "NSMenuItem"; title = "About"; ObjectID = "LgB-6g-Gba"; */
/* Class = "NSMenuItem"; title = "关于"; ObjectID = "LgB-6g-Gba"; */
"LgB-6g-Gba.title" = "关于";
/* Class = "NSMenuItem"; title = "Server Preferences..."; ObjectID = "M5r-E7-44f"; */
/* Class = "NSMenuItem"; title = "服务器设置..."; ObjectID = "M5r-E7-44f"; */
"M5r-E7-44f.title" = "服务器设置...";
/* Class = "NSMenuItem"; title = "Scan QR Code From Screen ..."; ObjectID = "Qe6-bF-paT"; */
/* Class = "NSMenuItem"; title = "全局模式"; ObjectID = "Mw3-Jm-eXA"; */
"Mw3-Jm-eXA.title" = "全局模式";
/* Class = "NSMenuItem"; title = "扫描屏幕上的二维码..."; ObjectID = "Qe6-bF-paT"; */
"Qe6-bF-paT.title" = "扫描屏幕上的二维码...";
/* Class = "NSMenuItem"; title = "Show QR Code For Current Server..."; ObjectID = "R6A-96-Zcb"; */
/* Class = "NSMenuItem"; title = "显示当前服务器的二维码..."; ObjectID = "R6A-96-Zcb"; */
"R6A-96-Zcb.title" = "显示当前服务器的二维码...";
/* Class = "NSMenuItem"; title = "Update PAC from GFW List"; ObjectID = "TFc-Ec-duM"; */
/* Class = "NSMenuItem"; title = " GFW List 更新PAC"; ObjectID = "TFc-Ec-duM"; */
"TFc-Ec-duM.title" = "从 GFW List 更新PAC";
/* Class = "NSMenuItem"; title = "Feedback"; ObjectID = "W7u-7g-Gv4"; */
/* Class = "NSMenuItem"; title = "反馈"; ObjectID = "W7u-7g-Gv4"; */
"W7u-7g-Gv4.title" = "反馈";
/* Class = "NSMenuItem"; title = "Advance Preference ..."; ObjectID = "bZ3-fy-34d"; */
/* Class = "NSMenu"; title = "代理"; ObjectID = "YZp-bf-L40"; */
"YZp-bf-L40.title" = "代理";
/* Class = "NSMenuItem"; title = "高级设置..."; ObjectID = "bZ3-fy-34d"; */
"bZ3-fy-34d.title" = "高级设置...";
/* Class = "NSMenuItem"; title = "Launch At Login"; ObjectID = "eUq-p7-ICK"; */
/* Class = "NSMenuItem"; title = "代理"; ObjectID = "diI-fB-Rss"; */
"diI-fB-Rss.title" = "代理";
/* Class = "NSMenuItem"; title = "登录时自动启动"; ObjectID = "eUq-p7-ICK"; */
"eUq-p7-ICK.title" = "登录时自动启动";
/* Class = "NSMenuItem"; title = "Showsocks: On"; ObjectID = "fzk-mE-CEV"; */
"fzk-mE-CEV.title" = "Showsocks: On";
/* Class = "NSMenuItem"; title = "Auto Mode By PAC"; ObjectID = "hOa-5N-3ik"; */
"hOa-5N-3ik.title" = "PAC自动模式";
/* Class = "NSMenuItem"; title = "PAC自动模式"; ObjectID = "r07-Gu-aEz"; */
"r07-Gu-aEz.title" = "PAC自动模式";
/* Class = "NSMenuItem"; title = "Edit User Rules For PAC..."; ObjectID = "rms-p0-CvB"; */
/* Class = "NSMenuItem"; title = "编辑PAC用户自定规则..."; ObjectID = "rms-p0-CvB"; */
"rms-p0-CvB.title" = "编辑PAC用户自定规则...";
/* Class = "NSMenuItem"; title = "Servers"; ObjectID = "u5M-hQ-VSc"; */
/* Class = "NSMenuItem"; title = "高级设置..."; ObjectID = "sbx-yz-3lO"; */
"sbx-yz-3lO.title" = "高级设置...";
/* Class = "NSMenuItem"; title = "服务器"; ObjectID = "u5M-hQ-VSc"; */
"u5M-hQ-VSc.title" = "服务器";
/* Class = "NSMenuItem"; title = "Quit"; ObjectID = "vJS-JW-byz"; */
/* Class = "NSMenuItem"; title = "退出"; ObjectID = "vJS-JW-byz"; */
"vJS-JW-byz.title" = "退出";
/* Class = "NSMenuItem"; title = "Manual Mode"; ObjectID = "vRc-N6-z1e"; */
"vRc-N6-z1e.title" = "手动模式";

View File

@ -0,0 +1,13 @@
/* Class = "NSWindow"; title = "Advance Proxy Preferences"; ObjectID = "F0z-JX-Cv5"; */
"F0z-JX-Cv5.title" = "高级代理设置";
/* Class = "NSButtonCell"; title = "Auto Configure"; ObjectID = "FLv-D9-CRw"; */
"FLv-D9-CRw.title" = "自动设置";
/* Class = "NSButtonCell"; title = "Cancel"; ObjectID = "lsQ-1C-OhG"; */
"lsQ-1C-OhG.title" = "取消";
/* Class = "NSButtonCell"; title = "OK"; ObjectID = "rWE-M6-TvV"; */
"rWE-M6-TvV.title" = "确定";

View File

@ -45,6 +45,11 @@ int main(int argc, const char * argv[])
[options addOption:"pac-url" flag:'u' description:@"PAC file url for auto mode." argument:&pacURL];
[options addOption:"port" flag:'p' description:@"Listen port for global mode." argument:&portString];
NSMutableSet* networkServiceKeys = [NSMutableSet set];
[options addOption:"network-service" flag:'n' description:@"Manual specify the network profile need to set proxy." blockWithArgument:^(NSString* value){
[networkServiceKeys addObject:value];
}];
NSError *error = nil;
if (![options parseArgc:argc argv:argv error:&error]) {
const char * message = error.localizedDescription.UTF8String;
@ -108,7 +113,18 @@ int main(int argc, const char * argv[])
NSMutableDictionary *dict = [sets objectForKey:key];
NSString *hardware = [dict valueForKeyPath:@"Interface.Hardware"];
// NSLog(@"%@", hardware);
if ([hardware isEqualToString:@"AirPort"] || [hardware isEqualToString:@"Wi-Fi"] || [hardware isEqualToString:@"Ethernet"]) {
BOOL modify = NO;
if ([networkServiceKeys count] > 0) {
if ([networkServiceKeys containsObject:key]) {
modify = YES;
}
} else if ([hardware isEqualToString:@"AirPort"]
|| [hardware isEqualToString:@"Wi-Fi"]
|| [hardware isEqualToString:@"Ethernet"]) {
modify = YES;
}
if (modify) {
if ([mode isEqualToString:@"auto"]) {