From 1b6979637704bcfb6633999acb4cf792a9594b5f Mon Sep 17 00:00:00 2001 From: liuguoxu <9480007@qq.com> Date: Mon, 3 Jun 2019 19:42:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E7=BA=A7=E8=AE=BE=E7=BD=AE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0pac=E7=9B=91=E5=90=AC=E5=9C=B0=E5=9D=80=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E6=96=B9=E4=BE=BF=E5=B1=80=E5=9F=9F=E7=BD=91?= =?UTF-8?q?=E5=85=B1=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowsocksX-NG.xcodeproj/project.pbxproj | 7 +- ShadowsocksX-NG/AppDelegate.swift | 1 + .../Base.lproj/PreferencesWinController.xib | 86 +++++++++++++------ ShadowsocksX-NG/Diagnose.swift | 1 + ShadowsocksX-NG/ProxyConfHelper.m | 7 +- .../PreferencesWinController.strings | 4 +- 6 files changed, 73 insertions(+), 33 deletions(-) diff --git a/ShadowsocksX-NG.xcodeproj/project.pbxproj b/ShadowsocksX-NG.xcodeproj/project.pbxproj index bbfec57..ff4e05d 100755 --- a/ShadowsocksX-NG.xcodeproj/project.pbxproj +++ b/ShadowsocksX-NG.xcodeproj/project.pbxproj @@ -145,6 +145,7 @@ 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; }; 297AF069022A197FD8E9D226 /* Pods-proxy_conf_helper.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-proxy_conf_helper.release.xcconfig"; path = "Pods/Target Support Files/Pods-proxy_conf_helper/Pods-proxy_conf_helper.release.xcconfig"; sourceTree = ""; }; + 3134441F22A53D8A006C3889 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/PreferencesWinController.strings"; sourceTree = ""; }; 388120F062D7EB7DD0D8DDCA /* Pods_ShadowsocksX_NGTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ShadowsocksX_NGTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3AC7CD9886196A997D6FC78D /* Pods-ShadowsocksX-NGTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShadowsocksX-NGTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Pods-ShadowsocksX-NGTests.release.xcconfig"; sourceTree = ""; }; 50D54926AA21B0D4D8DD9C4F /* Pods-ShadowsocksX-NGUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShadowsocksX-NGUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ShadowsocksX-NGUITests/Pods-ShadowsocksX-NGUITests.release.xcconfig"; sourceTree = ""; }; @@ -224,7 +225,6 @@ 9BA04B211D23D5A5005AAD7F /* ProxyConfTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyConfTool.h; sourceTree = ""; }; 9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProxyConfTool.m; sourceTree = ""; }; 9BAFE2E31E83ED7F00F71CCE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreferencesWinController.xib; sourceTree = ""; }; - 9BAFE2E91E83EDDF00F71CCE /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/PreferencesWinController.strings"; sourceTree = ""; }; 9BAFE2EB1E83F91D00F71CCE /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainMenu.strings"; sourceTree = ""; }; 9BB706A51D1B982300551F0E /* SWBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWBApplication.m; sourceTree = ""; }; 9BB706A61D1B982300551F0E /* SWBApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWBApplication.h; sourceTree = ""; }; @@ -602,6 +602,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, "zh-Hans", @@ -948,7 +949,7 @@ isa = PBXVariantGroup; children = ( 9BAFE2E31E83ED7F00F71CCE /* Base */, - 9BAFE2E91E83EDDF00F71CCE /* zh-Hans */, + 3134441F22A53D8A006C3889 /* zh-Hans */, ); name = PreferencesWinController.xib; sourceTree = ""; @@ -1091,6 +1092,7 @@ "$(PROJECT_DIR)/ShadowsocksX-NG/simple-obfs", ); MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.qiuyuzhou.ShadowsocksX-NG"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "ShadowsocksX-NG/ShadowsocksX-NG-Bridging-Header.h"; @@ -1121,6 +1123,7 @@ "$(PROJECT_DIR)/ShadowsocksX-NG/simple-obfs", ); MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.qiuyuzhou.ShadowsocksX-NG"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "ShadowsocksX-NG/ShadowsocksX-NG-Bridging-Header.h"; diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index ba927c7..7bbeebf 100755 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -93,6 +93,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele "ShadowsocksRunningMode": "auto", "LocalSocks5.ListenPort": NSNumber(value: 1086 as UInt16), "LocalSocks5.ListenAddress": "127.0.0.1", + "PacServer.ListenAddress":"127.0.0.1", "PacServer.ListenPort":NSNumber(value: 1089 as UInt16), "LocalSocks5.Timeout": NSNumber(value: 60 as UInt), "LocalSocks5.EnableUDPRelay": NSNumber(value: false as Bool), diff --git a/ShadowsocksX-NG/Base.lproj/PreferencesWinController.xib b/ShadowsocksX-NG/Base.lproj/PreferencesWinController.xib index 4908f50..3faf730 100644 --- a/ShadowsocksX-NG/Base.lproj/PreferencesWinController.xib +++ b/ShadowsocksX-NG/Base.lproj/PreferencesWinController.xib @@ -1,8 +1,8 @@ - + - + @@ -15,14 +15,14 @@ - + - + - + @@ -92,7 +92,7 @@ - + @@ -134,7 +134,7 @@ - + @@ -156,7 +156,7 @@ - + @@ -168,7 +168,7 @@ - + @@ -176,10 +176,10 @@ - + - + @@ -192,7 +192,7 @@ - + @@ -250,10 +250,10 @@ - + - + @@ -265,32 +265,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -306,7 +336,7 @@ - + @@ -314,7 +344,7 @@ - + @@ -325,7 +355,7 @@ - + @@ -340,7 +370,7 @@ - + @@ -406,7 +436,7 @@ - + @@ -415,7 +445,7 @@ - + @@ -443,11 +473,11 @@ - - + diff --git a/ShadowsocksX-NG/Diagnose.swift b/ShadowsocksX-NG/Diagnose.swift index ac31d51..34de0c5 100644 --- a/ShadowsocksX-NG/Diagnose.swift +++ b/ShadowsocksX-NG/Diagnose.swift @@ -41,6 +41,7 @@ func diagnose() -> String { "ShadowsocksRunningMode", "LocalSocks5.ListenPort", "LocalSocks5.ListenAddress", + "PacServer.ListenAddress", "PacServer.ListenPort", "LocalSocks5.Timeout", "LocalSocks5.EnableUDPRelay", diff --git a/ShadowsocksX-NG/ProxyConfHelper.m b/ShadowsocksX-NG/ProxyConfHelper.m index a6196c5..16f209d 100644 --- a/ShadowsocksX-NG/ProxyConfHelper.m +++ b/ShadowsocksX-NG/ProxyConfHelper.m @@ -193,7 +193,7 @@ GCDWebServer *webServer =nil; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSString * address = @"127.0.0.1"; + NSString * address = [defaults stringForKey:@"PacServer.ListenAddress"]; int port = (short)[defaults integerForKey:@"PacServer.ListenPort"]; return [NSString stringWithFormat:@"%@%@:%d%@",@"http://",address,port,routerPath]; @@ -207,6 +207,8 @@ GCDWebServer *webServer =nil; NSData* originalPACData = [NSData dataWithContentsOfFile:PACFilePath]; webServer = [[GCDWebServer alloc] init]; + + [webServer addHandlerForMethod:@"GET" path:routerPath requestClass:[GCDWebServerRequest class] @@ -220,9 +222,10 @@ GCDWebServer *webServer =nil; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSString * address = [defaults stringForKey:@"PacServer.ListenAddress"]; int port = (short)[defaults integerForKey:@"PacServer.ListenPort"]; - [webServer startWithOptions:@{@"BindToLocalhost":@YES, @"Port":@(port)} error:nil]; + [webServer startWithOptions:@{@"ServerName":address,@"Port":@(port)} error:nil]; } + (void)stopPACServer { diff --git a/ShadowsocksX-NG/zh-Hans.lproj/PreferencesWinController.strings b/ShadowsocksX-NG/zh-Hans.lproj/PreferencesWinController.strings index 47c4777..9bd56b3 100644 --- a/ShadowsocksX-NG/zh-Hans.lproj/PreferencesWinController.strings +++ b/ShadowsocksX-NG/zh-Hans.lproj/PreferencesWinController.strings @@ -1,4 +1,3 @@ - /* Class = "NSTextFieldCell"; title = "Seconds"; ObjectID = "4R2-UO-qs7"; */ "4R2-UO-qs7.title" = "秒"; @@ -53,6 +52,9 @@ /* Class = "NSTextFieldCell"; title = "Num of Kcptun connections:"; ObjectID = "FSi-9j-QBe"; */ "FSi-9j-QBe.title" = "Num of Kcptun connections:"; +/* Class = "NSTextFieldCell"; title = "Local PAC Server Listen Address:"; ObjectID = "80e-Qu-r2S"; */ +"80e-Qu-r2S.title" = "本地PAC服务器监听地址:"; + /* Class = "NSTextFieldCell"; title = "Local PAC Server Listen Port:"; ObjectID = "IMQ-c4-gmc"; */ "IMQ-c4-gmc.title" = "本地PAC服务器监听端口:";