mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-11-04 09:04:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e231a7b34 | ||
|
|
381b9ce634 | ||
|
|
cf2f5d1a9c | ||
|
|
d2b8ca1c97 | ||
|
|
082c25f5e2 | ||
|
|
969c94eaff | ||
|
|
e4236f21a1 | ||
|
|
299abfee7b | ||
|
|
713bcae7b1 | ||
|
|
3c77fc9fe9 | ||
|
|
53d41ad27b | ||
|
|
a85fc4e3b4 | ||
|
|
e5b342c134 | ||
|
|
d0ad272198 | ||
|
|
7ad9dc42a0 | ||
|
|
5ed5789c31 | ||
|
|
c7211ceb19 | ||
|
|
fc11cc78fd | ||
|
|
dd20ebda68 | ||
|
|
22d654dd69 | ||
|
|
8fa7f76faa |
@@ -8,13 +8,13 @@ Next Generation of [ShadowsocksX](https://github.com/shadowsocks/shadowsocks-iOS
|
||||
|
||||
## Why?
|
||||
|
||||
It's hard to maintain the original implement. There are too many unused code in it.
|
||||
It also embed ss-local source. It's crazy to maintain depandences of ss-local.
|
||||
So it's hard to update ss-local version.
|
||||
It's hard to maintain the original implementation as there is too much unused code in it.
|
||||
It also embeds the ss-local source. It's crazy to maintain dependencies of ss-local.
|
||||
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.
|
||||
Serve pac js file as a file url. So there are only some souce code related to GUI left.
|
||||
Then I rewrite the GUI code by swift.
|
||||
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 is only some source code related to GUI left.
|
||||
Then I will rewrite the GUI code in Swift.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -27,30 +27,34 @@ Then I rewrite the GUI code by swift.
|
||||
- XCode 8.0+
|
||||
- cocoapod 1.0.1+
|
||||
|
||||
## Download
|
||||
|
||||
From [here](https://github.com/shadowsocks/ShadowsocksX-NG/releases/)
|
||||
|
||||
## Fetures
|
||||
|
||||
- Use ss-local from shadowsocks-libev 2.4.6
|
||||
- Update PAC by download GFW List from github.
|
||||
- Update PAC by download GFW List from GitHub.
|
||||
- Show QRCode for current server profile.
|
||||
- Scan QRCode from screen.
|
||||
- Auto launch at login.
|
||||
- User rules for PAC.
|
||||
- Support OTA
|
||||
- An advance preferences panel to configure:
|
||||
- An advanced preferences panel to configure:
|
||||
- Local socks5 listen address.
|
||||
- Local socks5 listen port.
|
||||
- Local socks5 timeout.
|
||||
- If enable UDP relay.
|
||||
- GFW List url.
|
||||
- Manual spesify network service profiles which would be configure the proxy.
|
||||
- GFW List URL.
|
||||
- Manual specify network service profiles which would be configure the proxy.
|
||||
- Could reorder shadowsocks profiles by drag & drop in servers preferences panel.
|
||||
|
||||
## Different from orignal ShadowsocksX
|
||||
|
||||
Run ss-local as backgroud service through launchd, not in app process.
|
||||
So after you quit the app, the ss-local maybe is still running.
|
||||
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 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.
|
||||
|
||||
## Contributing
|
||||
@@ -65,5 +69,5 @@ ref: [GitFlow](http://nvie.com/posts/a-successful-git-branching-model/)
|
||||
|
||||
## License
|
||||
|
||||
The project is released under the terms of GPLv3.
|
||||
The project is released under the terms of the GPLv3.
|
||||
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
9B3FFF291D08A1DF0019A709 /* user-rule.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF281D08A1DF0019A709 /* user-rule.txt */; };
|
||||
9B3FFF321D08CEE40019A709 /* SWBQRCodeWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF311D08CEE40019A709 /* SWBQRCodeWindowController.m */; };
|
||||
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 */; };
|
||||
9B3FFF471D09CD3B0019A709 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF461D09CD3B0019A709 /* main.m */; };
|
||||
9B3FFF4C1D09D8F70019A709 /* install_helper.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF4B1D09D8F70019A709 /* install_helper.sh */; };
|
||||
@@ -96,18 +93,6 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
083BF8311D82731900831C68 /* SimplePing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimplePing.h; sourceTree = "<group>"; };
|
||||
083BF8321D82731900831C68 /* SimplePing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimplePing.m; sourceTree = "<group>"; };
|
||||
083BF8341D82742200831C68 /* NetWorkMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetWorkMonitor.swift; sourceTree = "<group>"; };
|
||||
083BF8351D82742200831C68 /* PingClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PingClient.swift; sourceTree = "<group>"; };
|
||||
083BF8381D82759600831C68 /* StatusItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusItemView.swift; sourceTree = "<group>"; };
|
||||
083BF83A1D8275A800831C68 /* SystemThemeChangeHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemThemeChangeHelper.swift; sourceTree = "<group>"; };
|
||||
085641E91D7188C400116B27 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
08805F181D878CA5009B53E7 /* PingTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PingTest.swift; sourceTree = "<group>"; };
|
||||
0880CE3F1D6FE6D900BD39E2 /* example-gui-config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "example-gui-config.json"; sourceTree = "<group>"; };
|
||||
088EC3961D5F5B8600E40791 /* whitelist.pac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = whitelist.pac; sourceTree = "<group>"; };
|
||||
088EC3981D5F5BA300E40791 /* whiteiplist.pac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = whiteiplist.pac; sourceTree = "<group>"; };
|
||||
08AF56C01D6AFA7C00DC4F46 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/PreferencesWindowController.strings"; sourceTree = "<group>"; };
|
||||
19083CFCED87354F006967FF /* Pods_ShadowsocksX_NGUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ShadowsocksX_NGUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1E7783AEDB4A3BDDC9FF16AC /* libPods-proxy_conf_helper.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-proxy_conf_helper.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
283ED1A8E9B711AC65670031 /* Pods_ShadowsocksX_NG.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ShadowsocksX_NG.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -152,9 +137,6 @@
|
||||
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>"; };
|
||||
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; };
|
||||
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; };
|
||||
@@ -253,9 +235,6 @@
|
||||
9BE8FBBD1D0B1FB900CAFD01 /* libcrypto.1.0.0.dylib */,
|
||||
9B172A6C1D0ADDDD00B87B9A /* Localizable.strings */,
|
||||
9B3FFF4B1D09D8F70019A709 /* install_helper.sh */,
|
||||
9B3FFF351D08CF110019A709 /* jquery.min.js */,
|
||||
9B3FFF361D08CF110019A709 /* qrcode.min.js */,
|
||||
9B3FFF371D08CF110019A709 /* qrcode.htm */,
|
||||
9B3FFF281D08A1DF0019A709 /* user-rule.txt */,
|
||||
9B3FFF261D0898EB0019A709 /* gfwlist.txt */,
|
||||
9B3FFF221D088E8D0019A709 /* abp.js */,
|
||||
@@ -501,11 +480,8 @@
|
||||
C6D429971DA75988002A5711 /* stop_privoxy.sh in Resources */,
|
||||
C8E42A6E1D4F2CAF0074C7EA /* UserRulesController.xib in Resources */,
|
||||
9BEEF06A1D04D4D500FC52B3 /* start_ss_local.sh in Resources */,
|
||||
9B3FFF391D08CF110019A709 /* qrcode.min.js in Resources */,
|
||||
9B3FFF3A1D08CF110019A709 /* qrcode.htm in Resources */,
|
||||
C6D429941DA75988002A5711 /* privoxy in Resources */,
|
||||
C6D429991DA76FBC002A5711 /* privoxy.config.example in Resources */,
|
||||
0880CE401D6FE6D900BD39E2 /* example-gui-config.json in Resources */,
|
||||
9BEEF06B1D04D4D500FC52B3 /* stop_ss_local.sh in Resources */,
|
||||
9B3FFF341D08CEF70019A709 /* SWBQRCodeWindowController.xib in Resources */,
|
||||
9BEEF06C1D04D4D500FC52B3 /* reload_conf_ss_local.sh in Resources */,
|
||||
@@ -514,7 +490,6 @@
|
||||
C6D429951DA75988002A5711 /* reload_conf_privoxy.sh in Resources */,
|
||||
9B0BFFEB1D0460A70040E62B /* Assets.xcassets in Resources */,
|
||||
9B2491B71D0ACC3E003BBECC /* AdvPreferencesWindowController.xib in Resources */,
|
||||
9B3FFF381D08CF110019A709 /* jquery.min.js in Resources */,
|
||||
9B3FFF271D0898EB0019A709 /* gfwlist.txt in Resources */,
|
||||
C6D429931DA75988002A5711 /* install_privoxy.sh in Resources */,
|
||||
9BC70EDC1D2E3E3100EDA4CA /* Localizable.strings in Resources */,
|
||||
|
||||
@@ -58,7 +58,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
"ShadowsocksRunningMode": "auto",
|
||||
"LocalSocks5.ListenPort": NSNumber(value: 1086 as UInt16),
|
||||
"LocalSocks5.ListenAddress": "127.0.0.1",
|
||||
"PacServer.ListenAddress": "127.0.0.1",
|
||||
"PacServer.ListenPort":NSNumber(value: 8090 as UInt16),
|
||||
"LocalSocks5.Timeout": NSNumber(value: 60 as UInt),
|
||||
"LocalSocks5.EnableUDPRelay": NSNumber(value: false as Bool),
|
||||
@@ -163,6 +162,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
updateLaunchAtLoginMenu()
|
||||
|
||||
ProxyConfHelper.install()
|
||||
ProxyConfHelper.startMonitorPAC()
|
||||
applyConfig()
|
||||
SyncSSLocal()
|
||||
}
|
||||
@@ -171,10 +171,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
// Insert code here to tear down your application
|
||||
StopSSLocal()
|
||||
StopPrivoxy()
|
||||
ProxyConfHelper.disableProxy("hi")
|
||||
let defaults = UserDefaults.standard
|
||||
defaults.set(false, forKey: "ShadowsocksOn")
|
||||
ProxyConfHelper.stopPACServer()
|
||||
ProxyConfHelper.disableProxy()
|
||||
}
|
||||
|
||||
func applyConfig() {
|
||||
@@ -186,16 +183,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
StartSSLocal()
|
||||
StartPrivoxy()
|
||||
if mode == "auto" {
|
||||
ProxyConfHelper.enablePACProxy("hi")
|
||||
ProxyConfHelper.enablePACProxy()
|
||||
} else if mode == "global" {
|
||||
ProxyConfHelper.enableGlobalProxy()
|
||||
} else if mode == "manual" {
|
||||
ProxyConfHelper.disableProxy("hi")
|
||||
ProxyConfHelper.disableProxy()
|
||||
}
|
||||
} else {
|
||||
StopSSLocal()
|
||||
StopPrivoxy()
|
||||
ProxyConfHelper.disableProxy("hi")
|
||||
ProxyConfHelper.disableProxy()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,14 +382,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
showRunningModeMenuItem.state = defaults.bool(forKey: "ShowRunningModeOnStatusBar") ? 1 : 0
|
||||
|
||||
var serverMenuText = "Servers".localized
|
||||
for v in defaults.array(forKey: "ServerProfiles")! {
|
||||
let profile = v as! [String:Any]
|
||||
if profile["Id"] as! String == defaults.string(forKey: "ActiveServerProfileId")! {
|
||||
|
||||
let mgr = ServerProfileManager.instance
|
||||
for p in mgr.profiles {
|
||||
if mgr.activeProfileId == p.uuid {
|
||||
var profileName :String
|
||||
if profile["Remark"] as! String != "" {
|
||||
profileName = profile["Remark"] as! String
|
||||
if !p.remark.isEmpty {
|
||||
profileName = p.remark
|
||||
} else {
|
||||
profileName = profile["ServerHost"] as! String
|
||||
profileName = p.serverHost
|
||||
}
|
||||
serverMenuText = "\(serverMenuText) - \(profileName)"
|
||||
}
|
||||
|
||||
@@ -12,32 +12,21 @@
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<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"/>
|
||||
<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"/>
|
||||
<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"/>
|
||||
<subviews>
|
||||
<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>
|
||||
<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">
|
||||
<rect key="frame" x="49" y="20" width="378" height="69"/>
|
||||
<rect key="frame" x="54" y="20" width="378" height="69"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="69" id="NVe-Ir-JCv"/>
|
||||
<constraint firstAttribute="height" constant="69" id="yzO-2D-eTT"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="fS7-It-ERD">
|
||||
<font key="font" metaFont="system"/>
|
||||
@@ -53,7 +42,7 @@
|
||||
</connections>
|
||||
</textField>
|
||||
<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">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -61,10 +50,10 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<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>
|
||||
<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">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -72,7 +61,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<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">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -80,7 +69,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<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">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -95,7 +84,7 @@
|
||||
</connections>
|
||||
</textField>
|
||||
<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">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -103,7 +92,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<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">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -119,7 +108,7 @@
|
||||
</connections>
|
||||
</textField>
|
||||
<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">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
@@ -129,9 +118,9 @@
|
||||
</connections>
|
||||
</button>
|
||||
<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>
|
||||
<constraint firstAttribute="width" constant="60" id="reo-ha-VKi"/>
|
||||
<constraint firstAttribute="width" constant="60" id="S9f-Rp-2gz"/>
|
||||
</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">
|
||||
<font key="font" metaFont="system"/>
|
||||
@@ -148,10 +137,7 @@
|
||||
</connections>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eoD-7r-Q85">
|
||||
<rect key="frame" x="303" y="188" width="96" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="92" id="xw1-XT-mjQ"/>
|
||||
</constraints>
|
||||
<rect key="frame" x="303" y="175" width="96" height="17"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Seconds" id="Gd3-Fm-sWh">
|
||||
<font key="font" metaFont="system"/>
|
||||
<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"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Wsf-gl-dkY">
|
||||
<rect key="frame" x="90" y="230" width="141" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Wsf-gl-dkY">
|
||||
<rect key="frame" x="90" y="207" width="141" height="17"/>
|
||||
<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"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FoE-i9-Rfb">
|
||||
<rect key="frame" x="237" y="227" width="60" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FoE-i9-Rfb">
|
||||
<rect key="frame" x="237" y="205" 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="XhZ-XN-MoS">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -194,22 +178,12 @@
|
||||
<outlet property="formatter" destination="uE9-0u-CJW" id="YNn-yx-cWk"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8Co-1p-O4m">
|
||||
<rect key="frame" x="237" y="265" width="160" 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" drawsBackground="YES" id="Z9Z-Tz-7l4">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<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">
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="I4a-N9-Tkv">
|
||||
<rect key="frame" x="52" y="97" width="192" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="188" id="mcl-Uv-Y6n"/>
|
||||
</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"/>
|
||||
@@ -217,51 +191,57 @@
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="xWv-tc-lQe" firstAttribute="baseline" secondItem="Q2L-Fh-TW1" secondAttribute="baseline" id="0ub-69-rbe"/>
|
||||
<constraint firstAttribute="bottom" secondItem="6MD-Ry-R5P" secondAttribute="bottom" constant="20" symbolic="YES" id="1VT-Fs-nNp"/>
|
||||
<constraint firstItem="S5h-Xx-HUG" firstAttribute="leading" secondItem="e3S-m6-k5Y" secondAttribute="leading" id="1Y0-Oh-Ev4"/>
|
||||
<constraint firstItem="wCp-nB-dda" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="4af-lJ-vAL"/>
|
||||
<constraint firstItem="xWv-tc-lQe" firstAttribute="leading" secondItem="S5h-Xx-HUG" secondAttribute="leading" id="7E0-aW-12T"/>
|
||||
<constraint firstItem="6MD-Ry-R5P" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="49" id="8CU-pQ-jDz"/>
|
||||
<constraint firstItem="xWv-tc-lQe" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="29" id="8oq-65-XGK"/>
|
||||
<constraint firstItem="eoD-7r-Q85" firstAttribute="leading" secondItem="sRP-xs-alR" secondAttribute="trailing" constant="8" symbolic="YES" id="GhL-we-2co"/>
|
||||
<constraint firstItem="sRP-xs-alR" firstAttribute="leading" secondItem="DiD-K0-Y43" secondAttribute="leading" id="H7k-Nh-YHo"/>
|
||||
<constraint firstAttribute="trailing" secondItem="DiD-K0-Y43" secondAttribute="trailing" constant="28" id="H8a-Jg-72h"/>
|
||||
<constraint firstItem="XQ5-fw-o8t" firstAttribute="leading" secondItem="sRP-xs-alR" secondAttribute="leading" id="Ij2-mo-WRt"/>
|
||||
<constraint firstItem="DiD-K0-Y43" firstAttribute="leading" secondItem="qVQ-tJ-cO6" secondAttribute="leading" id="J5O-DE-8O9"/>
|
||||
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="top" secondItem="JBW-8M-eHP" secondAttribute="bottom" constant="8" symbolic="YES" id="Jkq-uJ-Wv4"/>
|
||||
<constraint firstAttribute="trailing" secondItem="wCp-nB-dda" secondAttribute="trailing" constant="25" id="Mod-B8-1Yl"/>
|
||||
<constraint firstItem="wCp-nB-dda" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" symbolic="YES" id="R3i-gt-6zg"/>
|
||||
<constraint firstItem="DiD-K0-Y43" firstAttribute="trailing" secondItem="qVQ-tJ-cO6" secondAttribute="trailing" id="WaY-S9-VQ2"/>
|
||||
<constraint firstItem="I4a-N9-Tkv" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="50" id="Wd9-qu-Mx8"/>
|
||||
<constraint firstItem="e3S-m6-k5Y" firstAttribute="top" secondItem="sRP-xs-alR" secondAttribute="top" id="Xmc-dV-VXv"/>
|
||||
<constraint firstItem="JBW-8M-eHP" firstAttribute="top" secondItem="wCp-nB-dda" secondAttribute="bottom" constant="8" symbolic="YES" id="Ysd-52-5Fn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Q2L-Fh-TW1" secondAttribute="trailing" constant="83" id="ZoL-73-xKa"/>
|
||||
<constraint firstItem="sRP-xs-alR" firstAttribute="leading" secondItem="e3S-m6-k5Y" secondAttribute="trailing" constant="8" symbolic="YES" id="ZvN-ZN-EVZ"/>
|
||||
<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="12" id="ccj-Fd-7z7"/>
|
||||
<constraint firstItem="6MD-Ry-R5P" firstAttribute="top" secondItem="I4a-N9-Tkv" secondAttribute="bottom" constant="8" symbolic="YES" id="dPZ-gY-1am"/>
|
||||
<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="15" id="e6i-xd-BD3"/>
|
||||
<constraint firstItem="ayu-Tb-kmf" firstAttribute="centerX" secondItem="se5-gp-TjO" secondAttribute="centerX" id="edi-Ij-cuc"/>
|
||||
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="leading" secondItem="XQ5-fw-o8t" secondAttribute="leading" id="g40-g1-s29"/>
|
||||
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="trailing" secondItem="eoD-7r-Q85" secondAttribute="trailing" id="g4n-5J-iDi"/>
|
||||
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="leading" secondItem="xWv-tc-lQe" secondAttribute="trailing" constant="8" symbolic="YES" id="hoH-Lm-ihP"/>
|
||||
<constraint firstItem="XQ5-fw-o8t" firstAttribute="leading" secondItem="S5h-Xx-HUG" secondAttribute="trailing" constant="8" symbolic="YES" id="ibP-Bc-Xhg"/>
|
||||
<constraint firstItem="ayu-Tb-kmf" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="38" id="kkG-sj-u3Y"/>
|
||||
<constraint firstItem="ayu-Tb-kmf" firstAttribute="top" secondItem="qVQ-tJ-cO6" secondAttribute="bottom" constant="8" symbolic="YES" id="lza-Z7-YaI"/>
|
||||
<constraint firstItem="XQ5-fw-o8t" firstAttribute="trailing" secondItem="sRP-xs-alR" secondAttribute="trailing" id="pfd-Yd-goI"/>
|
||||
<constraint firstItem="JBW-8M-eHP" firstAttribute="centerX" secondItem="6MD-Ry-R5P" secondAttribute="centerX" id="qbH-5m-epu"/>
|
||||
<constraint firstItem="I4a-N9-Tkv" firstAttribute="top" secondItem="ayu-Tb-kmf" secondAttribute="bottom" constant="8" symbolic="YES" id="u7y-6r-Vj5"/>
|
||||
<constraint firstItem="DiD-K0-Y43" firstAttribute="top" secondItem="sRP-xs-alR" secondAttribute="bottom" constant="14" id="xlZ-UD-qns"/>
|
||||
<constraint firstItem="S5h-Xx-HUG" firstAttribute="baseline" secondItem="XQ5-fw-o8t" secondAttribute="baseline" id="y3b-k3-eBU"/>
|
||||
<constraint firstItem="wCp-nB-dda" firstAttribute="centerX" secondItem="6MD-Ry-R5P" secondAttribute="centerX" id="yNP-ab-DmI"/>
|
||||
<constraint firstItem="wCp-nB-dda" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="1TH-Y5-EN7"/>
|
||||
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="leading" secondItem="xWv-tc-lQe" secondAttribute="trailing" constant="8" symbolic="YES" id="3JQ-t1-YfQ"/>
|
||||
<constraint firstItem="FoE-i9-Rfb" firstAttribute="trailing" secondItem="sRP-xs-alR" secondAttribute="trailing" id="5DW-3A-T38"/>
|
||||
<constraint firstAttribute="trailing" secondItem="DiD-K0-Y43" secondAttribute="trailing" constant="28" id="5Ss-aV-lwl"/>
|
||||
<constraint firstAttribute="trailing" secondItem="wCp-nB-dda" secondAttribute="trailing" constant="25" id="8Sj-oS-ug5"/>
|
||||
<constraint firstItem="ayu-Tb-kmf" firstAttribute="centerX" secondItem="6MD-Ry-R5P" secondAttribute="centerX" id="9JX-AU-p9u"/>
|
||||
<constraint firstItem="sRP-xs-alR" firstAttribute="leading" secondItem="e3S-m6-k5Y" secondAttribute="trailing" constant="8" symbolic="YES" id="9Ln-JB-XKl"/>
|
||||
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="trailing" secondItem="eoD-7r-Q85" secondAttribute="trailing" id="Ddi-cI-3P7"/>
|
||||
<constraint firstItem="Wsf-gl-dkY" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="92" id="Drm-DE-zR4"/>
|
||||
<constraint firstItem="DiD-K0-Y43" firstAttribute="leading" secondItem="qVQ-tJ-cO6" secondAttribute="leading" id="FEU-T2-r8S"/>
|
||||
<constraint firstItem="xWv-tc-lQe" firstAttribute="leading" secondItem="S5h-Xx-HUG" secondAttribute="leading" id="HDG-YV-pnR"/>
|
||||
<constraint firstItem="I4a-N9-Tkv" firstAttribute="top" secondItem="ayu-Tb-kmf" secondAttribute="bottom" constant="8" symbolic="YES" id="IFN-Y7-dx7"/>
|
||||
<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="ayu-Tb-kmf" secondAttribute="trailing" constant="34" id="LVk-Xo-yXp"/>
|
||||
<constraint firstItem="sRP-xs-alR" firstAttribute="centerY" secondItem="eoD-7r-Q85" secondAttribute="centerY" id="Li6-iE-6AU"/>
|
||||
<constraint firstItem="6MD-Ry-R5P" firstAttribute="top" secondItem="I4a-N9-Tkv" secondAttribute="bottom" constant="8" symbolic="YES" id="M7l-Nl-fbE"/>
|
||||
<constraint firstItem="sRP-xs-alR" firstAttribute="top" secondItem="FoE-i9-Rfb" secondAttribute="bottom" constant="10" symbolic="YES" id="Nf3-lQ-J7p"/>
|
||||
<constraint firstItem="FoE-i9-Rfb" firstAttribute="leading" secondItem="Wsf-gl-dkY" secondAttribute="trailing" constant="8" symbolic="YES" id="Q1J-Od-oEq"/>
|
||||
<constraint firstItem="S5h-Xx-HUG" firstAttribute="leading" secondItem="e3S-m6-k5Y" secondAttribute="leading" id="Rp8-TE-LBs"/>
|
||||
<constraint firstItem="wCp-nB-dda" firstAttribute="centerX" secondItem="JBW-8M-eHP" secondAttribute="centerX" id="Uf5-d8-VAG"/>
|
||||
<constraint firstItem="ayu-Tb-kmf" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="41" id="Ujd-dM-d4B"/>
|
||||
<constraint firstItem="qVQ-tJ-cO6" firstAttribute="top" secondItem="DiD-K0-Y43" secondAttribute="bottom" constant="6" symbolic="YES" id="WUJ-KS-sHp"/>
|
||||
<constraint firstItem="xWv-tc-lQe" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="29" id="WsH-Rq-EQo"/>
|
||||
<constraint firstItem="I4a-N9-Tkv" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="54" id="Y5c-vH-Bvw"/>
|
||||
<constraint firstItem="XQ5-fw-o8t" firstAttribute="top" secondItem="Q2L-Fh-TW1" secondAttribute="bottom" constant="10" symbolic="YES" id="YJa-4z-USU"/>
|
||||
<constraint firstItem="e3S-m6-k5Y" firstAttribute="baseline" secondItem="eoD-7r-Q85" secondAttribute="baseline" id="Yfx-Hf-red"/>
|
||||
<constraint firstItem="XQ5-fw-o8t" firstAttribute="leading" secondItem="S5h-Xx-HUG" secondAttribute="trailing" constant="8" symbolic="YES" id="ZSX-Wf-s3b"/>
|
||||
<constraint firstItem="sRP-xs-alR" firstAttribute="leading" secondItem="DiD-K0-Y43" secondAttribute="leading" id="cP0-4c-2tD"/>
|
||||
<constraint firstItem="xWv-tc-lQe" firstAttribute="baseline" secondItem="Q2L-Fh-TW1" secondAttribute="baseline" id="cjH-5Y-BPd"/>
|
||||
<constraint firstItem="I4a-N9-Tkv" firstAttribute="leading" secondItem="6MD-Ry-R5P" secondAttribute="leading" id="fGN-nB-Tp7"/>
|
||||
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="top" secondItem="JBW-8M-eHP" secondAttribute="bottom" constant="8" symbolic="YES" id="fIf-uU-Dis"/>
|
||||
<constraint firstItem="Wsf-gl-dkY" firstAttribute="centerY" secondItem="FoE-i9-Rfb" secondAttribute="centerY" id="fSm-ZO-WGT"/>
|
||||
<constraint firstItem="DiD-K0-Y43" firstAttribute="trailing" secondItem="qVQ-tJ-cO6" secondAttribute="trailing" id="i1K-yN-yvs"/>
|
||||
<constraint firstItem="S5h-Xx-HUG" firstAttribute="centerY" secondItem="XQ5-fw-o8t" secondAttribute="centerY" id="iv1-8j-dpK"/>
|
||||
<constraint firstItem="Q2L-Fh-TW1" firstAttribute="leading" secondItem="XQ5-fw-o8t" secondAttribute="leading" id="m95-qm-v0W"/>
|
||||
<constraint firstItem="XQ5-fw-o8t" firstAttribute="leading" secondItem="FoE-i9-Rfb" secondAttribute="leading" id="q1D-Uw-c6k"/>
|
||||
<constraint firstItem="JBW-8M-eHP" firstAttribute="top" secondItem="wCp-nB-dda" secondAttribute="bottom" constant="8" symbolic="YES" id="r2h-9S-EeW"/>
|
||||
<constraint firstItem="JBW-8M-eHP" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="36" id="si5-nv-pTq"/>
|
||||
<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>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="346" y="328"/>
|
||||
<point key="canvasLocation" x="346" y="292.5"/>
|
||||
</window>
|
||||
<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"/>
|
||||
|
||||
@@ -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">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<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">
|
||||
<rect key="frame" x="0.0" y="0.0" width="209" height="197"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
@@ -60,7 +60,11 @@
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<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>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lD1-xm-Qy3">
|
||||
@@ -71,7 +75,11 @@
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<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"/>
|
||||
</connections>
|
||||
</textField>
|
||||
|
||||
@@ -79,13 +79,13 @@
|
||||
</connections>
|
||||
</menuItem>
|
||||
<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"/>
|
||||
<connections>
|
||||
<action selector="showRunningMode:" target="Voe-Tx-rLC" id="PxO-ut-PEx"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Advance Proxy Preference..." id="sbx-yz-3lO">
|
||||
<menuItem title="Advanced Proxy Preferences..." id="sbx-yz-3lO">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="editProxyPreferences:" target="Voe-Tx-rLC" id="Jji-Ea-Sy8"/>
|
||||
@@ -120,13 +120,13 @@
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Advance Preference ..." id="bZ3-fy-34d">
|
||||
<menuItem title="Advanced Preferences ..." id="bZ3-fy-34d">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="editAdvPreferences:" target="Voe-Tx-rLC" id="mEF-XS-HJE"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="HTTP Proxy Preference ..." id="uEp-Gz-cu0">
|
||||
<menuItem title="HTTP Proxy Preferences ..." id="uEp-Gz-cu0">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="editHTTPPreferences:" target="Voe-Tx-rLC" id="tkC-e3-PH9"/>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</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">
|
||||
<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"/>
|
||||
<rect key="contentRect" x="503" y="308" width="298" height="311"/>
|
||||
<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"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<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"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.3</string>
|
||||
<string>1.3.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
||||
@@ -14,14 +14,12 @@
|
||||
|
||||
+ (void)install;
|
||||
|
||||
+ (void)enablePACProxy:(NSString*) PACFilePath;
|
||||
+ (void)enablePACProxy;
|
||||
|
||||
+ (void)enableGlobalProxy;
|
||||
|
||||
+ (void)disableProxy:(NSString*) PACFilePath;
|
||||
+ (void)disableProxy;
|
||||
|
||||
+ (NSString*)startPACServer:(NSString*) PACFilePath;
|
||||
|
||||
+ (void)stopPACServer;
|
||||
+ (void)startMonitorPAC;
|
||||
|
||||
@end
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
@implementation ProxyConfHelper
|
||||
|
||||
GCDWebServer *webServer =nil;
|
||||
FSEventStreamRef fsEventStream;
|
||||
|
||||
+ (BOOL)isVersionOk {
|
||||
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
|
||||
//next two lines can open gcdwebserver and work around pac file
|
||||
NSString *PACURLString = [self startPACServer: PACFilePath];//hi 可以切换成定制pac文件路径来达成使用定制文件路径
|
||||
NSURL* url = [NSURL URLWithString: PACURLString];
|
||||
// NSString* urlString = [NSString stringWithFormat:@"%@/.ShadowsocksX-NG/gfwlist.js", NSHomeDirectory()];
|
||||
// NSURL* url = [NSURL fileURLWithPath:urlString];
|
||||
|
||||
NSString* PACFilePath = [self getPACFilePath];
|
||||
[self startPACServer: PACFilePath];
|
||||
|
||||
NSURL* url = [NSURL URLWithString: [self getHttpPACUrl]];
|
||||
|
||||
NSMutableArray* args = [@[@"--mode", @"auto", @"--pac-url", [url absoluteString]]mutableCopy];
|
||||
|
||||
[self addArguments4ManualSpecifyNetworkServices:args];
|
||||
@@ -134,24 +139,23 @@ GCDWebServer *webServer =nil;
|
||||
NSMutableArray* args = [@[@"--mode", @"global", @"--port"
|
||||
, [NSString stringWithFormat:@"%lu", (unsigned long)port]]mutableCopy];
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTPOn"] && [[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTP.FollowGlobel"]) {
|
||||
NSUInteger privoxyPort = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalHTTP.ListenPort"];
|
||||
|
||||
[args addObject:@"--privoxy-port"];
|
||||
[args addObject:[NSString stringWithFormat:@"%lu", (unsigned long)privoxyPort]];
|
||||
}
|
||||
// Because issue #106 https://github.com/shadowsocks/ShadowsocksX-NG/issues/106
|
||||
// Comment below out.
|
||||
// if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTPOn"] && [[NSUserDefaults standardUserDefaults] boolForKey:@"LocalHTTP.FollowGlobel"]) {
|
||||
// NSUInteger privoxyPort = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalHTTP.ListenPort"];
|
||||
//
|
||||
// [args addObject:@"--privoxy-port"];
|
||||
// [args addObject:[NSString stringWithFormat:@"%lu", (unsigned long)privoxyPort]];
|
||||
// }
|
||||
|
||||
[self addArguments4ManualSpecifyNetworkServices:args];
|
||||
[self callHelper:args];
|
||||
[self stopPACServer];
|
||||
}
|
||||
|
||||
+ (void)disableProxy:(NSString*) PACFilePath {
|
||||
// 带上所有参数是为了判断是否原有代理设置是否由ssx-ng设置的。如果是用户手工设置的其他配置,则不进行清空。
|
||||
// NSString* urlString = [NSString stringWithFormat:@"%@/.ShadowsocksX-NG/gfwlist.js", NSHomeDirectory()];
|
||||
// NSURL* url = [NSURL fileURLWithPath:urlString];
|
||||
NSString *PACURLString = [self startPACServer: PACFilePath];//hi 可以切换成定制pac文件路径来达成使用定制文件路径
|
||||
NSURL* url = [NSURL URLWithString: PACURLString];
|
||||
+ (void)disableProxy {
|
||||
// 带上所有参数是为了判断是否原有代理设置是否由ssx-ng设置的。如果是用户手工设置的其他配置,则不进行清空。
|
||||
NSURL* url = [NSURL URLWithString: [self getHttpPACUrl]];
|
||||
NSUInteger port = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalSocks5.ListenPort"];
|
||||
|
||||
NSMutableArray* args = [@[@"--mode", @"off"
|
||||
@@ -163,28 +167,41 @@ GCDWebServer *webServer =nil;
|
||||
[self stopPACServer];
|
||||
}
|
||||
|
||||
+ (NSString*)startPACServer:(NSString*) PACFilePath {
|
||||
//接受参数为以后使用定制PAC文件
|
||||
NSData * originalPACData;
|
||||
+ (NSString*)getHttpPACUrl {
|
||||
NSString * routerPath = @"/proxy.pac";
|
||||
if ([PACFilePath isEqual: @"hi"]) {//用默认路径来代替
|
||||
PACFilePath = [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @".ShadowsocksX-NG/gfwlist.js"];
|
||||
originalPACData = [NSData dataWithContentsOfFile: [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @".ShadowsocksX-NG/gfwlist.js"]];
|
||||
}else{//用定制路径来代替
|
||||
originalPACData = [NSData dataWithContentsOfFile: [NSString stringWithFormat:@"%@/%@/%@", NSHomeDirectory(), @".ShadowsocksX-NG", PACFilePath]];
|
||||
routerPath = [NSString stringWithFormat:@"/%@",PACFilePath];
|
||||
}
|
||||
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSString * address = @"127.0.0.1";
|
||||
int port = (short)[defaults integerForKey:@"PacServer.ListenPort"];
|
||||
|
||||
return [NSString stringWithFormat:@"%@%@:%d%@",@"http://",address,port,routerPath];
|
||||
}
|
||||
|
||||
+ (void)startPACServer:(NSString*) PACFilePath {
|
||||
[self stopPACServer];
|
||||
|
||||
NSString * routerPath = @"/proxy.pac";
|
||||
|
||||
NSData* originalPACData = [NSData dataWithContentsOfFile:PACFilePath];
|
||||
|
||||
webServer = [[GCDWebServer alloc] init];
|
||||
[webServer addHandlerForMethod:@"GET" path:routerPath requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest *request) {
|
||||
return [GCDWebServerDataResponse responseWithData: originalPACData contentType:@"application/x-ns-proxy-autoconfig"];
|
||||
[webServer addHandlerForMethod:@"GET"
|
||||
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];
|
||||
NSString * address = [defaults stringForKey:@"PacServer.ListenAddress"];
|
||||
|
||||
int port = (short)[defaults integerForKey:@"PacServer.ListenPort"];
|
||||
|
||||
[webServer startWithOptions:@{@"BindToLocalhost":@YES, @"Port":@(port)} error:nil];
|
||||
return [NSString stringWithFormat:@"%@%@:%d%@",@"http://",address,port,routerPath];
|
||||
}
|
||||
|
||||
+ (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
|
||||
|
||||
@@ -37,7 +37,7 @@ class ProxyPreferencesController: NSWindowController, NSTableViewDataSource, NST
|
||||
}
|
||||
|
||||
@IBAction func ok(_ sender: NSObject){
|
||||
ProxyConfHelper.disableProxy("hi")
|
||||
ProxyConfHelper.disableProxy()
|
||||
|
||||
let defaults = UserDefaults.standard
|
||||
defaults.setValue(selectedNetworkServices.allObjects, forKeyPath: "Proxy4NetworkServices")
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#import <Cocoa/Cocoa.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, weak) NSImageView *imageView;
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "SWBQRCodeWindowController.h"
|
||||
@import CoreImage;
|
||||
|
||||
@interface SWBQRCodeWindowController ()
|
||||
|
||||
@@ -18,18 +19,56 @@
|
||||
[super windowDidLoad];
|
||||
|
||||
// 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.webView.frameLoadDelegate = self;
|
||||
[self setQRCode:self.qrCode];
|
||||
}
|
||||
|
||||
-(void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
|
||||
if (self.qrCode) {
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"genCode('%@')", _qrCode]];
|
||||
}
|
||||
- (void)setQRCode:(NSString*) qrCode {
|
||||
CGImageRef cgImgRef = [self createQRImageForString:qrCode size:CGSizeMake(250, 250)];
|
||||
|
||||
NSImage *image = [[NSImage alloc]initWithCGImage:cgImgRef size:CGSizeMake(250, 250)];
|
||||
self.imageView.image = image;
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
self.webView.frameLoadDelegate = nil;
|
||||
- (CGImageRef)createQRImageForString:(NSString *)string size:(CGSize)size {
|
||||
// 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
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
|
||||
<plugIn identifier="com.apple.WebKitIBPlugin" version="10117"/>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SWBQRCodeWindowController">
|
||||
<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"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
@@ -16,24 +16,17 @@
|
||||
<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"/>
|
||||
<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">
|
||||
<rect key="frame" x="0.0" y="0.0" width="250" height="250"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<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"/>
|
||||
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12">
|
||||
<nil key="identifier"/>
|
||||
</webPreferences>
|
||||
</webView>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="iAJ-tw-LNU"/>
|
||||
</imageView>
|
||||
</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>
|
||||
</window>
|
||||
</objects>
|
||||
|
||||
Vendored
-2
File diff suppressed because one or more lines are too long
@@ -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>
|
||||
Vendored
-1
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" = "高级代理设置";
|
||||
|
||||
/* Class = "NSButtonCell"; title = "Auto Configure"; ObjectID = "FLv-D9-CRw"; */
|
||||
|
||||
Reference in New Issue
Block a user