mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-10-20 06:24:32 +00:00
Merge remote-tracking branch 'qiuyuzhou/develop' into develop
This commit is contained in:
@@ -52,6 +52,8 @@
|
||||
9BEEF0751D04EF3E00FC52B3 /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BEEF0731D04EF3E00FC52B3 /* PreferencesWindowController.swift */; };
|
||||
9BEEF0781D04FE8A00FC52B3 /* LaunchAgentUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BEEF0771D04FE8A00FC52B3 /* LaunchAgentUtils.swift */; };
|
||||
9BEEF07B1D05631500FC52B3 /* AdvPreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BEEF0791D05631500FC52B3 /* AdvPreferencesWindowController.swift */; };
|
||||
C8E42A6C1D4F270A0074C7EA /* UserRulesController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E42A6A1D4F270A0074C7EA /* UserRulesController.swift */; };
|
||||
C8E42A6E1D4F2CAF0074C7EA /* UserRulesController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C8E42A701D4F2CAF0074C7EA /* UserRulesController.xib */; };
|
||||
E0E57CCA7EB34B90F9D340F2 /* Pods_ShadowsocksX_NGTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 388120F062D7EB7DD0D8DDCA /* Pods_ShadowsocksX_NGTests.framework */; };
|
||||
F0809FF1595BE2966343D3C7 /* libPods-proxy_conf_helper.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E7783AEDB4A3BDDC9FF16AC /* libPods-proxy_conf_helper.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
@@ -159,6 +161,9 @@
|
||||
9BEEF0771D04FE8A00FC52B3 /* LaunchAgentUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LaunchAgentUtils.swift; sourceTree = "<group>"; };
|
||||
9BEEF0791D05631500FC52B3 /* AdvPreferencesWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvPreferencesWindowController.swift; sourceTree = "<group>"; };
|
||||
B4E6A97CA843F3943524B686 /* Pods-proxy_conf_helper.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-proxy_conf_helper.debug.xcconfig"; path = "Pods/Target Support Files/Pods-proxy_conf_helper/Pods-proxy_conf_helper.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
C8E42A6A1D4F270A0074C7EA /* UserRulesController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserRulesController.swift; sourceTree = "<group>"; };
|
||||
C8E42A6F1D4F2CAF0074C7EA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/UserRulesController.xib; sourceTree = "<group>"; };
|
||||
C8E42A721D4F2CB10074C7EA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/UserRulesController.strings"; sourceTree = "<group>"; };
|
||||
E9E9FB3855DA55D0710EE7BD /* Pods-ShadowsocksX-NG.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShadowsocksX-NG.release.xcconfig"; path = "Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG.release.xcconfig"; sourceTree = "<group>"; };
|
||||
FE3237E9FB24D9B924A0E630 /* Pods-ShadowsocksX-NG.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShadowsocksX-NG.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@@ -307,6 +312,8 @@
|
||||
9B2491B91D0ACC3E003BBECC /* AdvPreferencesWindowController.xib */,
|
||||
9BA04B241D24044D005AAD7F /* ProxyPreferencesController.swift */,
|
||||
9B0D55481D2CC85400A4A8E2 /* ProxyPreferencesController.xib */,
|
||||
C8E42A6A1D4F270A0074C7EA /* UserRulesController.swift */,
|
||||
C8E42A701D4F2CAF0074C7EA /* UserRulesController.xib */,
|
||||
);
|
||||
name = UI;
|
||||
sourceTree = "<group>";
|
||||
@@ -450,6 +457,7 @@
|
||||
9B0D55461D2CC85400A4A8E2 /* ProxyPreferencesController.xib in Resources */,
|
||||
9B2491B41D0ACC3A003BBECC /* PreferencesWindowController.xib in Resources */,
|
||||
9B3FFF291D08A1DF0019A709 /* user-rule.txt 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 */,
|
||||
@@ -625,6 +633,7 @@
|
||||
9B0BFFE91D0460A70040E62B /* AppDelegate.swift in Sources */,
|
||||
9BA04B231D23D5A5005AAD7F /* ProxyConfTool.m in Sources */,
|
||||
9BEEF0781D04FE8A00FC52B3 /* LaunchAgentUtils.swift in Sources */,
|
||||
C8E42A6C1D4F270A0074C7EA /* UserRulesController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -705,6 +714,15 @@
|
||||
name = AdvPreferencesWindowController.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C8E42A701D4F2CAF0074C7EA /* UserRulesController.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
C8E42A6F1D4F2CAF0074C7EA /* Base */,
|
||||
C8E42A721D4F2CB10074C7EA /* zh-Hans */,
|
||||
);
|
||||
name = UserRulesController.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
|
||||
@@ -16,7 +16,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
var preferencesWinCtrl: PreferencesWindowController!
|
||||
var advPreferencesWinCtrl: AdvPreferencesWindowController!
|
||||
var proxyPreferencesWinCtrl: ProxyPreferencesController!
|
||||
|
||||
var editUserRulesWinCtrl: UserRulesController!
|
||||
|
||||
var launchAtLoginController: LaunchAtLoginController = LaunchAtLoginController()
|
||||
|
||||
@IBOutlet weak var window: NSWindow!
|
||||
@@ -181,23 +182,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
}
|
||||
|
||||
@IBAction func editUserRulesForPAC(sender: NSMenuItem) {
|
||||
let url = NSURL(fileURLWithPath: PACUserRuleFilePath)
|
||||
NSWorkspace.sharedWorkspace().openURL(url)
|
||||
}
|
||||
|
||||
@IBAction func applyUserRulesForPAC(sender: NSMenuItem) {
|
||||
if GeneratePACFile() {
|
||||
// Popup a user notification
|
||||
let notification = NSUserNotification()
|
||||
notification.title = "PAC has been updated by User Rules.".localized
|
||||
NSUserNotificationCenter.defaultUserNotificationCenter()
|
||||
.deliverNotification(notification)
|
||||
} else {
|
||||
let notification = NSUserNotification()
|
||||
notification.title = "It's failed to update PAC by User Rules.".localized
|
||||
NSUserNotificationCenter.defaultUserNotificationCenter()
|
||||
.deliverNotification(notification)
|
||||
if editUserRulesWinCtrl != nil {
|
||||
editUserRulesWinCtrl.close()
|
||||
}
|
||||
let ctrl = UserRulesController(windowNibName: "UserRulesController")
|
||||
editUserRulesWinCtrl = ctrl
|
||||
|
||||
ctrl.showWindow(self)
|
||||
NSApp.activateIgnoringOtherApps(true)
|
||||
ctrl.window?.makeKeyAndOrderFront(self)
|
||||
}
|
||||
|
||||
@IBAction func showQRCodeForCurrentServer(sender: NSMenuItem) {
|
||||
|
||||
@@ -76,12 +76,6 @@
|
||||
<action selector="editUserRulesForPAC:" target="Voe-Tx-rLC" id="ZtK-2d-Pcl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Apply User Rules For PAC" id="6qf-cg-HXc">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="applyUserRulesForPAC:" target="Voe-Tx-rLC" id="iAp-Ae-0zV"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="bMX-qn-Qwi"/>
|
||||
<menuItem title="Advance Proxy Preference..." id="sbx-yz-3lO">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
|
||||
<capability name="box content view" minToolsVersion="7.0"/>
|
||||
@@ -24,16 +24,16 @@
|
||||
<window title="Server Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="423" y="365" width="544" height="330"/>
|
||||
<rect key="contentRect" x="423" y="365" width="590" height="330"/>
|
||||
<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="544" height="330"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="590" height="330"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<scrollView focusRingType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u4U-Ju-FJV">
|
||||
<rect key="frame" x="20" y="80" width="165" height="230"/>
|
||||
<rect key="frame" x="20" y="80" width="223" height="230"/>
|
||||
<clipView key="contentView" focusRingType="none" id="1oC-7s-16v">
|
||||
<rect key="frame" x="1" y="1" width="163" height="228"/>
|
||||
<rect key="frame" x="1" y="1" width="221" height="228"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" id="r91-ho-Lum">
|
||||
@@ -84,7 +84,7 @@
|
||||
</scroller>
|
||||
</scrollView>
|
||||
<box borderType="line" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="oZ5-85-pwY">
|
||||
<rect key="frame" x="202" y="57" width="325" height="255"/>
|
||||
<rect key="frame" x="248" y="57" width="325" height="255"/>
|
||||
<view key="contentView" id="a3z-VL-3xV">
|
||||
<rect key="frame" x="1" y="1" width="323" height="253"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
@@ -241,39 +241,10 @@
|
||||
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
|
||||
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</box>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yyD-qq-aSk">
|
||||
<rect key="frame" x="449" y="13" width="81" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="69" id="GvX-GM-8n5"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="zPE-oD-PwK">
|
||||
<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="ifI-e4-Htf"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kGm-Zm-ipY">
|
||||
<rect key="frame" x="368" y="13" width="81" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="69" id="7s5-Pr-Tlv"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="push" title="Cacnel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="j03-9E-uHW">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="cancel:" target="-2" id="514-4D-a6S"/>
|
||||
</connections>
|
||||
</button>
|
||||
<box title="Box" boxType="custom" borderType="none" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="Gqv-5O-Wwf">
|
||||
<rect key="frame" x="20" y="61" width="165" height="19"/>
|
||||
<rect key="frame" x="20" y="61" width="223" height="19"/>
|
||||
<view key="contentView" id="MbP-FS-YEs">
|
||||
<rect key="frame" x="0.0" y="0.0" width="165" height="19"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="223" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4ig-lF-m2R">
|
||||
@@ -313,30 +284,59 @@ DQ
|
||||
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
|
||||
<color key="fillColor" red="1" green="1" blue="1" alpha="0.59999999999999998" colorSpace="calibratedRGB"/>
|
||||
</box>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yyD-qq-aSk">
|
||||
<rect key="frame" x="495" y="13" width="81" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="69" id="uKT-xu-yvV"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="zPE-oD-PwK">
|
||||
<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="ifI-e4-Htf"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kGm-Zm-ipY">
|
||||
<rect key="frame" x="414" y="13" width="81" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="69" id="s2I-cF-RJc"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="push" title="Cacnel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="j03-9E-uHW">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="cancel:" target="-2" id="514-4D-a6S"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="leading" secondItem="Gqv-5O-Wwf" secondAttribute="leading" id="00T-SU-dGV"/>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="trailing" secondItem="Gqv-5O-Wwf" secondAttribute="trailing" id="1d8-Yd-ErO"/>
|
||||
<constraint firstAttribute="trailing" secondItem="oZ5-85-pwY" secondAttribute="trailing" constant="20" symbolic="YES" id="6n4-pw-ssp"/>
|
||||
<constraint firstItem="oZ5-85-pwY" firstAttribute="trailing" secondItem="yyD-qq-aSk" secondAttribute="trailing" id="9rk-Gp-QMb"/>
|
||||
<constraint firstItem="kGm-Zm-ipY" firstAttribute="baseline" secondItem="yyD-qq-aSk" secondAttribute="baseline" id="DUP-eE-HPu"/>
|
||||
<constraint firstItem="yyD-qq-aSk" firstAttribute="leading" secondItem="kGm-Zm-ipY" secondAttribute="trailing" constant="12" symbolic="YES" id="E8m-6c-pKH"/>
|
||||
<constraint firstItem="Gqv-5O-Wwf" firstAttribute="bottom" secondItem="oZ5-85-pwY" secondAttribute="bottom" id="RCW-Hm-rKr"/>
|
||||
<constraint firstItem="oZ5-85-pwY" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="205" id="SqM-gs-OUV"/>
|
||||
<constraint firstItem="oZ5-85-pwY" firstAttribute="leading" secondItem="Gqv-5O-Wwf" secondAttribute="trailing" constant="20" symbolic="YES" id="UMl-Hs-ZsE"/>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="Uds-5g-kRr"/>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="top" secondItem="oZ5-85-pwY" secondAttribute="top" id="VFr-Bp-q4w"/>
|
||||
<constraint firstItem="Gqv-5O-Wwf" firstAttribute="top" secondItem="u4U-Ju-FJV" secondAttribute="bottom" id="aVt-un-Nac"/>
|
||||
<constraint firstItem="kGm-Zm-ipY" firstAttribute="top" secondItem="oZ5-85-pwY" secondAttribute="bottom" constant="20" symbolic="YES" id="fEN-vq-93f"/>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" symbolic="YES" id="mxl-v4-OJS"/>
|
||||
<constraint firstItem="Gqv-5O-Wwf" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="250" id="xor-Fa-hnd"/>
|
||||
<constraint firstAttribute="bottom" secondItem="kGm-Zm-ipY" secondAttribute="bottom" constant="20" symbolic="YES" id="xy9-yv-p9u"/>
|
||||
<constraint firstItem="oZ5-85-pwY" firstAttribute="leading" secondItem="u4U-Ju-FJV" secondAttribute="trailing" constant="8" symbolic="YES" id="C6R-wI-MlZ"/>
|
||||
<constraint firstItem="kGm-Zm-ipY" firstAttribute="baseline" secondItem="yyD-qq-aSk" secondAttribute="baseline" id="CYq-KM-MIh"/>
|
||||
<constraint firstItem="yyD-qq-aSk" firstAttribute="leading" secondItem="kGm-Zm-ipY" secondAttribute="trailing" constant="12" symbolic="YES" id="EGq-gP-YUt"/>
|
||||
<constraint firstAttribute="bottom" secondItem="kGm-Zm-ipY" secondAttribute="bottom" constant="20" symbolic="YES" id="FYH-8M-te7"/>
|
||||
<constraint firstItem="oZ5-85-pwY" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="251" id="JxK-S6-yOS"/>
|
||||
<constraint firstItem="Gqv-5O-Wwf" firstAttribute="top" secondItem="u4U-Ju-FJV" secondAttribute="bottom" id="LJq-QU-Vhw"/>
|
||||
<constraint firstItem="Gqv-5O-Wwf" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="250" id="PxF-wu-Hfs"/>
|
||||
<constraint firstAttribute="trailing" secondItem="oZ5-85-pwY" secondAttribute="trailing" constant="20" symbolic="YES" id="RnM-Z9-kYW"/>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="top" secondItem="oZ5-85-pwY" secondAttribute="top" id="YHq-MK-f01"/>
|
||||
<constraint firstItem="Gqv-5O-Wwf" firstAttribute="bottom" secondItem="oZ5-85-pwY" secondAttribute="bottom" id="Z3L-Aj-b7H"/>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" symbolic="YES" id="bVO-t4-Ptw"/>
|
||||
<constraint firstItem="kGm-Zm-ipY" firstAttribute="top" secondItem="oZ5-85-pwY" secondAttribute="bottom" constant="20" symbolic="YES" id="bxj-ww-w1a"/>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="f6j-0J-c14"/>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="trailing" secondItem="Gqv-5O-Wwf" secondAttribute="trailing" id="kGk-iB-pW3"/>
|
||||
<constraint firstItem="yyD-qq-aSk" firstAttribute="trailing" secondItem="oZ5-85-pwY" secondAttribute="trailing" id="nGi-Tj-4Ev"/>
|
||||
<constraint firstItem="u4U-Ju-FJV" firstAttribute="leading" secondItem="Gqv-5O-Wwf" secondAttribute="leading" id="oo8-zB-YmU"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="391" y="222"/>
|
||||
<point key="canvasLocation" x="412" 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="1"/>
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<?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" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="UserRulesController" customModule="ShadowsocksX_NG" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="didCancel" destination="2bi-hW-nd9" id="wKx-Nb-7Kt"/>
|
||||
<outlet property="userRulesView" destination="4yV-hS-knY" id="HF3-TH-oBY"/>
|
||||
<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="User Rules" 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="196" y="240" width="480" height="270"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
|
||||
<view key="contentView" id="se5-gp-TjO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="N2T-OG-SO9">
|
||||
<rect key="frame" x="385" y="13" width="81" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="0Sc-cm-Vyu">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
DQ
|
||||
</string>
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="didOK:" target="-2" id="216-18-SFI"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2bi-hW-nd9">
|
||||
<rect key="frame" x="304" y="13" width="81" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="QAR-9i-kmv">
|
||||
<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="didCancel:" target="-2" id="SFh-eD-YLV"/>
|
||||
</connections>
|
||||
</button>
|
||||
<scrollView fixedFrame="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="J3L-MK-p8I">
|
||||
<rect key="frame" x="20" y="61" width="440" height="189"/>
|
||||
<clipView key="contentView" ambiguous="YES" id="fO6-Dc-ZUL">
|
||||
<rect key="frame" x="1" y="1" width="423" height="187"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textView ambiguous="YES" importsGraphics="NO" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" usesFontPanel="YES" verticallyResizable="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"/>
|
||||
<size key="minSize" width="423" height="187"/>
|
||||
<size key="maxSize" width="463" height="10000000"/>
|
||||
<color key="insertionPointColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<size key="minSize" width="423" height="187"/>
|
||||
<size key="maxSize" width="463" height="10000000"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</clipView>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="z0Z-PW-muW">
|
||||
<rect key="frame" x="-100" y="-100" width="87" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" verticalHuggingPriority="750" horizontal="NO" id="Us9-yx-gj4">
|
||||
<rect key="frame" x="424" y="1" width="15" height="187"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
</scrollView>
|
||||
</subviews>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="343" y="474"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -26,7 +26,14 @@ func getFileSHA1Sum(filepath: String) -> String {
|
||||
func generateSSLocalLauchAgentPlist() -> Bool {
|
||||
let sslocalPath = NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local"
|
||||
let logFilePath = NSHomeDirectory() + "/Library/Logs/ss-local.log"
|
||||
let plistFilepath = NSHomeDirectory() + LAUNCH_AGENT_DIR + LAUNCH_AGENT_CONF_NAME
|
||||
let launchAgentDirPath = NSHomeDirectory() + LAUNCH_AGENT_DIR
|
||||
let plistFilepath = launchAgentDirPath + LAUNCH_AGENT_CONF_NAME
|
||||
|
||||
// Ensure launch agent directory is existed.
|
||||
let fileMgr = NSFileManager.defaultManager()
|
||||
if !fileMgr.fileExistsAtPath(launchAgentDirPath) {
|
||||
try! fileMgr.createDirectoryAtPath(launchAgentDirPath, withIntermediateDirectories: true, attributes: nil)
|
||||
}
|
||||
|
||||
let oldSha1Sum = getFileSHA1Sum(plistFilepath)
|
||||
|
||||
|
||||
@@ -136,7 +136,15 @@
|
||||
}
|
||||
|
||||
+ (void)disableProxy {
|
||||
NSMutableArray* args = [@[@"--mode", @"off"]mutableCopy];
|
||||
// 带上所有参数是为了判断是否原有代理设置是否由ssx-ng设置的。如果是用户手工设置的其他配置,则不进行清空。
|
||||
NSString* urlString = [NSString stringWithFormat:@"%@/.ShadowsocksX-NG/gfwlist.js", NSHomeDirectory()];
|
||||
NSURL* url = [NSURL fileURLWithPath:urlString];
|
||||
NSUInteger port = [[NSUserDefaults standardUserDefaults]integerForKey:@"LocalSocks5.ListenPort"];
|
||||
|
||||
NSMutableArray* args = [@[@"--mode", @"off"
|
||||
, @"--port", [NSString stringWithFormat:@"%lu", (unsigned long)port]
|
||||
, @"--pac-url", [url absoluteString]
|
||||
]mutableCopy];
|
||||
[self addArguments4ManualSpecifyNetworkServices:args];
|
||||
[self callHelper:args];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// UserRulesController.swift
|
||||
// ShadowsocksX-NG
|
||||
//
|
||||
// Created by 周斌佳 on 16/8/1.
|
||||
// Copyright © 2016年 qiuyuzhou. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class UserRulesController: NSWindowController {
|
||||
|
||||
@IBOutlet var userRulesView: NSTextView!
|
||||
|
||||
override func windowDidLoad() {
|
||||
super.windowDidLoad()
|
||||
|
||||
let fileMgr = NSFileManager.defaultManager()
|
||||
if !fileMgr.fileExistsAtPath(PACUserRuleFilePath) {
|
||||
let src = NSBundle.mainBundle().pathForResource("user-rule", ofType: "txt")
|
||||
try! fileMgr.copyItemAtPath(src!, toPath: PACUserRuleFilePath)
|
||||
}
|
||||
|
||||
let str = try? String(contentsOfFile: PACUserRuleFilePath, encoding: NSUTF8StringEncoding)
|
||||
userRulesView.string = str
|
||||
}
|
||||
|
||||
@IBAction func didCancel(sender: AnyObject) {
|
||||
window?.performClose(self)
|
||||
}
|
||||
|
||||
@IBAction func didOK(sender: AnyObject) {
|
||||
if let str = userRulesView.string {
|
||||
do {
|
||||
try str.dataUsingEncoding(NSUTF8StringEncoding)?.writeToFile(PACUserRuleFilePath, options: .DataWritingAtomic)
|
||||
|
||||
if GeneratePACFile() {
|
||||
// Popup a user notification
|
||||
let notification = NSUserNotification()
|
||||
notification.title = "PAC has been updated by User Rules.".localized
|
||||
NSUserNotificationCenter.defaultUserNotificationCenter()
|
||||
.deliverNotification(notification)
|
||||
} else {
|
||||
let notification = NSUserNotification()
|
||||
notification.title = "It's failed to update PAC by User Rules.".localized
|
||||
NSUserNotificationCenter.defaultUserNotificationCenter()
|
||||
.deliverNotification(notification)
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
window?.performClose(self)
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,6 @@
|
||||
#ifndef proxy_conf_helper_version_h
|
||||
#define proxy_conf_helper_version_h
|
||||
|
||||
#define kProxyConfHelperVersion @"1.2.0"
|
||||
#define kProxyConfHelperVersion @"1.3.1"
|
||||
|
||||
#endif /* proxy_conf_helper_version_h */
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
/* Class = "NSButtonCell"; title = "OK"; ObjectID = "0Sc-cm-Vyu"; */
|
||||
"0Sc-cm-Vyu.title" = "确定";
|
||||
|
||||
/* Class = "NSWindow"; title = "User Rules"; ObjectID = "F0z-JX-Cv5"; */
|
||||
"F0z-JX-Cv5.title" = "用户规则";
|
||||
|
||||
/* Class = "NSButtonCell"; title = "Cancel"; ObjectID = "QAR-9i-kmv"; */
|
||||
"QAR-9i-kmv.title" = "取消";
|
||||
@@ -67,10 +67,6 @@ int main(int argc, const char * argv[])
|
||||
if (!portString) {
|
||||
return 1;
|
||||
}
|
||||
port = [portString integerValue];
|
||||
if (0 == port) {
|
||||
return 1;
|
||||
}
|
||||
} else if (![@"off" isEqualToString:mode]) {
|
||||
return 1;
|
||||
}
|
||||
@@ -79,6 +75,12 @@ int main(int argc, const char * argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (portString) {
|
||||
port = [portString integerValue];
|
||||
if (0 == port) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static AuthorizationRef authRef;
|
||||
static AuthorizationFlags authFlags;
|
||||
@@ -126,11 +128,16 @@ int main(int argc, const char * argv[])
|
||||
|
||||
if (modify) {
|
||||
|
||||
NSString* prefPath = [NSString stringWithFormat:@"/%@/%@/%@", kSCPrefNetworkServices
|
||||
, key, kSCEntNetProxies];
|
||||
|
||||
if ([mode isEqualToString:@"auto"]) {
|
||||
|
||||
[proxies setObject:pacURL forKey:(NSString *)kCFNetworkProxiesProxyAutoConfigURLString];
|
||||
[proxies setObject:[NSNumber numberWithInt:1] forKey:(NSString *)kCFNetworkProxiesProxyAutoConfigEnable];
|
||||
|
||||
SCPreferencesPathSetValue(prefRef, (__bridge CFStringRef)prefPath
|
||||
, (__bridge CFDictionaryRef)proxies);
|
||||
} else if ([mode isEqualToString:@"global"]) {
|
||||
|
||||
|
||||
@@ -142,9 +149,29 @@ int main(int argc, const char * argv[])
|
||||
kCFNetworkProxiesSOCKSEnable];
|
||||
[proxies setObject:@[@"127.0.0.1", @"localhost"] forKey:(NSString *)kCFNetworkProxiesExceptionsList];
|
||||
|
||||
SCPreferencesPathSetValue(prefRef, (__bridge CFStringRef)prefPath
|
||||
, (__bridge CFDictionaryRef)proxies);
|
||||
} else if ([mode isEqualToString:@"off"]) {
|
||||
if (pacURL != nil && portString != nil) {
|
||||
// 取原来的配置,判断是否为shadowsocksX-NG设置的
|
||||
NSDictionary* oldProxies
|
||||
= (__bridge NSDictionary*)SCPreferencesPathGetValue(prefRef
|
||||
, (__bridge CFStringRef)prefPath);
|
||||
|
||||
if (([oldProxies[(NSString *)kCFNetworkProxiesProxyAutoConfigURLString] isEqualToString:pacURL]
|
||||
&&[oldProxies[(NSString *)kCFNetworkProxiesProxyAutoConfigEnable] isEqual:[NSNumber numberWithInt:1]])
|
||||
||([oldProxies[(NSString*)kCFNetworkProxiesSOCKSProxy] isEqualToString:@"127.0.0.1"]
|
||||
&&[oldProxies[(NSString*)kCFNetworkProxiesSOCKSPort] isEqualTo:[NSNumber numberWithInteger:port]]
|
||||
&&[oldProxies[(NSString*)kCFNetworkProxiesSOCKSEnable] isEqual:[NSNumber numberWithInt:1]])
|
||||
) {
|
||||
SCPreferencesPathSetValue(prefRef, (__bridge CFStringRef)prefPath
|
||||
, (__bridge CFDictionaryRef)proxies);
|
||||
}
|
||||
} else {
|
||||
SCPreferencesPathSetValue(prefRef, (__bridge CFStringRef)prefPath
|
||||
, (__bridge CFDictionaryRef)proxies);
|
||||
}
|
||||
}
|
||||
|
||||
SCPreferencesPathSetValue(prefRef, (__bridge CFStringRef)[NSString stringWithFormat:@"/%@/%@/%@", kSCPrefNetworkServices, key, kSCEntNetProxies], (__bridge CFDictionaryRef)proxies);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user