mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-10-27 19:24:01 +00:00
init subscribe
This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
083BF8371D82742200831C68 /* PingClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 083BF8351D82742200831C68 /* PingClient.swift */; };
|
||||
083BF8391D82759600831C68 /* StatusItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 083BF8381D82759600831C68 /* StatusItemView.swift */; };
|
||||
083BF83B1D8275A800831C68 /* SystemThemeChangeHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 083BF83A1D8275A800831C68 /* SystemThemeChangeHelper.swift */; };
|
||||
0877D6541EF1E65600126865 /* Subscribe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0877D6531EF1E65600126865 /* Subscribe.swift */; };
|
||||
0877D6571EF1E82400126865 /* SubscribePreferenceWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0877D6551EF1E82400126865 /* SubscribePreferenceWindowController.swift */; };
|
||||
0877D6581EF1E82400126865 /* SubscribePreferenceWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0877D6561EF1E82400126865 /* SubscribePreferenceWindowController.xib */; };
|
||||
0880CE401D6FE6D900BD39E2 /* example-gui-config.json in Resources */ = {isa = PBXBuildFile; fileRef = 0880CE3F1D6FE6D900BD39E2 /* example-gui-config.json */; };
|
||||
088EC3971D5F5B8600E40791 /* whitelist.pac in Resources */ = {isa = PBXBuildFile; fileRef = 088EC3961D5F5B8600E40791 /* whitelist.pac */; };
|
||||
088EC3991D5F5BA300E40791 /* whiteiplist.pac in Resources */ = {isa = PBXBuildFile; fileRef = 088EC3981D5F5BA300E40791 /* whiteiplist.pac */; };
|
||||
@@ -110,6 +113,9 @@
|
||||
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>"; };
|
||||
0877D6531EF1E65600126865 /* Subscribe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Subscribe.swift; sourceTree = "<group>"; };
|
||||
0877D6551EF1E82400126865 /* SubscribePreferenceWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscribePreferenceWindowController.swift; sourceTree = "<group>"; };
|
||||
0877D6561EF1E82400126865 /* SubscribePreferenceWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SubscribePreferenceWindowController.xib; 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>"; };
|
||||
@@ -320,6 +326,7 @@
|
||||
9B0BFFEC1D0460A70040E62B /* MainMenu.xib */,
|
||||
9B0BFFEF1D0460A70040E62B /* Info.plist */,
|
||||
9BEEF06D1D04DCE400FC52B3 /* ServerProfile.swift */,
|
||||
0877D6531EF1E65600126865 /* Subscribe.swift */,
|
||||
9BEEF06F1D04DDB100FC52B3 /* ServerProfileManager.swift */,
|
||||
08BDBB471E2361BD00C4BBC2 /* VersionChecker.swift */,
|
||||
083BF8381D82759600831C68 /* StatusItemView.swift */,
|
||||
@@ -355,6 +362,8 @@
|
||||
children = (
|
||||
9B3FFF331D08CEF70019A709 /* SWBQRCodeWindowController.xib */,
|
||||
9B3FFF301D08CEE40019A709 /* SWBQRCodeWindowController.h */,
|
||||
0877D6551EF1E82400126865 /* SubscribePreferenceWindowController.swift */,
|
||||
0877D6561EF1E82400126865 /* SubscribePreferenceWindowController.xib */,
|
||||
9B3FFF311D08CEE40019A709 /* SWBQRCodeWindowController.m */,
|
||||
9BEEF0731D04EF3E00FC52B3 /* PreferencesWindowController.swift */,
|
||||
9B2491B61D0ACC3A003BBECC /* PreferencesWindowController.xib */,
|
||||
@@ -467,6 +476,7 @@
|
||||
TargetAttributes = {
|
||||
9B0BFFE41D0460A70040E62B = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
DevelopmentTeam = 2E8Q4BTFR2;
|
||||
LastSwiftMigration = 0800;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
@@ -512,6 +522,7 @@
|
||||
C6E28E951DA79705004F8330 /* HTTPPreferencesWindowController.xib in Resources */,
|
||||
9BEEF0691D04D4D500FC52B3 /* install_ss_local.sh in Resources */,
|
||||
9B0D55461D2CC85400A4A8E2 /* ProxyPreferencesController.xib in Resources */,
|
||||
0877D6581EF1E82400126865 /* SubscribePreferenceWindowController.xib in Resources */,
|
||||
9B2491B41D0ACC3A003BBECC /* PreferencesWindowController.xib in Resources */,
|
||||
9B3FFF291D08A1DF0019A709 /* user-rule.txt in Resources */,
|
||||
C6D429971DA75988002A5711 /* stop_privoxy.sh in Resources */,
|
||||
@@ -696,6 +707,8 @@
|
||||
9BA04B261D24044D005AAD7F /* ProxyPreferencesController.swift in Sources */,
|
||||
9B3FFF141D0705810019A709 /* Notifications.swift in Sources */,
|
||||
9BEEF0701D04DDB100FC52B3 /* ServerProfileManager.swift in Sources */,
|
||||
0877D6571EF1E82400126865 /* SubscribePreferenceWindowController.swift in Sources */,
|
||||
0877D6541EF1E65600126865 /* Subscribe.swift in Sources */,
|
||||
9BEEF07B1D05631500FC52B3 /* AdvPreferencesWindowController.swift in Sources */,
|
||||
083BF8391D82759600831C68 /* StatusItemView.swift in Sources */,
|
||||
9BEEF06E1D04DCE400FC52B3 /* ServerProfile.swift in Sources */,
|
||||
@@ -908,6 +921,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = 2E8Q4BTFR2;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/libcork/include/",
|
||||
"$(SRCROOT)/libipset/include/",
|
||||
@@ -938,6 +952,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = 2E8Q4BTFR2;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/libcork/include/",
|
||||
"$(SRCROOT)/libipset/include/",
|
||||
|
||||
@@ -19,6 +19,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
var proxyPreferencesWinCtrl: ProxyPreferencesController!
|
||||
var editUserRulesWinCtrl: UserRulesController!
|
||||
var httpPreferencesWinCtrl : HTTPPreferencesWindowController!
|
||||
var subscribePreferenceWinCtrl: SubscribePreferenceWindowController!
|
||||
|
||||
var launchAtLoginController: LaunchAtLoginController = LaunchAtLoginController()
|
||||
|
||||
@@ -56,6 +57,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
var statusItemView:StatusItemView!
|
||||
var statusItem: NSStatusItem?
|
||||
var speedMonitor:NetWorkMonitor?
|
||||
var globalSubscribeFeed: Subscribe!
|
||||
|
||||
// MARK: Application function
|
||||
|
||||
@@ -89,7 +91,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
"LocalHTTPOn": true,
|
||||
"LocalHTTP.FollowGlobal": true,
|
||||
"AutoCheckUpdate": false,
|
||||
"ACLFileName": "chn.acl"
|
||||
"ACLFileName": "chn.acl",
|
||||
"SubscribeFeed": ""
|
||||
])
|
||||
|
||||
setUpMenu(defaults.bool(forKey: "enable_showSpeed"))
|
||||
@@ -282,6 +285,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
ctrl.window?.makeKeyAndOrderFront(self)
|
||||
}
|
||||
|
||||
@IBAction func editSubscribeFeed(_ sender: NSMenuItem) {
|
||||
if subscribePreferenceWinCtrl != nil {
|
||||
subscribePreferenceWinCtrl.close()
|
||||
}
|
||||
let ctrl = SubscribePreferenceWindowController(windowNibName: "SubscribePreferenceWindowController")
|
||||
subscribePreferenceWinCtrl = ctrl
|
||||
|
||||
ctrl.showWindow(self)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
ctrl.window?.makeKeyAndOrderFront(self)
|
||||
}
|
||||
|
||||
@IBAction func toggleLaunghAtLogin(_ sender: NSMenuItem) {
|
||||
launchAtLoginController.launchAtLogin = !launchAtLoginController.launchAtLogin;
|
||||
updateLaunchAtLoginMenu()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12120" systemVersion="16F71b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12121" systemVersion="17A264c" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12120"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
@@ -119,6 +119,12 @@
|
||||
<action selector="editUserRulesForPAC:" target="Voe-Tx-rLC" id="ZtK-2d-Pcl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Edit Subscribe Feed" id="QJ6-eg-mzv">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="editSubscribeFeed:" target="Voe-Tx-rLC" id="V3v-T4-Rfn"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="bMX-qn-Qwi"/>
|
||||
<menuItem title="Advance Proxy Preference..." id="sbx-yz-3lO">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Subscribe.swift
|
||||
// ShadowsocksX-NG
|
||||
//
|
||||
// Created by 秦宇航 on 2017/6/15.
|
||||
// Copyright © 2017年 qiuyuzhou. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Alamofire
|
||||
|
||||
class Subscribe: NSObject{
|
||||
|
||||
var subscribeFeed = ""
|
||||
var profileMgr: ServerProfileManager!
|
||||
|
||||
init(initUrlString:String){
|
||||
subscribeFeed = initUrlString
|
||||
}
|
||||
func getFeed() -> String{
|
||||
return subscribeFeed
|
||||
}
|
||||
func setFeed(newFeed: String){
|
||||
subscribeFeed = newFeed
|
||||
}
|
||||
func updateServerFromFeed(){
|
||||
Alamofire.request(subscribeFeed)
|
||||
.responseString {
|
||||
response in
|
||||
if response.result.isSuccess {
|
||||
if let v = response.result.value {
|
||||
print(v)
|
||||
let profile = ServerProfile()
|
||||
profile.remark = "New Server".localized
|
||||
self.profileMgr.profiles.append(profile)
|
||||
self.profileMgr.save()
|
||||
}
|
||||
}
|
||||
else{
|
||||
// res failed
|
||||
print(response.result)
|
||||
}
|
||||
}
|
||||
}
|
||||
func feedValidator() -> Bool{
|
||||
// is the right format
|
||||
return true
|
||||
}
|
||||
fileprivate func pushNotification(){
|
||||
|
||||
}
|
||||
fileprivate func isExisted() -> Bool{
|
||||
// using to url judge
|
||||
// if existed update
|
||||
return false
|
||||
}
|
||||
fileprivate func isDuplicated() -> Bool{
|
||||
// if duplicated skip
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// SubscribePreferenceWindowController.swift
|
||||
// ShadowsocksX-NG
|
||||
//
|
||||
// Created by 秦宇航 on 2017/6/15.
|
||||
// Copyright © 2017年 qiuyuzhou. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class SubscribePreferenceWindowController: NSWindowController {
|
||||
|
||||
@IBOutlet weak var FeedLabel: NSTextField!
|
||||
@IBOutlet weak var OKButton: NSButton!
|
||||
@IBOutlet weak var FeedTextField: NSTextField!
|
||||
override func windowDidLoad() {
|
||||
super.windowDidLoad()
|
||||
|
||||
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
|
||||
}
|
||||
|
||||
@IBAction func onOk(_ sender: NSButton) {
|
||||
print(FeedTextField.stringValue)
|
||||
window?.performClose(self)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12121" systemVersion="17A264c" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SubscribePreferenceWindowController" customModule="ShadowsocksX_NG" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="FeedLabel" destination="uYX-0C-bOD" id="odZ-Tm-7SC"/>
|
||||
<outlet property="FeedTextField" destination="Tgr-sy-xCE" id="tsu-30-w0y"/>
|
||||
<outlet property="OKButton" destination="rC3-mg-tMh" id="RK5-lm-9qc"/>
|
||||
<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="Window" 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"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
|
||||
<view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uYX-0C-bOD">
|
||||
<rect key="frame" x="18" y="233" width="128" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Subscribe Feed URL" id="rMX-5B-Fvs">
|
||||
<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" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tgr-sy-xCE">
|
||||
<rect key="frame" x="20" y="49" width="440" height="176"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Not Support Multipler Config" drawsBackground="YES" id="yqT-8e-Bt3">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rC3-mg-tMh">
|
||||
<rect key="frame" x="407" y="13" width="59" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="CfK-8Y-YNP">
|
||||
<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="onOk:" target="-2" id="dUz-Tf-zD1"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
|
||||
</connections>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user