├── .gitignore ├── .travis.yml ├── Podfile ├── Podfile.lock ├── Pods ├── Alamofire │ ├── LICENSE │ ├── README.md │ └── Source │ │ ├── AFError.swift │ │ ├── Alamofire.swift │ │ ├── DispatchQueue+Alamofire.swift │ │ ├── MultipartFormData.swift │ │ ├── NetworkReachabilityManager.swift │ │ ├── Notifications.swift │ │ ├── ParameterEncoding.swift │ │ ├── Request.swift │ │ ├── Response.swift │ │ ├── ResponseSerialization.swift │ │ ├── Result.swift │ │ ├── ServerTrustPolicy.swift │ │ ├── SessionDelegate.swift │ │ ├── SessionManager.swift │ │ ├── TaskDelegate.swift │ │ ├── Timeline.swift │ │ └── Validation.swift ├── BRLOptionParser │ ├── BRLOptionParser │ │ ├── BRLOptionParser.h │ │ └── BRLOptionParser.m │ ├── LICENSE │ └── README.markdown ├── GCDWebServer │ ├── GCDWebServer │ │ ├── Core │ │ │ ├── GCDWebServer.h │ │ │ ├── GCDWebServer.m │ │ │ ├── GCDWebServerConnection.h │ │ │ ├── GCDWebServerConnection.m │ │ │ ├── GCDWebServerFunctions.h │ │ │ ├── GCDWebServerFunctions.m │ │ │ ├── GCDWebServerHTTPStatusCodes.h │ │ │ ├── GCDWebServerPrivate.h │ │ │ ├── GCDWebServerRequest.h │ │ │ ├── GCDWebServerRequest.m │ │ │ ├── GCDWebServerResponse.h │ │ │ └── GCDWebServerResponse.m │ │ ├── Requests │ │ │ ├── GCDWebServerDataRequest.h │ │ │ ├── GCDWebServerDataRequest.m │ │ │ ├── GCDWebServerFileRequest.h │ │ │ ├── GCDWebServerFileRequest.m │ │ │ ├── GCDWebServerMultiPartFormRequest.h │ │ │ ├── GCDWebServerMultiPartFormRequest.m │ │ │ ├── GCDWebServerURLEncodedFormRequest.h │ │ │ └── GCDWebServerURLEncodedFormRequest.m │ │ └── Responses │ │ │ ├── GCDWebServerDataResponse.h │ │ │ ├── GCDWebServerDataResponse.m │ │ │ ├── GCDWebServerErrorResponse.h │ │ │ ├── GCDWebServerErrorResponse.m │ │ │ ├── GCDWebServerFileResponse.h │ │ │ ├── GCDWebServerFileResponse.m │ │ │ ├── GCDWebServerStreamedResponse.h │ │ │ └── GCDWebServerStreamedResponse.m │ ├── LICENSE │ └── README.md ├── Headers │ ├── Private │ │ └── BRLOptionParser │ │ │ └── BRLOptionParser.h │ └── Public │ │ └── BRLOptionParser │ │ └── BRLOptionParser.h ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj └── Target Support Files │ ├── Alamofire │ ├── Alamofire-dummy.m │ ├── Alamofire-prefix.pch │ ├── Alamofire-umbrella.h │ ├── Alamofire.modulemap │ ├── Alamofire.xcconfig │ └── Info.plist │ ├── BRLOptionParser │ ├── BRLOptionParser-dummy.m │ ├── BRLOptionParser-prefix.pch │ └── BRLOptionParser.xcconfig │ ├── GCDWebServer │ ├── GCDWebServer-dummy.m │ ├── GCDWebServer-prefix.pch │ ├── GCDWebServer-umbrella.h │ ├── GCDWebServer.modulemap │ ├── GCDWebServer.xcconfig │ └── Info.plist │ ├── Pods-ShadowsocksX-NG │ ├── Info.plist │ ├── Pods-ShadowsocksX-NG-acknowledgements.markdown │ ├── Pods-ShadowsocksX-NG-acknowledgements.plist │ ├── Pods-ShadowsocksX-NG-dummy.m │ ├── Pods-ShadowsocksX-NG-frameworks.sh │ ├── Pods-ShadowsocksX-NG-resources.sh │ ├── Pods-ShadowsocksX-NG-umbrella.h │ ├── Pods-ShadowsocksX-NG.debug.xcconfig │ ├── Pods-ShadowsocksX-NG.modulemap │ └── Pods-ShadowsocksX-NG.release.xcconfig │ ├── Pods-ShadowsocksX-NGTests │ ├── Info.plist │ ├── Pods-ShadowsocksX-NGTests-acknowledgements.markdown │ ├── Pods-ShadowsocksX-NGTests-acknowledgements.plist │ ├── Pods-ShadowsocksX-NGTests-dummy.m │ ├── Pods-ShadowsocksX-NGTests-frameworks.sh │ ├── Pods-ShadowsocksX-NGTests-resources.sh │ ├── Pods-ShadowsocksX-NGTests-umbrella.h │ ├── Pods-ShadowsocksX-NGTests.debug.xcconfig │ ├── Pods-ShadowsocksX-NGTests.modulemap │ └── Pods-ShadowsocksX-NGTests.release.xcconfig │ └── Pods-proxy_conf_helper │ ├── Pods-proxy_conf_helper-acknowledgements.markdown │ ├── Pods-proxy_conf_helper-acknowledgements.plist │ ├── Pods-proxy_conf_helper-dummy.m │ ├── Pods-proxy_conf_helper-frameworks.sh │ ├── Pods-proxy_conf_helper-resources.sh │ ├── Pods-proxy_conf_helper.debug.xcconfig │ └── Pods-proxy_conf_helper.release.xcconfig ├── README.md ├── ScreenRecord ├── ScreenRecord_en.gif └── ScreenRecord_zh.gif ├── ShadowsocksX-NG.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── ShadowsocksX-NG.xcscheme │ ├── ShadowsocksX-NGTests.xcscheme │ └── proxy_conf_helper.xcscheme ├── ShadowsocksX-NG.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── WorkspaceSettings.xcsettings ├── ShadowsocksX-NG ├── AdvPreferencesWindowController.swift ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon_128x128.png │ │ ├── Icon_128x128@2x.png │ │ ├── Icon_16x16.png │ │ ├── Icon_16x16@2x.png │ │ ├── Icon_256x256.png │ │ ├── Icon_256x256@2x.png │ │ ├── Icon_32x32.png │ │ ├── Icon_32x32@2x.png │ │ ├── Icon_512x512.png │ │ └── Icon_512x512@2x.png │ └── Contents.json ├── Base.lproj │ ├── AdvPreferencesWindowController.xib │ ├── HTTPPreferencesWindowController.xib │ ├── Localizable.strings │ ├── MainMenu.xib │ ├── PreferencesWindowController.xib │ ├── ProxyPreferencesController.xib │ ├── SetShortcutWindowController.xib │ └── UserRulesController.xib ├── HTTPPreferencesWindowController.swift ├── Info.plist ├── LaunchAgentUtils.swift ├── LaunchAtLoginController.h ├── LaunchAtLoginController.m ├── MASShortcut.framework │ ├── Headers │ ├── MASShortcut │ ├── Modules │ ├── Resources │ └── Versions │ │ ├── A │ │ ├── Headers │ │ │ ├── MASDictionaryTransformer.h │ │ │ ├── MASKeyCodes.h │ │ │ ├── MASKeyMasks.h │ │ │ ├── MASShortcut.h │ │ │ ├── MASShortcutBinder.h │ │ │ ├── MASShortcutMonitor.h │ │ │ ├── MASShortcutValidator.h │ │ │ ├── MASShortcutView+Bindings.h │ │ │ ├── MASShortcutView.h │ │ │ └── Shortcut.h │ │ ├── MASShortcut │ │ ├── Modules │ │ │ └── module.modulemap │ │ └── Resources │ │ │ ├── Info.plist │ │ │ ├── cs.lproj │ │ │ └── Localizable.strings │ │ │ ├── de.lproj │ │ │ └── Localizable.strings │ │ │ ├── en.lproj │ │ │ └── Localizable.strings │ │ │ ├── es.lproj │ │ │ └── Localizable.strings │ │ │ ├── fr.lproj │ │ │ └── Localizable.strings │ │ │ ├── it.lproj │ │ │ └── Localizable.strings │ │ │ ├── ja.lproj │ │ │ └── Localizable.strings │ │ │ ├── ko.lproj │ │ │ └── Localizable.strings │ │ │ ├── nl.lproj │ │ │ └── Localizable.strings │ │ │ ├── pl.lproj │ │ │ └── Localizable.strings │ │ │ ├── ru.lproj │ │ │ └── Localizable.strings │ │ │ ├── zh-Hans.lproj │ │ │ └── Localizable.strings │ │ │ └── zh-Hant.lproj │ │ │ └── Localizable.strings │ │ └── Current ├── Notifications.swift ├── PACUtils.swift ├── PreferencesWindowController.swift ├── ProxyConfHelper.h ├── ProxyConfHelper.m ├── ProxyConfTool.h ├── ProxyConfTool.m ├── ProxyPreferencesController.swift ├── SWBApplication.h ├── SWBApplication.m ├── SWBQRCodeWindowController.h ├── SWBQRCodeWindowController.m ├── SWBQRCodeWindowController.xib ├── ServerProfile.swift ├── ServerProfileManager.swift ├── SetShortcutWindowController.swift ├── ShadowsocksX-NG-Bridging-Header.h ├── UserRulesController.swift ├── Utils.h ├── Utils.m ├── Utils.swift ├── abp.js ├── en.lproj │ └── PreferencesWindowController.strings ├── gfwlist.txt ├── install_helper.sh ├── install_privoxy.sh ├── install_ss_local.sh ├── libcrypto.1.0.0.dylib ├── menu_icon.png ├── menu_icon@2x.png ├── menu_icon_disabled.png ├── menu_icon_disabled@2x.png ├── privoxy ├── privoxy.config.example ├── proxy.pac ├── proxy_conf_helper_version.h ├── reload_conf_privoxy.sh ├── reload_conf_ss_local.sh ├── ss-local ├── start_privoxy.sh ├── start_ss_local.sh ├── stop_privoxy.sh ├── stop_ss_local.sh ├── user-rule.txt └── zh-Hans.lproj │ ├── AdvPreferencesWindowController.strings │ ├── HTTPPreferencesWindowController.strings │ ├── Localizable.strings │ ├── MainMenu.strings │ ├── PreferencesWindowController.strings │ ├── ProxyPreferencesController.strings │ ├── SetShortcutWindowController.strings │ └── UserRulesController.strings ├── ShadowsocksX-NGTests ├── Info.plist └── ShadowsocksX_NGTests.swift ├── ShortcutSS.app.zip ├── genstrings.py └── proxy_conf_helper └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | ##### 2 | # OS X temporary files that should never be committed 3 | .DS_Store 4 | *.swp 5 | *.lock 6 | profile 7 | 8 | #### 9 | # Xcode temporary files that should never be committed 10 | *~.nib 11 | 12 | #### 13 | # Objective-C/Swift specific 14 | *.hmap 15 | *.ipa 16 | 17 | #### 18 | # Xcode build files 19 | DerivedData/ 20 | build/ 21 | Builds/ 22 | 23 | ##### 24 | # Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups) 25 | *.pbxuser 26 | *.mode1v3 27 | *.mode2v3 28 | *.perspectivev3 29 | !default.pbxuser 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.perspectivev3 33 | 34 | #### 35 | # Xcode 4 36 | xcuserdata 37 | !xcschemes 38 | # Xcode 4 39 | *.moved-aside 40 | 41 | #### 42 | # XCode 4 workspaces - more detailed 43 | !xcshareddata 44 | !default.xcworkspace 45 | *.xcworkspacedata 46 | 47 | 48 | #### 49 | # Xcode 5 50 | *.xccheckout 51 | *.xcuserstate 52 | 53 | #### 54 | # Xcode 7 55 | *.xcscmblueprint 56 | 57 | #### 58 | # AppCode 59 | .idea/ 60 | 61 | #### 62 | # Other Xcode files 63 | profile 64 | *.hmap 65 | *.ipa 66 | 67 | #### 68 | # Carthage 69 | Carthage/Build 70 | 71 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode8 3 | xcode_workspace: ShadowsocksX-NG.xcworkspace 4 | xcode_scheme: ShadowsocksX-NG 5 | script: set -o pipefail && xcodebuild test -workspace ShadowsocksX-NG.xcworkspace -scheme ShadowsocksX-NG|xcpretty 6 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'ShadowsocksX-NG' do 5 | # Comment this line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for ShadowsocksX-NG 9 | pod 'Alamofire', '~> 4.0.1' 10 | pod "GCDWebServer", "~> 3.0" 11 | 12 | target 'ShadowsocksX-NGTests' do 13 | inherit! :search_paths 14 | # Pods for testing 15 | end 16 | 17 | end 18 | 19 | target 'proxy_conf_helper' do 20 | pod 'BRLOptionParser', '~> 0.3.1' 21 | end 22 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Alamofire (4.0.1) 3 | - BRLOptionParser (0.3.1) 4 | - GCDWebServer (3.3.3): 5 | - GCDWebServer/Core (= 3.3.3) 6 | - GCDWebServer/Core (3.3.3) 7 | 8 | DEPENDENCIES: 9 | - Alamofire (~> 4.0.1) 10 | - BRLOptionParser (~> 0.3.1) 11 | - GCDWebServer (~> 3.0) 12 | 13 | SPEC CHECKSUMS: 14 | Alamofire: 7682d43245de14874acd142ec137b144aa1dd335 15 | BRLOptionParser: a03256a8ff003ca1f5376c55f55f210e085a3958 16 | GCDWebServer: 1c39a1f0763e4eb492bee021e4270fce097d3555 17 | 18 | PODFILE CHECKSUM: e675030dbd86de38216dc6c44e64ca1458be94bc 19 | 20 | COCOAPODS: 1.2.0.beta.3 21 | -------------------------------------------------------------------------------- /Pods/Alamofire/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pods/Alamofire/Source/DispatchQueue+Alamofire.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DispatchQueue+Alamofire.swift 3 | // 4 | // Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | import Dispatch 26 | import Foundation 27 | 28 | extension DispatchQueue { 29 | static var userInteractive: DispatchQueue { return DispatchQueue.global(qos: .userInteractive) } 30 | static var userInitiated: DispatchQueue { return DispatchQueue.global(qos: .userInitiated) } 31 | static var utility: DispatchQueue { return DispatchQueue.global(qos: .utility) } 32 | static var background: DispatchQueue { return DispatchQueue.global(qos: .background) } 33 | 34 | func after(_ delay: TimeInterval, execute closure: @escaping () -> Void) { 35 | asyncAfter(deadline: .now() + delay, execute: closure) 36 | } 37 | 38 | func syncResult(_ closure: () -> T) -> T { 39 | var result: T! 40 | sync { result = closure() } 41 | return result 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Pods/Alamofire/Source/Notifications.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Notifications.swift 3 | // 4 | // Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | import Foundation 26 | 27 | extension Notification.Name { 28 | /// Used as a namespace for all `URLSessionTask` related notifications. 29 | public struct Task { 30 | /// Posted when a `URLSessionTask` is resumed. The notification `object` contains the resumed `URLSessionTask`. 31 | public static let DidResume = Notification.Name(rawValue: "org.alamofire.notification.name.task.didResume") 32 | 33 | /// Posted when a `URLSessionTask` is suspended. The notification `object` contains the suspended `URLSessionTask`. 34 | public static let DidSuspend = Notification.Name(rawValue: "org.alamofire.notification.name.task.didSuspend") 35 | 36 | /// Posted when a `URLSessionTask` is cancelled. The notification `object` contains the cancelled `URLSessionTask`. 37 | public static let DidCancel = Notification.Name(rawValue: "org.alamofire.notification.name.task.didCancel") 38 | 39 | /// Posted when a `URLSessionTask` is completed. The notification `object` contains the completed `URLSessionTask`. 40 | public static let DidComplete = Notification.Name(rawValue: "org.alamofire.notification.name.task.didComplete") 41 | } 42 | } 43 | 44 | // MARK: - 45 | 46 | extension Notification { 47 | /// Used as a namespace for all `Notification` user info dictionary keys. 48 | public struct Key { 49 | /// User info dictionary key representing the `URLSessionTask` associated with the notification. 50 | public static let Task = "org.alamofire.notification.key.task" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pods/Alamofire/Source/Result.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Result.swift 3 | // 4 | // Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | import Foundation 26 | 27 | /// Used to represent whether a request was successful or encountered an error. 28 | /// 29 | /// - success: The request and all post processing operations were successful resulting in the serialization of the 30 | /// provided associated value. 31 | /// 32 | /// - failure: The request encountered an error resulting in a failure. The associated values are the original data 33 | /// provided by the server as well as the error that caused the failure. 34 | public enum Result { 35 | case success(Value) 36 | case failure(Error) 37 | 38 | /// Returns `true` if the result is a success, `false` otherwise. 39 | public var isSuccess: Bool { 40 | switch self { 41 | case .success: 42 | return true 43 | case .failure: 44 | return false 45 | } 46 | } 47 | 48 | /// Returns `true` if the result is a failure, `false` otherwise. 49 | public var isFailure: Bool { 50 | return !isSuccess 51 | } 52 | 53 | /// Returns the associated value if the result is a success, `nil` otherwise. 54 | public var value: Value? { 55 | switch self { 56 | case .success(let value): 57 | return value 58 | case .failure: 59 | return nil 60 | } 61 | } 62 | 63 | /// Returns the associated error value if the result is a failure, `nil` otherwise. 64 | public var error: Error? { 65 | switch self { 66 | case .success: 67 | return nil 68 | case .failure(let error): 69 | return error 70 | } 71 | } 72 | } 73 | 74 | // MARK: - CustomStringConvertible 75 | 76 | extension Result: CustomStringConvertible { 77 | /// The textual representation used when written to an output stream, which includes whether the result was a 78 | /// success or failure. 79 | public var description: String { 80 | switch self { 81 | case .success: 82 | return "SUCCESS" 83 | case .failure: 84 | return "FAILURE" 85 | } 86 | } 87 | } 88 | 89 | // MARK: - CustomDebugStringConvertible 90 | 91 | extension Result: CustomDebugStringConvertible { 92 | /// The debug textual representation used when written to an output stream, which includes whether the result was a 93 | /// success or failure in addition to the value or error. 94 | public var debugDescription: String { 95 | switch self { 96 | case .success(let value): 97 | return "SUCCESS: \(value)" 98 | case .failure(let error): 99 | return "FAILURE: \(error)" 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Pods/BRLOptionParser/BRLOptionParser/BRLOptionParser.h: -------------------------------------------------------------------------------- 1 | // BRLOptionParser.h 2 | // 3 | // Copyright © 2013–2015 Stephen Celis () 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | 24 | @import Foundation; 25 | 26 | 27 | typedef void (^BRLOptionParserOptionBlock)(); 28 | typedef void (^BRLOptionParserOptionBlockWithArgument)(NSString *value); 29 | 30 | 31 | static NSString *const BRLOptionParserErrorDomain = @"BRLOptionParserErrorDomain"; 32 | 33 | 34 | typedef NS_ENUM(NSUInteger, BRLOptionParserErrorCode) { 35 | BRLOptionParserErrorCodeUnrecognized = 1, 36 | BRLOptionParserErrorCodeRequired 37 | }; 38 | 39 | 40 | @interface BRLOptionParser : NSObject 41 | 42 | + (instancetype)parser; 43 | + (instancetype)longOnlyParser; 44 | 45 | @property (nonatomic, getter = isLongOnly) BOOL longOnly; 46 | 47 | @property (nonatomic, copy) NSString *banner; 48 | 49 | - (void)setBanner:(NSString *)banner, ...; 50 | 51 | - (void)addOption:(char *)option flag:(unichar)flag description:(NSString *)description block:(BRLOptionParserOptionBlock)block; 52 | - (void)addOption:(char *)option flag:(unichar)flag description:(NSString *)description blockWithArgument:(BRLOptionParserOptionBlockWithArgument)blockWithArgument; 53 | 54 | - (void)addOption:(char *)option flag:(unichar)flag description:(NSString *)description value:(BOOL *)value; 55 | - (void)addOption:(char *)option flag:(unichar)flag description:(NSString *)description argument:(NSString *__strong *)argument; 56 | 57 | - (void)addSeparator; 58 | - (void)addSeparator:(NSString *)separator; 59 | 60 | - (BOOL)parseArgc:(int)argc argv:(const char **)argv error:(NSError **)error; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Pods/BRLOptionParser/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright © 2013-2015 Stephen Celis () 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Pods/BRLOptionParser/README.markdown: -------------------------------------------------------------------------------- 1 | # BRLOptionParser [![Build Status][1]][2] 2 | 3 | A short wrapper for [getopt_long(3)][3] (and getopt_long_only(3)). 4 | 5 | [1]: https://img.shields.io/travis/stephencelis/BRLOptionParser.svg?style=flat 6 | [2]: https://travis-ci.org/stephencelis/BRLOptionParser 7 | [3]: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/getopt_long.3.html 8 | 9 | ## Install 10 | 11 | With [CocoaPods][4]: 12 | 13 | ``` rb 14 | # Podfile 15 | pod 'BRLOptionParser', '~> 0.3.1' 16 | ``` 17 | 18 | [4]: http://cocoapods.org 19 | 20 | ## Example 21 | 22 | ``` objc 23 | // main.m 24 | #import 25 | 26 | int main(int argc, const char * argv[]) 27 | { 28 | @autoreleasepool { 29 | NSString *name = @"world"; 30 | BOOL verbose = NO; 31 | 32 | BRLOptionParser *options = [BRLOptionParser new]; 33 | 34 | [options setBanner:@"usage: %s [-n ] [-vh]", argv[0]]; 35 | [options addOption:"name" flag:'n' description:@"Your name" argument:&name]; 36 | [options addSeparator]; 37 | [options addOption:"verbose" flag:'v' description:nil value:&verbose]; 38 | __weak typeof(options) weakOptions = options; 39 | [options addOption:"help" flag:'h' description:@"Show this message" block:^{ 40 | printf("%s", [[weakOptions description] UTF8String]); 41 | exit(EXIT_SUCCESS); 42 | }]; 43 | 44 | NSError *error = nil; 45 | if (![options parseArgc:argc argv:argv error:&error]) { 46 | const char * message = error.localizedDescription.UTF8String; 47 | fprintf(stderr, "%s: %s\n", argv[0], message); 48 | exit(EXIT_FAILURE); 49 | } 50 | 51 | if (verbose) { 52 | fprintf(stderr, "(Preparing to say hello...)\n"); 53 | } 54 | 55 | printf("Hello, %s!\n", name.UTF8String); 56 | } 57 | 58 | return EXIT_SUCCESS; 59 | } 60 | ``` 61 | 62 | In practice: 63 | 64 | ``` 65 | $ hello 66 | Hello, world! 67 | $ hello -h 68 | usage: hello [-n ] [-vh] 69 | -n, --name Your name 70 | 71 | -v, --verbose 72 | -h, --help Show this message 73 | $ hello -n 74 | hello: option `-n' requires an argument 75 | $ hello --name Stephen 76 | Hello, Stephen! 77 | $ hello -vngoodbye 78 | (Preparing to say hello...) 79 | Hello, goodbye! 80 | $ hello --goodbye 81 | hello: unrecognized option `--goodbye' 82 | ``` 83 | 84 | ## License 85 | 86 | BRLOptionParser is available under the MIT license. See the LICENSE file 87 | for more information. 88 | 89 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Core/GCDWebServerFunctions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /** 35 | * Converts a file extension to the corresponding MIME type. 36 | * If there is no match, "application/octet-stream" is returned. 37 | */ 38 | NSString* GCDWebServerGetMimeTypeForExtension(NSString* extension); 39 | 40 | /** 41 | * Add percent-escapes to a string so it can be used in a URL. 42 | * The legal characters ":@/?&=+" are also escaped to ensure compatibility 43 | * with URL encoded forms and URL queries. 44 | */ 45 | NSString* GCDWebServerEscapeURLString(NSString* string); 46 | 47 | /** 48 | * Unescapes a URL percent-encoded string. 49 | */ 50 | NSString* GCDWebServerUnescapeURLString(NSString* string); 51 | 52 | /** 53 | * Extracts the unescaped names and values from an 54 | * "application/x-www-form-urlencoded" form. 55 | * http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1 56 | */ 57 | NSDictionary* GCDWebServerParseURLEncodedForm(NSString* form); 58 | 59 | /** 60 | * On OS X, returns the IPv4 or IPv6 address as a string of the primary 61 | * connected service or nil if not available. 62 | * 63 | * On iOS, returns the IPv4 or IPv6 address as a string of the WiFi 64 | * interface if connected or nil otherwise. 65 | */ 66 | NSString* GCDWebServerGetPrimaryIPAddress(BOOL useIPv6); 67 | 68 | /** 69 | * Converts a date into a string using RFC822 formatting. 70 | * https://tools.ietf.org/html/rfc822#section-5 71 | * https://tools.ietf.org/html/rfc1123#section-5.2.14 72 | */ 73 | NSString* GCDWebServerFormatRFC822(NSDate* date); 74 | 75 | /** 76 | * Converts a RFC822 formatted string into a date. 77 | * https://tools.ietf.org/html/rfc822#section-5 78 | * https://tools.ietf.org/html/rfc1123#section-5.2.14 79 | * 80 | * @warning Timezones other than GMT are not supported by this function. 81 | */ 82 | NSDate* GCDWebServerParseRFC822(NSString* string); 83 | 84 | /** 85 | * Converts a date into a string using IOS 8601 formatting. 86 | * http://tools.ietf.org/html/rfc3339#section-5.6 87 | */ 88 | NSString* GCDWebServerFormatISO8601(NSDate* date); 89 | 90 | /** 91 | * Converts a ISO 8601 formatted string into a date. 92 | * http://tools.ietf.org/html/rfc3339#section-5.6 93 | * 94 | * @warning Only "calendar" variant is supported at this time and timezones 95 | * other than GMT are not supported either. 96 | */ 97 | NSDate* GCDWebServerParseISO8601(NSString* string); 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Requests/GCDWebServerDataRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerRequest.h" 29 | 30 | /** 31 | * The GCDWebServerDataRequest subclass of GCDWebServerRequest stores the body 32 | * of the HTTP request in memory. 33 | */ 34 | @interface GCDWebServerDataRequest : GCDWebServerRequest 35 | 36 | /** 37 | * Returns the data for the request body. 38 | */ 39 | @property(nonatomic, readonly) NSData* data; 40 | 41 | @end 42 | 43 | @interface GCDWebServerDataRequest (Extensions) 44 | 45 | /** 46 | * Returns the data for the request body interpreted as text. If the content 47 | * type of the body is not a text one, or if an error occurs, nil is returned. 48 | * 49 | * The text encoding used to interpret the data is extracted from the 50 | * "Content-Type" header or defaults to UTF-8. 51 | */ 52 | @property(nonatomic, readonly) NSString* text; 53 | 54 | /** 55 | * Returns the data for the request body interpreted as a JSON object. If the 56 | * content type of the body is not JSON, or if an error occurs, nil is returned. 57 | */ 58 | @property(nonatomic, readonly) id jsonObject; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Requests/GCDWebServerDataRequest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerDataRequest () { 35 | @private 36 | NSMutableData* _data; 37 | 38 | NSString* _text; 39 | id _jsonObject; 40 | } 41 | @end 42 | 43 | @implementation GCDWebServerDataRequest 44 | 45 | @synthesize data=_data; 46 | 47 | - (BOOL)open:(NSError**)error { 48 | if (self.contentLength != NSUIntegerMax) { 49 | _data = [[NSMutableData alloc] initWithCapacity:self.contentLength]; 50 | } else { 51 | _data = [[NSMutableData alloc] init]; 52 | } 53 | if (_data == nil) { 54 | if (error) { 55 | *error = [NSError errorWithDomain:kGCDWebServerErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey: @"Failed allocating memory"}]; 56 | } 57 | return NO; 58 | } 59 | return YES; 60 | } 61 | 62 | - (BOOL)writeData:(NSData*)data error:(NSError**)error { 63 | [_data appendData:data]; 64 | return YES; 65 | } 66 | 67 | - (BOOL)close:(NSError**)error { 68 | return YES; 69 | } 70 | 71 | - (NSString*)description { 72 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 73 | if (_data) { 74 | [description appendString:@"\n\n"]; 75 | [description appendString:GCDWebServerDescribeData(_data, self.contentType)]; 76 | } 77 | return description; 78 | } 79 | 80 | @end 81 | 82 | @implementation GCDWebServerDataRequest (Extensions) 83 | 84 | - (NSString*)text { 85 | if (_text == nil) { 86 | if ([self.contentType hasPrefix:@"text/"]) { 87 | NSString* charset = GCDWebServerExtractHeaderValueParameter(self.contentType, @"charset"); 88 | _text = [[NSString alloc] initWithData:self.data encoding:GCDWebServerStringEncodingFromCharset(charset)]; 89 | } else { 90 | GWS_DNOT_REACHED(); 91 | } 92 | } 93 | return _text; 94 | } 95 | 96 | - (id)jsonObject { 97 | if (_jsonObject == nil) { 98 | NSString* mimeType = GCDWebServerTruncateHeaderValue(self.contentType); 99 | if ([mimeType isEqualToString:@"application/json"] || [mimeType isEqualToString:@"text/json"] || [mimeType isEqualToString:@"text/javascript"]) { 100 | _jsonObject = [NSJSONSerialization JSONObjectWithData:_data options:0 error:NULL]; 101 | } else { 102 | GWS_DNOT_REACHED(); 103 | } 104 | } 105 | return _jsonObject; 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Requests/GCDWebServerFileRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerRequest.h" 29 | 30 | /** 31 | * The GCDWebServerFileRequest subclass of GCDWebServerRequest stores the body 32 | * of the HTTP request to a file on disk. 33 | */ 34 | @interface GCDWebServerFileRequest : GCDWebServerRequest 35 | 36 | /** 37 | * Returns the path to the temporary file containing the request body. 38 | * 39 | * @warning This temporary file will be automatically deleted when the 40 | * GCDWebServerFileRequest is deallocated. If you want to preserve this file, 41 | * you must move it to a different location beforehand. 42 | */ 43 | @property(nonatomic, readonly) NSString* temporaryPath; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Requests/GCDWebServerFileRequest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerFileRequest () { 35 | @private 36 | NSString* _temporaryPath; 37 | int _file; 38 | } 39 | @end 40 | 41 | @implementation GCDWebServerFileRequest 42 | 43 | @synthesize temporaryPath=_temporaryPath; 44 | 45 | - (instancetype)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query { 46 | if ((self = [super initWithMethod:method url:url headers:headers path:path query:query])) { 47 | _temporaryPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]; 48 | } 49 | return self; 50 | } 51 | 52 | - (void)dealloc { 53 | unlink([_temporaryPath fileSystemRepresentation]); 54 | } 55 | 56 | - (BOOL)open:(NSError**)error { 57 | _file = open([_temporaryPath fileSystemRepresentation], O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); 58 | if (_file <= 0) { 59 | if (error) { 60 | *error = GCDWebServerMakePosixError(errno); 61 | } 62 | return NO; 63 | } 64 | return YES; 65 | } 66 | 67 | - (BOOL)writeData:(NSData*)data error:(NSError**)error { 68 | if (write(_file, data.bytes, data.length) != (ssize_t)data.length) { 69 | if (error) { 70 | *error = GCDWebServerMakePosixError(errno); 71 | } 72 | return NO; 73 | } 74 | return YES; 75 | } 76 | 77 | - (BOOL)close:(NSError**)error { 78 | if (close(_file) < 0) { 79 | if (error) { 80 | *error = GCDWebServerMakePosixError(errno); 81 | } 82 | return NO; 83 | } 84 | #ifdef __GCDWEBSERVER_ENABLE_TESTING__ 85 | NSString* creationDateHeader = [self.headers objectForKey:@"X-GCDWebServer-CreationDate"]; 86 | if (creationDateHeader) { 87 | NSDate* date = GCDWebServerParseISO8601(creationDateHeader); 88 | if (!date || ![[NSFileManager defaultManager] setAttributes:@{NSFileCreationDate: date} ofItemAtPath:_temporaryPath error:error]) { 89 | return NO; 90 | } 91 | } 92 | NSString* modifiedDateHeader = [self.headers objectForKey:@"X-GCDWebServer-ModifiedDate"]; 93 | if (modifiedDateHeader) { 94 | NSDate* date = GCDWebServerParseRFC822(modifiedDateHeader); 95 | if (!date || ![[NSFileManager defaultManager] setAttributes:@{NSFileModificationDate: date} ofItemAtPath:_temporaryPath error:error]) { 96 | return NO; 97 | } 98 | } 99 | #endif 100 | return YES; 101 | } 102 | 103 | - (NSString*)description { 104 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 105 | [description appendFormat:@"\n\n{%@}", _temporaryPath]; 106 | return description; 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Requests/GCDWebServerMultiPartFormRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerRequest.h" 29 | 30 | /** 31 | * The GCDWebServerMultiPart class is an abstract class that wraps the content 32 | * of a part. 33 | */ 34 | @interface GCDWebServerMultiPart : NSObject 35 | 36 | /** 37 | * Returns the control name retrieved from the part headers. 38 | */ 39 | @property(nonatomic, readonly) NSString* controlName; 40 | 41 | /** 42 | * Returns the content type retrieved from the part headers or "text/plain" 43 | * if not available (per HTTP specifications). 44 | */ 45 | @property(nonatomic, readonly) NSString* contentType; 46 | 47 | /** 48 | * Returns the MIME type component of the content type for the part. 49 | */ 50 | @property(nonatomic, readonly) NSString* mimeType; 51 | 52 | @end 53 | 54 | /** 55 | * The GCDWebServerMultiPartArgument subclass of GCDWebServerMultiPart wraps 56 | * the content of a part as data in memory. 57 | */ 58 | @interface GCDWebServerMultiPartArgument : GCDWebServerMultiPart 59 | 60 | /** 61 | * Returns the data for the part. 62 | */ 63 | @property(nonatomic, readonly) NSData* data; 64 | 65 | /** 66 | * Returns the data for the part interpreted as text. If the content 67 | * type of the part is not a text one, or if an error occurs, nil is returned. 68 | * 69 | * The text encoding used to interpret the data is extracted from the 70 | * "Content-Type" header or defaults to UTF-8. 71 | */ 72 | @property(nonatomic, readonly) NSString* string; 73 | 74 | @end 75 | 76 | /** 77 | * The GCDWebServerMultiPartFile subclass of GCDWebServerMultiPart wraps 78 | * the content of a part as a file on disk. 79 | */ 80 | @interface GCDWebServerMultiPartFile : GCDWebServerMultiPart 81 | 82 | /** 83 | * Returns the file name retrieved from the part headers. 84 | */ 85 | @property(nonatomic, readonly) NSString* fileName; 86 | 87 | /** 88 | * Returns the path to the temporary file containing the part data. 89 | * 90 | * @warning This temporary file will be automatically deleted when the 91 | * GCDWebServerMultiPartFile is deallocated. If you want to preserve this file, 92 | * you must move it to a different location beforehand. 93 | */ 94 | @property(nonatomic, readonly) NSString* temporaryPath; 95 | 96 | @end 97 | 98 | /** 99 | * The GCDWebServerMultiPartFormRequest subclass of GCDWebServerRequest 100 | * parses the body of the HTTP request as a multipart encoded form. 101 | */ 102 | @interface GCDWebServerMultiPartFormRequest : GCDWebServerRequest 103 | 104 | /** 105 | * Returns the argument parts from the multipart encoded form as 106 | * name / GCDWebServerMultiPartArgument pairs. 107 | */ 108 | @property(nonatomic, readonly) NSArray* arguments; 109 | 110 | /** 111 | * Returns the files parts from the multipart encoded form as 112 | * name / GCDWebServerMultiPartFile pairs. 113 | */ 114 | @property(nonatomic, readonly) NSArray* files; 115 | 116 | /** 117 | * Returns the MIME type for multipart encoded forms 118 | * i.e. "multipart/form-data". 119 | */ 120 | + (NSString*)mimeType; 121 | 122 | /** 123 | * Returns the first argument for a given control name or nil if not found. 124 | */ 125 | - (GCDWebServerMultiPartArgument*)firstArgumentForControlName:(NSString*)name; 126 | 127 | /** 128 | * Returns the first file for a given control name or nil if not found. 129 | */ 130 | - (GCDWebServerMultiPartFile*)firstFileForControlName:(NSString*)name; 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Requests/GCDWebServerURLEncodedFormRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerDataRequest.h" 29 | 30 | /** 31 | * The GCDWebServerURLEncodedFormRequest subclass of GCDWebServerRequest 32 | * parses the body of the HTTP request as a URL encoded form using 33 | * GCDWebServerParseURLEncodedForm(). 34 | */ 35 | @interface GCDWebServerURLEncodedFormRequest : GCDWebServerDataRequest 36 | 37 | /** 38 | * Returns the unescaped control names and values for the URL encoded form. 39 | * 40 | * The text encoding used to interpret the data is extracted from the 41 | * "Content-Type" header or defaults to UTF-8. 42 | */ 43 | @property(nonatomic, readonly) NSDictionary* arguments; 44 | 45 | /** 46 | * Returns the MIME type for URL encoded forms 47 | * i.e. "application/x-www-form-urlencoded". 48 | */ 49 | + (NSString*)mimeType; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Requests/GCDWebServerURLEncodedFormRequest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerURLEncodedFormRequest () { 35 | @private 36 | NSDictionary* _arguments; 37 | } 38 | @end 39 | 40 | @implementation GCDWebServerURLEncodedFormRequest 41 | 42 | @synthesize arguments=_arguments; 43 | 44 | + (NSString*)mimeType { 45 | return @"application/x-www-form-urlencoded"; 46 | } 47 | 48 | - (BOOL)close:(NSError**)error { 49 | if (![super close:error]) { 50 | return NO; 51 | } 52 | 53 | NSString* charset = GCDWebServerExtractHeaderValueParameter(self.contentType, @"charset"); 54 | NSString* string = [[NSString alloc] initWithData:self.data encoding:GCDWebServerStringEncodingFromCharset(charset)]; 55 | _arguments = GCDWebServerParseURLEncodedForm(string); 56 | GWS_DCHECK(_arguments); 57 | 58 | return YES; 59 | } 60 | 61 | - (NSString*)description { 62 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 63 | [description appendString:@"\n"]; 64 | for (NSString* argument in [[_arguments allKeys] sortedArrayUsingSelector:@selector(compare:)]) { 65 | [description appendFormat:@"\n%@ = %@", argument, [_arguments objectForKey:argument]]; 66 | } 67 | return description; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Responses/GCDWebServerDataResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerResponse.h" 29 | 30 | /** 31 | * The GCDWebServerDataResponse subclass of GCDWebServerResponse reads the body 32 | * of the HTTP response from memory. 33 | */ 34 | @interface GCDWebServerDataResponse : GCDWebServerResponse 35 | 36 | /** 37 | * Creates a response with data in memory and a given content type. 38 | */ 39 | + (instancetype)responseWithData:(NSData*)data contentType:(NSString*)type; 40 | 41 | /** 42 | * This method is the designated initializer for the class. 43 | */ 44 | - (instancetype)initWithData:(NSData*)data contentType:(NSString*)type; 45 | 46 | @end 47 | 48 | @interface GCDWebServerDataResponse (Extensions) 49 | 50 | /** 51 | * Creates a data response from text encoded using UTF-8. 52 | */ 53 | + (instancetype)responseWithText:(NSString*)text; 54 | 55 | /** 56 | * Creates a data response from HTML encoded using UTF-8. 57 | */ 58 | + (instancetype)responseWithHTML:(NSString*)html; 59 | 60 | /** 61 | * Creates a data response from an HTML template encoded using UTF-8. 62 | * See -initWithHTMLTemplate:variables: for details. 63 | */ 64 | + (instancetype)responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables; 65 | 66 | /** 67 | * Creates a data response from a serialized JSON object and the default 68 | * "application/json" content type. 69 | */ 70 | + (instancetype)responseWithJSONObject:(id)object; 71 | 72 | /** 73 | * Creates a data response from a serialized JSON object and a custom 74 | * content type. 75 | */ 76 | + (instancetype)responseWithJSONObject:(id)object contentType:(NSString*)type; 77 | 78 | /** 79 | * Initializes a data response from text encoded using UTF-8. 80 | */ 81 | - (instancetype)initWithText:(NSString*)text; 82 | 83 | /** 84 | * Initializes a data response from HTML encoded using UTF-8. 85 | */ 86 | - (instancetype)initWithHTML:(NSString*)html; 87 | 88 | /** 89 | * Initializes a data response from an HTML template encoded using UTF-8. 90 | * 91 | * All occurences of "%variable%" within the HTML template are replaced with 92 | * their corresponding values. 93 | */ 94 | - (instancetype)initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables; 95 | 96 | /** 97 | * Initializes a data response from a serialized JSON object and the default 98 | * "application/json" content type. 99 | */ 100 | - (instancetype)initWithJSONObject:(id)object; 101 | 102 | /** 103 | * Initializes a data response from a serialized JSON object and a custom 104 | * content type. 105 | */ 106 | - (instancetype)initWithJSONObject:(id)object contentType:(NSString*)type; 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Responses/GCDWebServerDataResponse.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerDataResponse () { 35 | @private 36 | NSData* _data; 37 | BOOL _done; 38 | } 39 | @end 40 | 41 | @implementation GCDWebServerDataResponse 42 | 43 | + (instancetype)responseWithData:(NSData*)data contentType:(NSString*)type { 44 | return [[[self class] alloc] initWithData:data contentType:type]; 45 | } 46 | 47 | - (instancetype)initWithData:(NSData*)data contentType:(NSString*)type { 48 | if (data == nil) { 49 | GWS_DNOT_REACHED(); 50 | return nil; 51 | } 52 | 53 | if ((self = [super init])) { 54 | _data = data; 55 | 56 | self.contentType = type; 57 | self.contentLength = data.length; 58 | } 59 | return self; 60 | } 61 | 62 | - (NSData*)readData:(NSError**)error { 63 | NSData* data; 64 | if (_done) { 65 | data = [NSData data]; 66 | } else { 67 | data = _data; 68 | _done = YES; 69 | } 70 | return data; 71 | } 72 | 73 | - (NSString*)description { 74 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 75 | [description appendString:@"\n\n"]; 76 | [description appendString:GCDWebServerDescribeData(_data, self.contentType)]; 77 | return description; 78 | } 79 | 80 | @end 81 | 82 | @implementation GCDWebServerDataResponse (Extensions) 83 | 84 | + (instancetype)responseWithText:(NSString*)text { 85 | return [[self alloc] initWithText:text]; 86 | } 87 | 88 | + (instancetype)responseWithHTML:(NSString*)html { 89 | return [[self alloc] initWithHTML:html]; 90 | } 91 | 92 | + (instancetype)responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables { 93 | return [[self alloc] initWithHTMLTemplate:path variables:variables]; 94 | } 95 | 96 | + (instancetype)responseWithJSONObject:(id)object { 97 | return [[self alloc] initWithJSONObject:object]; 98 | } 99 | 100 | + (instancetype)responseWithJSONObject:(id)object contentType:(NSString*)type { 101 | return [[self alloc] initWithJSONObject:object contentType:type]; 102 | } 103 | 104 | - (instancetype)initWithText:(NSString*)text { 105 | NSData* data = [text dataUsingEncoding:NSUTF8StringEncoding]; 106 | if (data == nil) { 107 | GWS_DNOT_REACHED(); 108 | return nil; 109 | } 110 | return [self initWithData:data contentType:@"text/plain; charset=utf-8"]; 111 | } 112 | 113 | - (instancetype)initWithHTML:(NSString*)html { 114 | NSData* data = [html dataUsingEncoding:NSUTF8StringEncoding]; 115 | if (data == nil) { 116 | GWS_DNOT_REACHED(); 117 | return nil; 118 | } 119 | return [self initWithData:data contentType:@"text/html; charset=utf-8"]; 120 | } 121 | 122 | - (instancetype)initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables { 123 | NSMutableString* html = [[NSMutableString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL]; 124 | [variables enumerateKeysAndObjectsUsingBlock:^(NSString* key, NSString* value, BOOL* stop) { 125 | [html replaceOccurrencesOfString:[NSString stringWithFormat:@"%%%@%%", key] withString:value options:0 range:NSMakeRange(0, html.length)]; 126 | }]; 127 | id response = [self initWithHTML:html]; 128 | return response; 129 | } 130 | 131 | - (instancetype)initWithJSONObject:(id)object { 132 | return [self initWithJSONObject:object contentType:@"application/json"]; 133 | } 134 | 135 | - (instancetype)initWithJSONObject:(id)object contentType:(NSString*)type { 136 | NSData* data = [NSJSONSerialization dataWithJSONObject:object options:0 error:NULL]; 137 | if (data == nil) { 138 | return nil; 139 | } 140 | return [self initWithData:data contentType:type]; 141 | } 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Responses/GCDWebServerErrorResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerDataResponse.h" 29 | #import "GCDWebServerHTTPStatusCodes.h" 30 | 31 | /** 32 | * The GCDWebServerDataResponse subclass of GCDWebServerDataResponse generates 33 | * an HTML body from an HTTP status code and an error message. 34 | */ 35 | @interface GCDWebServerErrorResponse : GCDWebServerDataResponse 36 | 37 | /** 38 | * Creates a client error response with the corresponding HTTP status code. 39 | */ 40 | + (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3); 41 | 42 | /** 43 | * Creates a server error response with the corresponding HTTP status code. 44 | */ 45 | + (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3); 46 | 47 | /** 48 | * Creates a client error response with the corresponding HTTP status code 49 | * and an underlying NSError. 50 | */ 51 | + (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); 52 | 53 | /** 54 | * Creates a server error response with the corresponding HTTP status code 55 | * and an underlying NSError. 56 | */ 57 | + (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); 58 | 59 | /** 60 | * Initializes a client error response with the corresponding HTTP status code. 61 | */ 62 | - (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3); 63 | 64 | /** 65 | * Initializes a server error response with the corresponding HTTP status code. 66 | */ 67 | - (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3); 68 | 69 | /** 70 | * Initializes a client error response with the corresponding HTTP status code 71 | * and an underlying NSError. 72 | */ 73 | - (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); 74 | 75 | /** 76 | * Initializes a server error response with the corresponding HTTP status code 77 | * and an underlying NSError. 78 | */ 79 | - (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Responses/GCDWebServerFileResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerResponse.h" 29 | 30 | /** 31 | * The GCDWebServerFileResponse subclass of GCDWebServerResponse reads the body 32 | * of the HTTP response from a file on disk. 33 | * 34 | * It will automatically set the contentType, lastModifiedDate and eTag 35 | * properties of the GCDWebServerResponse according to the file extension and 36 | * metadata. 37 | */ 38 | @interface GCDWebServerFileResponse : GCDWebServerResponse 39 | 40 | /** 41 | * Creates a response with the contents of a file. 42 | */ 43 | + (instancetype)responseWithFile:(NSString*)path; 44 | 45 | /** 46 | * Creates a response like +responseWithFile: and sets the "Content-Disposition" 47 | * HTTP header for a download if the "attachment" argument is YES. 48 | */ 49 | + (instancetype)responseWithFile:(NSString*)path isAttachment:(BOOL)attachment; 50 | 51 | /** 52 | * Creates a response like +responseWithFile: but restricts the file contents 53 | * to a specific byte range. 54 | * 55 | * See -initWithFile:byteRange: for details. 56 | */ 57 | + (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range; 58 | 59 | /** 60 | * Creates a response like +responseWithFile:byteRange: and sets the 61 | * "Content-Disposition" HTTP header for a download if the "attachment" 62 | * argument is YES. 63 | */ 64 | + (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment; 65 | 66 | /** 67 | * Initializes a response with the contents of a file. 68 | */ 69 | - (instancetype)initWithFile:(NSString*)path; 70 | 71 | /** 72 | * Initializes a response like +responseWithFile: and sets the 73 | * "Content-Disposition" HTTP header for a download if the "attachment" 74 | * argument is YES. 75 | */ 76 | - (instancetype)initWithFile:(NSString*)path isAttachment:(BOOL)attachment; 77 | 78 | /** 79 | * Initializes a response like -initWithFile: but restricts the file contents 80 | * to a specific byte range. This range should be set to (NSUIntegerMax, 0) for 81 | * the full file, (offset, length) if expressed from the beginning of the file, 82 | * or (NSUIntegerMax, length) if expressed from the end of the file. The "offset" 83 | * and "length" values will be automatically adjusted to be compatible with the 84 | * actual size of the file. 85 | * 86 | * This argument would typically be set to the value of the byteRange property 87 | * of the current GCDWebServerRequest. 88 | */ 89 | - (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range; 90 | 91 | /** 92 | * This method is the designated initializer for the class. 93 | */ 94 | - (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment; 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Responses/GCDWebServerStreamedResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerResponse.h" 29 | 30 | /** 31 | * The GCDWebServerStreamBlock is called to stream the data for the HTTP body. 32 | * The block must return either a chunk of data, an empty NSData when done, or 33 | * nil on error and set the "error" argument which is guaranteed to be non-NULL. 34 | */ 35 | typedef NSData* (^GCDWebServerStreamBlock)(NSError** error); 36 | 37 | /** 38 | * The GCDWebServerAsyncStreamBlock works like the GCDWebServerStreamBlock 39 | * except the streamed data can be returned at a later time allowing for 40 | * truly asynchronous generation of the data. 41 | * 42 | * The block must call "completionBlock" passing the new chunk of data when ready, 43 | * an empty NSData when done, or nil on error and pass a NSError. 44 | * 45 | * The block cannot call "completionBlock" more than once per invocation. 46 | */ 47 | typedef void (^GCDWebServerAsyncStreamBlock)(GCDWebServerBodyReaderCompletionBlock completionBlock); 48 | 49 | /** 50 | * The GCDWebServerStreamedResponse subclass of GCDWebServerResponse streams 51 | * the body of the HTTP response using a GCD block. 52 | */ 53 | @interface GCDWebServerStreamedResponse : GCDWebServerResponse 54 | 55 | /** 56 | * Creates a response with streamed data and a given content type. 57 | */ 58 | + (instancetype)responseWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block; 59 | 60 | /** 61 | * Creates a response with async streamed data and a given content type. 62 | */ 63 | + (instancetype)responseWithContentType:(NSString*)type asyncStreamBlock:(GCDWebServerAsyncStreamBlock)block; 64 | 65 | /** 66 | * Initializes a response with streamed data and a given content type. 67 | */ 68 | - (instancetype)initWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block; 69 | 70 | /** 71 | * This method is the designated initializer for the class. 72 | */ 73 | - (instancetype)initWithContentType:(NSString*)type asyncStreamBlock:(GCDWebServerAsyncStreamBlock)block; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/GCDWebServer/Responses/GCDWebServerStreamedResponse.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerStreamedResponse () { 35 | @private 36 | GCDWebServerAsyncStreamBlock _block; 37 | } 38 | @end 39 | 40 | @implementation GCDWebServerStreamedResponse 41 | 42 | + (instancetype)responseWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block { 43 | return [[[self class] alloc] initWithContentType:type streamBlock:block]; 44 | } 45 | 46 | + (instancetype)responseWithContentType:(NSString*)type asyncStreamBlock:(GCDWebServerAsyncStreamBlock)block { 47 | return [[[self class] alloc] initWithContentType:type asyncStreamBlock:block]; 48 | } 49 | 50 | - (instancetype)initWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block { 51 | return [self initWithContentType:type asyncStreamBlock:^(GCDWebServerBodyReaderCompletionBlock completionBlock) { 52 | 53 | NSError* error = nil; 54 | NSData* data = block(&error); 55 | completionBlock(data, error); 56 | 57 | }]; 58 | } 59 | 60 | - (instancetype)initWithContentType:(NSString*)type asyncStreamBlock:(GCDWebServerAsyncStreamBlock)block { 61 | if ((self = [super init])) { 62 | _block = [block copy]; 63 | 64 | self.contentType = type; 65 | } 66 | return self; 67 | } 68 | 69 | - (void)asyncReadDataWithCompletion:(GCDWebServerBodyReaderCompletionBlock)block { 70 | _block(block); 71 | } 72 | 73 | - (NSString*)description { 74 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 75 | [description appendString:@"\n\n"]; 76 | return description; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Pods/GCDWebServer/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2014, Pierre-Olivier Latour 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * The name of Pierre-Olivier Latour may not be used to endorse 12 | or promote products derived from this software without specific 13 | prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Pods/Headers/Private/BRLOptionParser/BRLOptionParser.h: -------------------------------------------------------------------------------- 1 | ../../../BRLOptionParser/BRLOptionParser/BRLOptionParser.h -------------------------------------------------------------------------------- /Pods/Headers/Public/BRLOptionParser/BRLOptionParser.h: -------------------------------------------------------------------------------- 1 | ../../../BRLOptionParser/BRLOptionParser/BRLOptionParser.h -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Alamofire (4.0.1) 3 | - BRLOptionParser (0.3.1) 4 | - GCDWebServer (3.3.3): 5 | - GCDWebServer/Core (= 3.3.3) 6 | - GCDWebServer/Core (3.3.3) 7 | 8 | DEPENDENCIES: 9 | - Alamofire (~> 4.0.1) 10 | - BRLOptionParser (~> 0.3.1) 11 | - GCDWebServer (~> 3.0) 12 | 13 | SPEC CHECKSUMS: 14 | Alamofire: 7682d43245de14874acd142ec137b144aa1dd335 15 | BRLOptionParser: a03256a8ff003ca1f5376c55f55f210e085a3958 16 | GCDWebServer: 1c39a1f0763e4eb492bee021e4270fce097d3555 17 | 18 | PODFILE CHECKSUM: e675030dbd86de38216dc6c44e64ca1458be94bc 19 | 20 | COCOAPODS: 1.2.0.beta.3 21 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Alamofire : NSObject 3 | @end 4 | @implementation PodsDummy_Alamofire 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double AlamofireVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char AlamofireVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire.modulemap: -------------------------------------------------------------------------------- 1 | framework module Alamofire { 2 | umbrella header "Alamofire-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Alamofire.xcconfig: -------------------------------------------------------------------------------- 1 | CODE_SIGN_IDENTITY = 2 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Alamofire 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/BRLOptionParser" 5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Alamofire 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Alamofire/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BRLOptionParser/BRLOptionParser-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_BRLOptionParser : NSObject 3 | @end 4 | @implementation PodsDummy_BRLOptionParser 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BRLOptionParser/BRLOptionParser-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BRLOptionParser/BRLOptionParser.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/BRLOptionParser 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/BRLOptionParser" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/BRLOptionParser" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/BRLOptionParser 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/GCDWebServer/GCDWebServer-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_GCDWebServer : NSObject 3 | @end 4 | @implementation PodsDummy_GCDWebServer 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/GCDWebServer/GCDWebServer-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/GCDWebServer/GCDWebServer-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "GCDWebServer.h" 14 | #import "GCDWebServerConnection.h" 15 | #import "GCDWebServerFunctions.h" 16 | #import "GCDWebServerHTTPStatusCodes.h" 17 | #import "GCDWebServerRequest.h" 18 | #import "GCDWebServerResponse.h" 19 | #import "GCDWebServerDataRequest.h" 20 | #import "GCDWebServerFileRequest.h" 21 | #import "GCDWebServerMultiPartFormRequest.h" 22 | #import "GCDWebServerURLEncodedFormRequest.h" 23 | #import "GCDWebServerDataResponse.h" 24 | #import "GCDWebServerErrorResponse.h" 25 | #import "GCDWebServerFileResponse.h" 26 | #import "GCDWebServerStreamedResponse.h" 27 | 28 | FOUNDATION_EXPORT double GCDWebServerVersionNumber; 29 | FOUNDATION_EXPORT const unsigned char GCDWebServerVersionString[]; 30 | 31 | -------------------------------------------------------------------------------- /Pods/Target Support Files/GCDWebServer/GCDWebServer.modulemap: -------------------------------------------------------------------------------- 1 | framework module GCDWebServer { 2 | umbrella header "GCDWebServer-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/GCDWebServer/GCDWebServer.xcconfig: -------------------------------------------------------------------------------- 1 | CODE_SIGN_IDENTITY = 2 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/GCDWebServer 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/BRLOptionParser" 5 | OTHER_LDFLAGS = -l"z" -framework "SystemConfiguration" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/GCDWebServer 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/GCDWebServer/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.3.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NG/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Alamofire 5 | 6 | Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | ## GCDWebServer 28 | 29 | Copyright (c) 2012-2014, Pierre-Olivier Latour 30 | All rights reserved. 31 | 32 | Redistribution and use in source and binary forms, with or without 33 | modification, are permitted provided that the following conditions are met: 34 | * Redistributions of source code must retain the above copyright 35 | notice, this list of conditions and the following disclaimer. 36 | * Redistributions in binary form must reproduce the above copyright 37 | notice, this list of conditions and the following disclaimer in the 38 | documentation and/or other materials provided with the distribution. 39 | * The name of Pierre-Olivier Latour may not be used to endorse 40 | or promote products derived from this software without specific 41 | prior written permission. 42 | 43 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 44 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 45 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 46 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 47 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 48 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 49 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 52 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 | 54 | Generated by CocoaPods - https://cocoapods.org 55 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/) 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | Alamofire 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Copyright (c) 2012-2014, Pierre-Olivier Latour 47 | All rights reserved. 48 | 49 | Redistribution and use in source and binary forms, with or without 50 | modification, are permitted provided that the following conditions are met: 51 | * Redistributions of source code must retain the above copyright 52 | notice, this list of conditions and the following disclaimer. 53 | * Redistributions in binary form must reproduce the above copyright 54 | notice, this list of conditions and the following disclaimer in the 55 | documentation and/or other materials provided with the distribution. 56 | * The name of Pierre-Olivier Latour may not be used to endorse 57 | or promote products derived from this software without specific 58 | prior written permission. 59 | 60 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 61 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 62 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 63 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 64 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 65 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 66 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 67 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 68 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 69 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 70 | 71 | License 72 | BSD 73 | Title 74 | GCDWebServer 75 | Type 76 | PSGroupSpecifier 77 | 78 | 79 | FooterText 80 | Generated by CocoaPods - https://cocoapods.org 81 | Title 82 | 83 | Type 84 | PSGroupSpecifier 85 | 86 | 87 | StringsTable 88 | Acknowledgements 89 | Title 90 | Acknowledgements 91 | 92 | 93 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_ShadowsocksX_NG : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_ShadowsocksX_NG 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | 91 | if [[ "$CONFIGURATION" == "Debug" ]]; then 92 | install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" 93 | install_framework "$BUILT_PRODUCTS_DIR/GCDWebServer/GCDWebServer.framework" 94 | fi 95 | if [[ "$CONFIGURATION" == "Release" ]]; then 96 | install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" 97 | install_framework "$BUILT_PRODUCTS_DIR/GCDWebServer/GCDWebServer.framework" 98 | fi 99 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 100 | wait 101 | fi 102 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_ShadowsocksX_NGVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_ShadowsocksX_NGVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CODE_SIGN_IDENTITY = 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/GCDWebServer" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/GCDWebServer/GCDWebServer.framework/Headers" 7 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "GCDWebServer" 8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 9 | PODS_BUILD_DIR = $BUILD_DIR 10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_ShadowsocksX_NG { 2 | umbrella header "Pods-ShadowsocksX-NG-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NG/Pods-ShadowsocksX-NG.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CODE_SIGN_IDENTITY = 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/GCDWebServer" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/GCDWebServer/GCDWebServer.framework/Headers" 7 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "GCDWebServer" 8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 9 | PODS_BUILD_DIR = $BUILD_DIR 10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Pods-ShadowsocksX-NGTests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Pods-ShadowsocksX-NGTests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Pods-ShadowsocksX-NGTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_ShadowsocksX_NGTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_ShadowsocksX_NGTests 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Pods-ShadowsocksX-NGTests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 91 | wait 92 | fi 93 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Pods-ShadowsocksX-NGTests-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_ShadowsocksX_NGTestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_ShadowsocksX_NGTestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Pods-ShadowsocksX-NGTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CODE_SIGN_IDENTITY = 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/GCDWebServer" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/GCDWebServer/GCDWebServer.framework/Headers" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Pods-ShadowsocksX-NGTests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_ShadowsocksX_NGTests { 2 | umbrella header "Pods-ShadowsocksX-NGTests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ShadowsocksX-NGTests/Pods-ShadowsocksX-NGTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | CODE_SIGN_IDENTITY = 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/GCDWebServer" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/GCDWebServer/GCDWebServer.framework/Headers" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-proxy_conf_helper/Pods-proxy_conf_helper-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## BRLOptionParser 5 | 6 | (The MIT License) 7 | 8 | Copyright © 2013-2015 Stephen Celis () 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy of 11 | this software and associated documentation files (the "Software"), to deal in 12 | the Software without restriction, including without limitation the rights to 13 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 14 | of the Software, and to permit persons to whom the Software is furnished to do 15 | so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | 29 | Generated by CocoaPods - https://cocoapods.org 30 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-proxy_conf_helper/Pods-proxy_conf_helper-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | (The MIT License) 18 | 19 | Copyright © 2013-2015 Stephen Celis (<stephen@stephencelis.com>) 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy of 22 | this software and associated documentation files (the "Software"), to deal in 23 | the Software without restriction, including without limitation the rights to 24 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 25 | of the Software, and to permit persons to whom the Software is furnished to do 26 | so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | 40 | License 41 | MIT 42 | Title 43 | BRLOptionParser 44 | Type 45 | PSGroupSpecifier 46 | 47 | 48 | FooterText 49 | Generated by CocoaPods - https://cocoapods.org 50 | Title 51 | 52 | Type 53 | PSGroupSpecifier 54 | 55 | 56 | StringsTable 57 | Acknowledgements 58 | Title 59 | Acknowledgements 60 | 61 | 62 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-proxy_conf_helper/Pods-proxy_conf_helper-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_proxy_conf_helper : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_proxy_conf_helper 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-proxy_conf_helper/Pods-proxy_conf_helper-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 91 | wait 92 | fi 93 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-proxy_conf_helper/Pods-proxy_conf_helper.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/BRLOptionParser" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/BRLOptionParser" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/BRLOptionParser" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"BRLOptionParser" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-proxy_conf_helper/Pods-proxy_conf_helper.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/BRLOptionParser" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/BRLOptionParser" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/BRLOptionParser" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"BRLOptionParser" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ShortcutSS - 中文 2 | 3 | **这是装备了全局快捷键切换代理模式的 Mac Shadowsocks 客户端** 4 | 5 | 因为网络状况的原因,需要频繁手动点击切换【PAC自动\全局\手动】代理模式,很麻烦。 6 | 对 [ShadowsocksX-NG](https://github.com/shadowsocks/ShadowsocksX-NG) 的代码略加以改动,做出了现在的 ShortcutSS。可以自定义设置全局快捷键,在使用任何软件时,都可以直接通过快捷键切换 ShortcutSS 的代理模式,无需去菜单栏手动点击。 7 | 8 | ![ScreenRecord](https://github.com/OpenMarshall/ShortcutSS/blob/develop/ScreenRecord/ScreenRecord_zh.gif) 9 | 10 | [点击下载 ShortcutSS.app.zip](https://github.com/OpenMarshall/ShortcutSS/raw/develop/ShortcutSS.app.zip) 11 | 12 | inspired by [MASShortcut](https://github.com/shpakovski/MASShortcut) 13 | 14 | # ShortcutSS - English 15 | 16 | **This is a Mac Shadowsocks client equipped with global shortcuts to switch proxy mode** 17 | 18 | Because of network conditions, I need to manually switch [PAC automatic \ global \ manual] proxy mode, that’s inconvenient. Slightly modified [ShadowsocksX-NG](https://github.com/shadowsocks/ShadowsocksX-NG), I made the ShortcutSS now. You can customize global shortcuts, and use it to switch ShortcutSS proxy mode when using any software, without clicking the menu bar manually. 19 | 20 | ![ScreenRecord](https://github.com/OpenMarshall/ShortcutSS/blob/develop/ScreenRecord/ScreenRecord_en.gif) 21 | 22 | [Click here to download ShortcutSS.app.zip](https://github.com/OpenMarshall/ShortcutSS/raw/develop/ShortcutSS.app.zip) 23 | 24 | inspired by [MASShortcut](https://github.com/shpakovski/MASShortcut) 25 | -------------------------------------------------------------------------------- /ScreenRecord/ScreenRecord_en.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ScreenRecord/ScreenRecord_en.gif -------------------------------------------------------------------------------- /ScreenRecord/ScreenRecord_zh.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ScreenRecord/ScreenRecord_zh.gif -------------------------------------------------------------------------------- /ShadowsocksX-NG.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ShadowsocksX-NG.xcodeproj/xcshareddata/xcschemes/ShadowsocksX-NGTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 14 | 15 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 40 | 41 | 42 | 48 | 49 | 51 | 52 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /ShadowsocksX-NG.xcodeproj/xcshareddata/xcschemes/proxy_conf_helper.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 81 | 87 | 88 | 89 | 90 | 92 | 93 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /ShadowsocksX-NG.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ShadowsocksX-NG.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/AdvPreferencesWindowController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AdvPreferencesWindowController.swift 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/6. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class AdvPreferencesWindowController: NSWindowController, NSWindowDelegate { 12 | 13 | override func windowDidLoad() { 14 | super.windowDidLoad() 15 | 16 | // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. 17 | self.window?.delegate = self 18 | } 19 | 20 | //------------------------------------------------------------ 21 | // NSWindowDelegate 22 | func windowWillClose(_ notification: Notification) { 23 | NotificationCenter.default 24 | .post(name: Notification.Name(rawValue: NOTIFY_ADV_CONF_CHANGED), object: nil) 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "Icon_16x16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "Icon_16x16@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "Icon_32x32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "Icon_32x32@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "Icon_128x128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "Icon_128x128@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "Icon_256x256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "Icon_256x256@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "Icon_512x512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "Icon_512x512@2x.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_128x128.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_128x128@2x.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_16x16.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_16x16@2x.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_256x256.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_256x256@2x.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_32x32.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_32x32@2x.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_512x512.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/Assets.xcassets/AppIcon.appiconset/Icon_512x512@2x.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /ShadowsocksX-NG/Base.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | * SHARED STRINGS 3 | */ 4 | 5 | /* 6 | * ./PACUtils.swift 7 | */ 8 | 9 | "PAC has been updated by latest GFW List." = "PAC has been updated by latest GFW List."; 10 | 11 | "Failed to download latest GFW List." = "Failed to download latest GFW List."; 12 | 13 | /* 14 | * ./PreferencesWindowController.swift 15 | */ 16 | 17 | "New Server" = "New Server"; 18 | 19 | /* 20 | * ./AppDelegate.swift 21 | */ 22 | 23 | "Add Shadowsocks Server Profile" = "Add Shadowsocks Server Profile"; 24 | 25 | "By scan QR Code" = "By scan QR Code"; 26 | 27 | "By Handle SS URL" = "By Handle SS URL"; 28 | 29 | " Encription Method: \(profile.method)" = " Encription Method: \(profile.method)"; 30 | 31 | "Current server profile is not valid." = "Current server profile is not valid."; 32 | 33 | "No current server profile." = "No current server profile."; 34 | 35 | "Shadowsocks: On" = "Shadowsocks: On"; 36 | 37 | "Turn Shadowsocks Off" = "Turn Shadowsocks Off"; 38 | 39 | "Shadowsocks: Off" = "Shadowsocks: Off"; 40 | 41 | "Turn Shadowsocks On" = "Turn Shadowsocks On"; 42 | 43 | "Proxy - Auto By PAC" = "Proxy - Auto By PAC"; 44 | 45 | "Proxy - Global" = "Proxy - Global"; 46 | 47 | "Proxy - Manual" = "Proxy - Manual"; 48 | 49 | "Servers" = "Servers"; 50 | 51 | "Auto" = "PAC"; 52 | 53 | "Global" = "Global"; 54 | 55 | "Manual" = "Manual"; 56 | 57 | "Show Running Mode On Status Bar" = "Show Running Mode On Status Bar"; 58 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/HTTPPreferencesWindowController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPPreferencesWindowController.swift 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 王晨 on 2016/10/7. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class HTTPPreferencesWindowController: NSWindowController, NSWindowDelegate { 12 | 13 | override func windowDidLoad() { 14 | super.windowDidLoad() 15 | 16 | // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. 17 | self.window?.delegate = self 18 | } 19 | 20 | //------------------------------------------------------------ 21 | // NSWindowDelegate 22 | func windowWillClose(_ notification: Notification) { 23 | NotificationCenter.default 24 | .post(name: Notification.Name(rawValue: NOTIFY_HTTP_CONF_CHANGED), object: nil) 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ShortcutSS 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | $(PRODUCT_NAME) 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.3.2 23 | CFBundleSignature 24 | ???? 25 | CFBundleURLTypes 26 | 27 | 28 | CFBundleTypeRole 29 | Viewer 30 | CFBundleURLIconFile 31 | menu_icon@2x 32 | CFBundleURLName 33 | shadowsocks 34 | CFBundleURLSchemes 35 | 36 | ss 37 | 38 | 39 | 40 | CFBundleVersion 41 | 1 42 | LSApplicationCategoryType 43 | public.app-category.utilities 44 | LSMinimumSystemVersion 45 | $(MACOSX_DEPLOYMENT_TARGET) 46 | LSUIElement 47 | 48 | NSHumanReadableCopyright 49 | Copyright © 2016年 qiuyuzhou. All rights reserved. License GPLv3. 50 | NSMainNibFile 51 | MainMenu 52 | NSPrincipalClass 53 | SWBApplication 54 | 55 | 56 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/LaunchAtLoginController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LaunchAtLoginController.h 3 | // 4 | // Copyright 2011 Tomáš Znamenáček 5 | // Copyright 2010 Ben Clark-Robinson 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining 8 | // a copy of this software and associated documentation files (the ‘Software’), 9 | // to deal in the Software without restriction, including without limitation 10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | // and/or sell copies of the Software, and to permit persons to whom the 12 | // Software is furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | #import 25 | 26 | @interface LaunchAtLoginController : NSObject 27 | 28 | @property(assign) BOOL launchAtLogin; 29 | 30 | - (BOOL) willLaunchAtLogin: (NSURL*) itemURL; 31 | - (void) setLaunchAtLogin: (BOOL) enabled forURL: (NSURL*) itemURL; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/LaunchAtLoginController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LaunchAtLoginController.m 3 | // 4 | // Copyright 2011 Tomáš Znamenáček 5 | // Copyright 2010 Ben Clark-Robinson 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining 8 | // a copy of this software and associated documentation files (the ‘Software’), 9 | // to deal in the Software without restriction, including without limitation 10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | // and/or sell copies of the Software, and to permit persons to whom the 12 | // Software is furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | #import "LaunchAtLoginController.h" 26 | 27 | static NSString *const StartAtLoginKey = @"launchAtLogin"; 28 | 29 | @interface LaunchAtLoginController () 30 | @property(assign) LSSharedFileListRef loginItems; 31 | @end 32 | 33 | @implementation LaunchAtLoginController 34 | @synthesize loginItems; 35 | 36 | #pragma mark Change Observing 37 | 38 | void sharedFileListDidChange(LSSharedFileListRef inList, void *context) 39 | { 40 | LaunchAtLoginController *self = (__bridge id) context; 41 | [self willChangeValueForKey:StartAtLoginKey]; 42 | [self didChangeValueForKey:StartAtLoginKey]; 43 | } 44 | 45 | #pragma mark Initialization 46 | 47 | - (id) init 48 | { 49 | self = [super init]; 50 | if (self) { 51 | loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL); 52 | LSSharedFileListAddObserver(loginItems, CFRunLoopGetMain(), 53 | (CFStringRef)NSDefaultRunLoopMode, sharedFileListDidChange, (__bridge void *)(self)); 54 | } 55 | return self; 56 | } 57 | 58 | - (void) dealloc 59 | { 60 | LSSharedFileListRemoveObserver(loginItems, CFRunLoopGetMain(), 61 | (CFStringRef)NSDefaultRunLoopMode, sharedFileListDidChange, (__bridge void *)(self)); 62 | CFRelease(loginItems); 63 | } 64 | 65 | #pragma mark Launch List Control 66 | 67 | - (LSSharedFileListItemRef) findItemWithURL: (NSURL*) wantedURL inFileList: (LSSharedFileListRef) fileList 68 | { 69 | if (wantedURL == NULL || fileList == NULL) 70 | return NULL; 71 | 72 | NSArray *listSnapshot = ((__bridge NSArray *)(LSSharedFileListCopySnapshot(fileList, NULL))); 73 | for (id itemObject in listSnapshot) { 74 | LSSharedFileListItemRef item = (__bridge LSSharedFileListItemRef) itemObject; 75 | UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes; 76 | CFURLRef currentItemURL = NULL; 77 | currentItemURL = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, NULL); 78 | if (currentItemURL && CFEqual(currentItemURL, (__bridge CFTypeRef)(wantedURL))) { 79 | CFRelease(currentItemURL); 80 | return item; 81 | } 82 | if (currentItemURL) 83 | CFRelease(currentItemURL); 84 | } 85 | 86 | return NULL; 87 | } 88 | 89 | - (BOOL) willLaunchAtLogin: (NSURL*) itemURL 90 | { 91 | return !![self findItemWithURL:itemURL inFileList:loginItems]; 92 | } 93 | 94 | - (void) setLaunchAtLogin: (BOOL) enabled forURL: (NSURL*) itemURL 95 | { 96 | LSSharedFileListItemRef appItem = [self findItemWithURL:itemURL inFileList:loginItems]; 97 | if (enabled && !appItem) { 98 | LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, 99 | NULL, NULL, (__bridge CFURLRef)itemURL, NULL, NULL); 100 | } else if (!enabled && appItem) 101 | LSSharedFileListItemRemove(loginItems, appItem); 102 | } 103 | 104 | #pragma mark Basic Interface 105 | 106 | - (NSURL*) appURL 107 | { 108 | return [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]; 109 | } 110 | 111 | - (void) setLaunchAtLogin: (BOOL) enabled 112 | { 113 | [self willChangeValueForKey:StartAtLoginKey]; 114 | [self setLaunchAtLogin:enabled forURL:[self appURL]]; 115 | [self didChangeValueForKey:StartAtLoginKey]; 116 | } 117 | 118 | - (BOOL) launchAtLogin 119 | { 120 | return [self willLaunchAtLogin:[self appURL]]; 121 | } 122 | 123 | @end 124 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/MASShortcut: -------------------------------------------------------------------------------- 1 | Versions/Current/MASShortcut -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Modules: -------------------------------------------------------------------------------- 1 | Versions/Current/Modules -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/MASDictionaryTransformer.h: -------------------------------------------------------------------------------- 1 | extern NSString *const MASDictionaryTransformerName; 2 | 3 | /** 4 | Converts shortcuts for storage in user defaults. 5 | 6 | User defaults can’t stored custom types directly, they have to 7 | be serialized to `NSData` or some other supported type like an 8 | `NSDictionary`. In Cocoa Bindings, the conversion can be done 9 | using value transformers like this one. 10 | 11 | There’s a built-in transformer (`NSKeyedUnarchiveFromDataTransformerName`) 12 | that converts any `NSCoding` types to `NSData`, but with shortcuts 13 | it makes sense to use a dictionary instead – the defaults look better 14 | when inspected with the `defaults` command-line utility and the 15 | format is compatible with an older sortcut library called Shortcut 16 | Recorder. 17 | */ 18 | @interface MASDictionaryTransformer : NSValueTransformer 19 | @end 20 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/MASKeyCodes.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "MASKeyMasks.h" 4 | 5 | // These glyphs are missed in Carbon.h 6 | typedef NS_ENUM(unsigned short, kMASShortcutGlyph) { 7 | kMASShortcutGlyphEject = 0x23CF, 8 | kMASShortcutGlyphClear = 0x2715, 9 | kMASShortcutGlyphDeleteLeft = 0x232B, 10 | kMASShortcutGlyphDeleteRight = 0x2326, 11 | kMASShortcutGlyphLeftArrow = 0x2190, 12 | kMASShortcutGlyphRightArrow = 0x2192, 13 | kMASShortcutGlyphUpArrow = 0x2191, 14 | kMASShortcutGlyphDownArrow = 0x2193, 15 | kMASShortcutGlyphEscape = 0x238B, 16 | kMASShortcutGlyphHelp = 0x003F, 17 | kMASShortcutGlyphPageDown = 0x21DF, 18 | kMASShortcutGlyphPageUp = 0x21DE, 19 | kMASShortcutGlyphTabRight = 0x21E5, 20 | kMASShortcutGlyphReturn = 0x2305, 21 | kMASShortcutGlyphReturnR2L = 0x21A9, 22 | kMASShortcutGlyphPadClear = 0x2327, 23 | kMASShortcutGlyphNorthwestArrow = 0x2196, 24 | kMASShortcutGlyphSoutheastArrow = 0x2198, 25 | }; 26 | 27 | NS_INLINE NSString* NSStringFromMASKeyCode(unsigned short ch) 28 | { 29 | return [NSString stringWithFormat:@"%C", ch]; 30 | } 31 | 32 | NS_INLINE NSUInteger MASPickCocoaModifiers(NSUInteger flags) 33 | { 34 | return (flags & (NSEventModifierFlagControl | NSEventModifierFlagShift | NSEventModifierFlagOption | NSEventModifierFlagCommand)); 35 | } 36 | 37 | NS_INLINE UInt32 MASCarbonModifiersFromCocoaModifiers(NSUInteger cocoaFlags) 38 | { 39 | return 40 | (cocoaFlags & NSEventModifierFlagCommand ? cmdKey : 0) 41 | | (cocoaFlags & NSEventModifierFlagOption ? optionKey : 0) 42 | | (cocoaFlags & NSEventModifierFlagControl ? controlKey : 0) 43 | | (cocoaFlags & NSEventModifierFlagShift ? shiftKey : 0); 44 | } 45 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/MASKeyMasks.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | // https://github.com/shpakovski/MASShortcut/issues/99 4 | // 5 | // Long story short: NSControlKeyMask and friends were replaced with NSEventModifierFlagControl 6 | // and similar in macOS Sierra. The project builds fine & clean, but including MASShortcut in 7 | // a project with deployment target set to 10.12 results in several deprecation warnings because 8 | // of the control masks. Simply replacing the old symbols with the new ones isn’t an option, 9 | // since it breaks the build on older SDKs – in Travis, for example. 10 | // 11 | // It should be safe to remove this whole thing once the 10.12 SDK is ubiquitous. 12 | 13 | #if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200 14 | #define NSEventModifierFlagCommand NSCommandKeyMask 15 | #define NSEventModifierFlagControl NSControlKeyMask 16 | #define NSEventModifierFlagOption NSAlternateKeyMask 17 | #define NSEventModifierFlagShift NSShiftKeyMask 18 | #endif 19 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/MASShortcut.h: -------------------------------------------------------------------------------- 1 | #import "MASKeyCodes.h" 2 | 3 | /** 4 | A model class to hold a key combination. 5 | 6 | This class just represents a combination of keys. It does not care if 7 | the combination is valid or can be used as a hotkey, it doesn’t watch 8 | the input system for the shortcut appearance, nor it does access user 9 | defaults. 10 | */ 11 | @interface MASShortcut : NSObject 12 | 13 | /** 14 | The virtual key code for the keyboard key. 15 | 16 | Hardware independent, same as in `NSEvent`. See `Events.h` in the HIToolbox 17 | framework for a complete list, or Command-click this symbol: `kVK_ANSI_A`. 18 | */ 19 | @property (nonatomic, readonly) NSUInteger keyCode; 20 | 21 | /** 22 | Cocoa keyboard modifier flags. 23 | 24 | Same as in `NSEvent`: `NSCommandKeyMask`, `NSAlternateKeyMask`, etc. 25 | */ 26 | @property (nonatomic, readonly) NSUInteger modifierFlags; 27 | 28 | /** 29 | Same as `keyCode`, just a different type. 30 | */ 31 | @property (nonatomic, readonly) UInt32 carbonKeyCode; 32 | 33 | /** 34 | Carbon modifier flags. 35 | 36 | A bit sum of `cmdKey`, `optionKey`, etc. 37 | */ 38 | @property (nonatomic, readonly) UInt32 carbonFlags; 39 | 40 | /** 41 | A string representing the “key” part of a shortcut, like the `5` in `⌘5`. 42 | 43 | @warning The value may change depending on the active keyboard layout. 44 | For example for the `^2` keyboard shortcut (`kVK_ANSI_2+NSControlKeyMask` 45 | to be precise) the `keyCodeString` is `2` on the US keyboard, but `ě` when 46 | the Czech keyboard layout is active. See the spec for details. 47 | */ 48 | @property (nonatomic, readonly) NSString *keyCodeString; 49 | 50 | /** 51 | A key-code string used in key equivalent matching. 52 | 53 | For precise meaning of “key equivalents” see the `keyEquivalent` 54 | property of `NSMenuItem`. Here the string is used to support shortcut 55 | validation (“is the shortcut already taken in this menu?”) and 56 | for display in `NSMenu`. 57 | 58 | The value of this property may differ from `keyCodeString`. For example 59 | the Russian keyboard has a `Г` (Ge) Cyrillic character in place of the 60 | latin `U` key. This means you can create a `^Г` shortcut, but in menus 61 | that’s always displayed as `^U`. So the `keyCodeString` returns `Г` 62 | and `keyCodeStringForKeyEquivalent` returns `U`. 63 | */ 64 | @property (nonatomic, readonly) NSString *keyCodeStringForKeyEquivalent; 65 | 66 | /** 67 | A string representing the shortcut modifiers, like the `⌘` in `⌘5`. 68 | */ 69 | @property (nonatomic, readonly) NSString *modifierFlagsString; 70 | 71 | - (instancetype)initWithKeyCode:(NSUInteger)code modifierFlags:(NSUInteger)flags; 72 | + (instancetype)shortcutWithKeyCode:(NSUInteger)code modifierFlags:(NSUInteger)flags; 73 | 74 | /** 75 | Creates a new shortcut from an `NSEvent` object. 76 | 77 | This is just a convenience initializer that reads the key code and modifiers from an `NSEvent`. 78 | */ 79 | + (instancetype)shortcutWithEvent:(NSEvent *)anEvent; 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/MASShortcutBinder.h: -------------------------------------------------------------------------------- 1 | #import "MASShortcutMonitor.h" 2 | 3 | /** 4 | Binds actions to user defaults keys. 5 | 6 | If you store shortcuts in user defaults (for example by binding 7 | a `MASShortcutView` to user defaults), you can use this class to 8 | connect an action directly to a user defaults key. If the shortcut 9 | stored under the key changes, the action will get automatically 10 | updated to the new one. 11 | 12 | This class is mostly a wrapper around a `MASShortcutMonitor`. It 13 | watches the changes in user defaults and updates the shortcut monitor 14 | accordingly with the new shortcuts. 15 | */ 16 | @interface MASShortcutBinder : NSObject 17 | 18 | /** 19 | A convenience shared instance. 20 | 21 | You may use it so that you don’t have to manage an instance by hand, 22 | but it’s perfectly fine to allocate and use a separate instance instead. 23 | */ 24 | + (instancetype) sharedBinder; 25 | 26 | /** 27 | The underlying shortcut monitor. 28 | */ 29 | @property(strong) MASShortcutMonitor *shortcutMonitor; 30 | 31 | /** 32 | Binding options customizing the access to user defaults. 33 | 34 | As an example, you can use `NSValueTransformerNameBindingOption` to customize 35 | the storage format used for the shortcuts. By default the shortcuts are converted 36 | from `NSData` (`NSKeyedUnarchiveFromDataTransformerName`). Note that if the 37 | binder is to work with `MASShortcutView`, both object have to use the same storage 38 | format. 39 | */ 40 | @property(copy) NSDictionary *bindingOptions; 41 | 42 | /** 43 | Binds given action to a shortcut stored under the given defaults key. 44 | 45 | In other words, no matter what shortcut you store under the given key, 46 | pressing it will always trigger the given action. 47 | */ 48 | - (void) bindShortcutWithDefaultsKey: (NSString*) defaultsKeyName toAction: (dispatch_block_t) action; 49 | 50 | /** 51 | Disconnect the binding between user defaults and action. 52 | 53 | In other words, the shortcut stored under the given key will no longer trigger an action. 54 | */ 55 | - (void) breakBindingWithDefaultsKey: (NSString*) defaultsKeyName; 56 | 57 | /** 58 | Register default shortcuts in user defaults. 59 | 60 | This is a convenience frontent to `[NSUserDefaults registerDefaults]`. 61 | The dictionary should contain a map of user defaults’ keys to appropriate 62 | keyboard shortcuts. The shortcuts will be transformed according to 63 | `bindingOptions` and registered using `registerDefaults`. 64 | */ 65 | - (void) registerDefaultShortcuts: (NSDictionary*) defaultShortcuts; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/MASShortcutMonitor.h: -------------------------------------------------------------------------------- 1 | #import "MASShortcut.h" 2 | 3 | /** 4 | Executes action when a shortcut is pressed. 5 | 6 | There can only be one instance of this class, otherwise things 7 | will probably not work. (There’s a Carbon event handler inside 8 | and there can only be one Carbon event handler of a given type.) 9 | */ 10 | @interface MASShortcutMonitor : NSObject 11 | 12 | - (instancetype) init __unavailable; 13 | + (instancetype) sharedMonitor; 14 | 15 | /** 16 | Register a shortcut along with an action. 17 | 18 | Attempting to insert an already registered shortcut probably won’t work. 19 | It may burn your house or cut your fingers. You have been warned. 20 | */ 21 | - (BOOL) registerShortcut: (MASShortcut*) shortcut withAction: (dispatch_block_t) action; 22 | - (BOOL) isShortcutRegistered: (MASShortcut*) shortcut; 23 | 24 | - (void) unregisterShortcut: (MASShortcut*) shortcut; 25 | - (void) unregisterAllShortcuts; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/MASShortcutValidator.h: -------------------------------------------------------------------------------- 1 | #import "MASShortcut.h" 2 | 3 | /** 4 | This class is used by the recording control to tell which shortcuts are acceptable. 5 | 6 | There are two kinds of shortcuts that are not considered acceptable: shortcuts that 7 | are too simple (like single letter keys) and shortcuts that are already used by the 8 | operating system. 9 | */ 10 | @interface MASShortcutValidator : NSObject 11 | 12 | /** 13 | Set to `YES` if you want to accept Option-something shortcuts. 14 | 15 | `NO` by default, since Option-something shortcuts are often used by system, 16 | for example Option-G will type the © sign. This also applies to Option-Shift 17 | shortcuts – in other words, shortcut recorder will not accept shortcuts like 18 | Option-Shift-K by default. (Again, since Option-Shift-K inserts the Apple 19 | logo sign by default.) 20 | */ 21 | @property(assign) BOOL allowAnyShortcutWithOptionModifier; 22 | 23 | + (instancetype) sharedValidator; 24 | 25 | - (BOOL) isShortcutValid: (MASShortcut*) shortcut; 26 | - (BOOL) isShortcut: (MASShortcut*) shortcut alreadyTakenInMenu: (NSMenu*) menu explanation: (NSString**) explanation; 27 | - (BOOL) isShortcutAlreadyTakenBySystem: (MASShortcut*) shortcut explanation: (NSString**) explanation; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/MASShortcutView+Bindings.h: -------------------------------------------------------------------------------- 1 | #import "MASShortcutView.h" 2 | 3 | /** 4 | A simplified interface to bind the recorder value to user defaults. 5 | 6 | You can bind the `shortcutValue` to user defaults using the standard 7 | `bind:toObject:withKeyPath:options:` call, but since that’s a lot to type 8 | and read, here’s a simpler option. 9 | 10 | Setting the `associatedUserDefaultsKey` binds the view’s shortcut value 11 | to the given user defaults key. You can supply a value transformer to convert 12 | values between user defaults and `MASShortcut`. If you don’t supply 13 | a transformer, the `NSUnarchiveFromDataTransformerName` will be used 14 | automatically. 15 | 16 | Set `associatedUserDefaultsKey` to `nil` to disconnect the binding. 17 | */ 18 | @interface MASShortcutView (Bindings) 19 | 20 | @property(copy) NSString *associatedUserDefaultsKey; 21 | 22 | - (void) setAssociatedUserDefaultsKey: (NSString*) newKey withTransformer: (NSValueTransformer*) transformer; 23 | - (void) setAssociatedUserDefaultsKey: (NSString*) newKey withTransformerName: (NSString*) transformerName; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/MASShortcutView.h: -------------------------------------------------------------------------------- 1 | @class MASShortcut, MASShortcutValidator; 2 | 3 | extern NSString *const MASShortcutBinding; 4 | 5 | typedef NS_ENUM(NSInteger, MASShortcutViewStyle) { 6 | MASShortcutViewStyleDefault = 0, // Height = 19 px 7 | MASShortcutViewStyleTexturedRect, // Height = 25 px 8 | MASShortcutViewStyleRounded, // Height = 43 px 9 | MASShortcutViewStyleFlat 10 | }; 11 | 12 | @interface MASShortcutView : NSView 13 | 14 | @property (nonatomic, strong) MASShortcut *shortcutValue; 15 | @property (nonatomic, strong) MASShortcutValidator *shortcutValidator; 16 | @property (nonatomic, getter = isRecording) BOOL recording; 17 | @property (nonatomic, getter = isEnabled) BOOL enabled; 18 | @property (nonatomic, copy) void (^shortcutValueChange)(MASShortcutView *sender); 19 | @property (nonatomic, assign) MASShortcutViewStyle style; 20 | 21 | /// Returns custom class for drawing control. 22 | + (Class)shortcutCellClass; 23 | 24 | - (void)setAcceptsFirstResponder:(BOOL)value; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Headers/Shortcut.h: -------------------------------------------------------------------------------- 1 | #import "MASKeyMasks.h" 2 | #import "MASShortcut.h" 3 | #import "MASShortcutValidator.h" 4 | #import "MASShortcutMonitor.h" 5 | #import "MASShortcutBinder.h" 6 | #import "MASDictionaryTransformer.h" 7 | #import "MASShortcutView.h" 8 | #import "MASShortcutView+Bindings.h" 9 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/MASShortcut: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/MASShortcut -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module MASShortcut { 2 | umbrella header "Shortcut.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 16B2555 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | MASShortcut 11 | CFBundleIdentifier 12 | com.github.shpakovski.MASShortcut 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | MASShortcut 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 2.3.6 21 | CFBundleSupportedPlatforms 22 | 23 | MacOSX 24 | 25 | CFBundleVersion 26 | 2.3.6 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 8B62 31 | DTPlatformVersion 32 | GM 33 | DTSDKBuild 34 | 16B2649 35 | DTSDKName 36 | macosx10.12 37 | DTXcode 38 | 0810 39 | DTXcodeBuild 40 | 8B62 41 | NSHumanReadableCopyright 42 | Copyright © Vadim Shpakovski. All rights reserved. 43 | 44 | 45 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/cs.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/cs.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/de.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/de.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/en.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/es.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/es.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/fr.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/fr.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/it.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/it.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/ja.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/ja.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/ko.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/ko.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/nl.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/nl.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/pl.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/pl.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/ru.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/ru.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/zh-Hans.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/zh-Hant.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/MASShortcut.framework/Versions/A/Resources/zh-Hant.lproj/Localizable.strings -------------------------------------------------------------------------------- /ShadowsocksX-NG/MASShortcut.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /ShadowsocksX-NG/Notifications.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Notifications.swift 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/7. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | let NOTIFY_SERVER_PROFILES_CHANGED = "NOTIFY_SERVER_PROFILES_CHANGED" 12 | let NOTIFY_ADV_PROXY_CONF_CHANGED = "NOTIFY_ADV_PROXY_CONF_CHANGED" 13 | let NOTIFY_ADV_CONF_CHANGED = "NOTIFY_ADV_CONF_CHANGED" 14 | let NOTIFY_HTTP_CONF_CHANGED = "NOTIFY_HTTP_CONF_CHANGED" 15 | let NOTIFY_INVALIDE_QR = "NOTIFY_INVALIDE_QR" 16 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/ProxyConfHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProxyConfHelper.h 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/10. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface ProxyConfHelper : NSObject 14 | 15 | + (void)install; 16 | 17 | + (void)enablePACProxy; 18 | 19 | + (void)enableGlobalProxy; 20 | 21 | + (void)disableProxy; 22 | 23 | + (void)startMonitorPAC; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/ProxyConfTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProxyConfTool.h 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/29. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface ProxyConfTool : NSObject 13 | 14 | +(NSArray*)networkServicesList; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/ProxyConfTool.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProxyConfTool.m 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/29. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | #import "ProxyConfTool.h" 10 | #import 11 | 12 | //https://developer.apple.com/library/mac/documentation/Networking/Conceptual/SystemConfigFrameworks/SC_Intro/SC_Intro.html 13 | 14 | @implementation ProxyConfTool 15 | 16 | 17 | +(NSArray*)networkServicesList { 18 | NSMutableArray* results = [NSMutableArray array]; 19 | 20 | SCPreferencesRef prefRef = SCPreferencesCreate(nil, CFSTR("Shadowsocks"), nil); 21 | NSDictionary *sets = (__bridge NSDictionary *)SCPreferencesGetValue(prefRef, kSCPrefNetworkServices); 22 | // 遍历系统中的网络设备列表 23 | for (NSString *key in [sets allKeys]) { 24 | NSMutableDictionary *service = [sets objectForKey:key]; 25 | NSString *userDefinedName = [service valueForKey:(__bridge NSString *)kSCPropUserDefinedName]; 26 | // NSString *hardware = [service valueForKeyPath:@"Interface.Hardware"]; 27 | // NSString *deviceName = [service valueForKeyPath:@"Interface.DeviceName"]; 28 | // NSString *deviceType = [service valueForKeyPath:@"Interface.Type"]; 29 | 30 | BOOL isActive = ![service objectForKey:(NSString *)kSCResvInactive]; 31 | // NSLog(@"%@", hardware); 32 | // NSLog(@"%@-------------------", key); 33 | // for(NSString* key in service) { 34 | // NSLog(@"key=%@ value=%@", key, [service objectForKey:key]); 35 | // } 36 | // 37 | if (isActive) { 38 | if (isActive && userDefinedName) { 39 | NSDictionary* v = @{ 40 | @"key": key, 41 | @"userDefinedName": userDefinedName, 42 | }; 43 | [results addObject:v]; 44 | } 45 | } 46 | } 47 | 48 | return results; 49 | } 50 | 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/ProxyPreferencesController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProxyPreferencesController.swift 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/29. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class ProxyPreferencesController: NSWindowController, NSTableViewDataSource, NSTableViewDelegate { 12 | 13 | var networkServices: NSArray! 14 | var selectedNetworkServices: NSMutableSet! 15 | 16 | var autoConfigureNetworkServices: Bool = true 17 | 18 | @IBOutlet var autoConfigCheckBox: NSButton! 19 | 20 | @IBOutlet var tableView: NSTableView! 21 | 22 | override func windowDidLoad() { 23 | super.windowDidLoad() 24 | 25 | // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. 26 | let defaults = UserDefaults.standard 27 | self.setValue(defaults.bool(forKey: "AutoConfigureNetworkServices"), forKey: "autoConfigureNetworkServices") 28 | 29 | if let services = defaults.array(forKey: "Proxy4NetworkServices") { 30 | selectedNetworkServices = NSMutableSet(array: services) 31 | } else { 32 | selectedNetworkServices = NSMutableSet() 33 | } 34 | 35 | networkServices = ProxyConfTool.networkServicesList() as NSArray! 36 | tableView.reloadData() 37 | } 38 | 39 | @IBAction func ok(_ sender: NSObject){ 40 | ProxyConfHelper.disableProxy() 41 | 42 | let defaults = UserDefaults.standard 43 | defaults.setValue(selectedNetworkServices.allObjects, forKeyPath: "Proxy4NetworkServices") 44 | defaults.set(autoConfigureNetworkServices, forKey: "AutoConfigureNetworkServices") 45 | 46 | defaults.synchronize() 47 | 48 | window?.performClose(self) 49 | 50 | NotificationCenter.default 51 | .post(name: Notification.Name(rawValue: NOTIFY_ADV_PROXY_CONF_CHANGED), object: nil) 52 | } 53 | 54 | @IBAction func cancel(_ sender: NSObject){ 55 | window?.performClose(self) 56 | } 57 | 58 | //-------------------------------------------------- 59 | // For NSTableViewDataSource 60 | func numberOfRows(in tableView: NSTableView) -> Int { 61 | if networkServices != nil { 62 | return networkServices.count 63 | } 64 | return 0; 65 | } 66 | 67 | func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn? 68 | , row: Int) -> Any? { 69 | let cell = tableColumn!.dataCell as! NSButtonCell 70 | 71 | let networkService = networkServices[row] as! [String: Any] 72 | let key = networkService["key"] as! String 73 | if selectedNetworkServices.contains(key) { 74 | cell.state = 1 75 | } else { 76 | cell.state = 0 77 | } 78 | let userDefinedName = networkService["userDefinedName"] as! String 79 | cell.title = userDefinedName 80 | return cell 81 | } 82 | 83 | func tableView(_ tableView: NSTableView, setObjectValue object: Any? 84 | , for tableColumn: NSTableColumn?, row: Int) { 85 | let networkService = networkServices[row] as! [String: Any] 86 | let key = networkService["key"] as! String 87 | 88 | // NSLog("%d", object!.integerValue) 89 | if (object! as AnyObject).intValue == 1 { 90 | selectedNetworkServices.add(key) 91 | } else { 92 | selectedNetworkServices.remove(key) 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/SWBApplication.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by clowwindy on 3/1/14. 3 | // Copyright (c) 2014 clowwindy. All rights reserved. 4 | // 5 | 6 | #import 7 | @import AppKit; 8 | 9 | 10 | @interface SWBApplication : NSApplication 11 | @end -------------------------------------------------------------------------------- /ShadowsocksX-NG/SWBApplication.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by clowwindy on 3/1/14. 3 | // Copyright (c) 2014 clowwindy. All rights reserved. 4 | // 5 | 6 | #import "SWBApplication.h" 7 | 8 | 9 | @implementation SWBApplication { 10 | 11 | } 12 | 13 | // Enable Key Shortcuts 14 | // http://stackoverflow.com/questions/970707/cocoa-keyboard-shortcuts-in-dialog-without-an-edit-menu 15 | - (void) sendEvent:(NSEvent *)event { 16 | if ([event type] == NSKeyDown) { 17 | if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == NSCommandKeyMask) { 18 | if ([[event charactersIgnoringModifiers] isEqualToString:@"x"]) { 19 | if ([self sendAction:@selector(cut:) to:nil from:self]) 20 | return; 21 | } 22 | else if ([[event charactersIgnoringModifiers] isEqualToString:@"c"]) { 23 | if ([self sendAction:@selector(copy:) to:nil from:self]) 24 | return; 25 | } 26 | else if ([[event charactersIgnoringModifiers] isEqualToString:@"v"]) { 27 | if ([self sendAction:@selector(paste:) to:nil from:self]) 28 | return; 29 | } 30 | else if ([[event charactersIgnoringModifiers] isEqualToString:@"z"]) { 31 | if ([self sendAction:@selector(undo) to:nil from:self]) 32 | return; 33 | } 34 | else if ([[event charactersIgnoringModifiers] isEqualToString:@"a"]) { 35 | if ([self sendAction:@selector(selectAll:) to:nil from:self]) 36 | return; 37 | } 38 | } 39 | else if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSShiftKeyMask)) { 40 | if ([[event charactersIgnoringModifiers] isEqualToString:@"Z"]) { 41 | if ([self sendAction:@selector(redo) to:nil from:self]) 42 | return; 43 | } 44 | } 45 | } 46 | [super sendEvent:event]; 47 | } 48 | 49 | @end -------------------------------------------------------------------------------- /ShadowsocksX-NG/SWBQRCodeWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // QRCodeWindowController.h 3 | // shadowsocks 4 | // 5 | // Created by clowwindy on 10/12/14. 6 | // Copyright (c) 2014 clowwindy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface SWBQRCodeWindowController : NSWindowController 13 | 14 | @property (nonatomic, copy) NSString *qrCode; 15 | @property (nonatomic, weak) NSImageView *imageView; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/SWBQRCodeWindowController.m: -------------------------------------------------------------------------------- 1 | // 2 | // QRCodeWindowController.m 3 | // shadowsocks 4 | // 5 | // Created by clowwindy on 10/12/14. 6 | // Copyright (c) 2014 clowwindy. All rights reserved. 7 | // 8 | 9 | #import "SWBQRCodeWindowController.h" 10 | @import CoreImage; 11 | 12 | @interface SWBQRCodeWindowController () 13 | 14 | @end 15 | 16 | @implementation SWBQRCodeWindowController 17 | 18 | - (void)windowDidLoad { 19 | [super windowDidLoad]; 20 | 21 | // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. 22 | [self setQRCode:self.qrCode]; 23 | } 24 | 25 | - (void)setQRCode:(NSString*) qrCode { 26 | CGImageRef cgImgRef = [self createQRImageForString:qrCode size:CGSizeMake(250, 250)]; 27 | 28 | NSImage *image = [[NSImage alloc]initWithCGImage:cgImgRef size:CGSizeMake(250, 250)]; 29 | self.imageView.image = image; 30 | } 31 | 32 | - (CGImageRef)createQRImageForString:(NSString *)string size:(CGSize)size { 33 | // Setup the QR filter with our string 34 | CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"]; 35 | [filter setDefaults]; 36 | 37 | NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; 38 | [filter setValue:data forKey:@"inputMessage"]; 39 | CIImage *image = [filter valueForKey:@"outputImage"]; 40 | 41 | // Calculate the size of the generated image and the scale for the desired image size 42 | CGRect extent = CGRectIntegral(image.extent); 43 | CGFloat scale = MIN(size.width / CGRectGetWidth(extent), size.height / CGRectGetHeight(extent)); 44 | 45 | // Since CoreImage nicely interpolates, we need to create a bitmap image that we'll draw into 46 | // a bitmap context at the desired size; 47 | size_t width = CGRectGetWidth(extent) * scale; 48 | size_t height = CGRectGetHeight(extent) * scale; 49 | CGColorSpaceRef cs = CGColorSpaceCreateDeviceGray(); 50 | CGContextRef bitmapRef = CGBitmapContextCreate(nil, width, height, 8, 0, cs, (CGBitmapInfo)kCGImageAlphaNone); 51 | 52 | #if TARGET_OS_IPHONE 53 | CIContext *context = [CIContext contextWithOptions:nil]; 54 | #else 55 | CIContext *context = [CIContext contextWithCGContext:bitmapRef options:nil]; 56 | #endif 57 | 58 | CGImageRef bitmapImage = [context createCGImage:image fromRect:extent]; 59 | 60 | CGContextSetInterpolationQuality(bitmapRef, kCGInterpolationNone); 61 | CGContextScaleCTM(bitmapRef, scale, scale); 62 | CGContextDrawImage(bitmapRef, extent, bitmapImage); 63 | 64 | // Create an image with the contents of our bitmap 65 | CGImageRef scaledImage = CGBitmapContextCreateImage(bitmapRef); 66 | 67 | // Cleanup 68 | CGContextRelease(bitmapRef); 69 | CGImageRelease(bitmapImage); 70 | 71 | return scaledImage; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/SWBQRCodeWindowController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/ServerProfile.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ServerProfile.swift 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/6. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | 12 | 13 | class ServerProfile: NSObject { 14 | var uuid: String 15 | 16 | var serverHost: String = "" 17 | var serverPort: uint16 = 8379 18 | var method:String = "aes-128-cfb" 19 | var password:String = "" 20 | var remark:String = "" 21 | var ota: Bool = false // onetime authentication 22 | 23 | override init() { 24 | uuid = UUID().uuidString 25 | } 26 | 27 | init(uuid: String) { 28 | self.uuid = uuid 29 | } 30 | 31 | static func fromDictionary(_ data:[String:AnyObject]) -> ServerProfile { 32 | let cp = { 33 | (profile: ServerProfile) in 34 | profile.serverHost = data["ServerHost"] as! String 35 | profile.serverPort = (data["ServerPort"] as! NSNumber).uint16Value 36 | profile.method = data["Method"] as! String 37 | profile.password = data["Password"] as! String 38 | if let remark = data["Remark"] { 39 | profile.remark = remark as! String 40 | } 41 | if let ota = data["OTA"] { 42 | profile.ota = ota as! Bool 43 | } 44 | } 45 | 46 | if let id = data["Id"] as? String { 47 | let profile = ServerProfile(uuid: id) 48 | cp(profile) 49 | return profile 50 | } else { 51 | let profile = ServerProfile() 52 | cp(profile) 53 | return profile 54 | } 55 | } 56 | 57 | func toDictionary() -> [String:AnyObject] { 58 | var d = [String:AnyObject]() 59 | d["Id"] = uuid as AnyObject? 60 | d["ServerHost"] = serverHost as AnyObject? 61 | d["ServerPort"] = NSNumber(value: serverPort as UInt16) 62 | d["Method"] = method as AnyObject? 63 | d["Password"] = password as AnyObject? 64 | d["Remark"] = remark as AnyObject? 65 | d["OTA"] = ota as AnyObject? 66 | return d 67 | } 68 | 69 | func toJsonConfig() -> [String: AnyObject] { 70 | var conf: [String: AnyObject] = ["server": serverHost as AnyObject, 71 | "server_port": NSNumber(value: serverPort as UInt16), 72 | "password": password as AnyObject, 73 | "method": method as AnyObject,] 74 | 75 | let defaults = UserDefaults.standard 76 | conf["local_port"] = NSNumber(value: UInt16(defaults.integer(forKey: "LocalSocks5.ListenPort")) as UInt16) 77 | conf["local_address"] = defaults.string(forKey: "LocalSocks5.ListenAddress") as AnyObject? 78 | conf["timeout"] = NSNumber(value: UInt32(defaults.integer(forKey: "LocalSocks5.Timeout")) as UInt32) 79 | conf["auth"] = NSNumber(value: ota as Bool) 80 | 81 | return conf 82 | } 83 | 84 | func isValid() -> Bool { 85 | func validateIpAddress(_ ipToValidate: String) -> Bool { 86 | 87 | var sin = sockaddr_in() 88 | var sin6 = sockaddr_in6() 89 | 90 | if ipToValidate.withCString({ cstring in inet_pton(AF_INET6, cstring, &sin6.sin6_addr) }) == 1 { 91 | // IPv6 peer. 92 | return true 93 | } 94 | else if ipToValidate.withCString({ cstring in inet_pton(AF_INET, cstring, &sin.sin_addr) }) == 1 { 95 | // IPv4 peer. 96 | return true 97 | } 98 | 99 | return false; 100 | } 101 | 102 | func validateDomainName(_ value: String) -> Bool { 103 | let validHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$" 104 | 105 | if (value.range(of: validHostnameRegex, options: .regularExpression) != nil) { 106 | return true 107 | } else { 108 | return false 109 | } 110 | } 111 | 112 | if !(validateIpAddress(serverHost) || validateDomainName(serverHost)){ 113 | return false 114 | } 115 | 116 | if password.isEmpty { 117 | return false 118 | } 119 | 120 | return true 121 | } 122 | 123 | func URL() -> Foundation.URL? { 124 | let parts = "\(method):\(password)@\(serverHost):\(serverPort)" 125 | let base64String = parts.data(using: String.Encoding.utf8)? 126 | .base64EncodedString(options: NSData.Base64EncodingOptions()) 127 | if var s = base64String { 128 | s = s.trimmingCharacters(in: CharacterSet(charactersIn: "=")) 129 | return Foundation.URL(string: "ss://\(s)") 130 | } 131 | return nil 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/ServerProfileManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ServerProfileManager.swift 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/6. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class ServerProfileManager: NSObject { 12 | 13 | static let instance:ServerProfileManager = ServerProfileManager() 14 | 15 | var profiles:[ServerProfile] 16 | var activeProfileId: String? 17 | 18 | fileprivate override init() { 19 | profiles = [ServerProfile]() 20 | 21 | let defaults = UserDefaults.standard 22 | if let _profiles = defaults.array(forKey: "ServerProfiles") { 23 | for _profile in _profiles { 24 | let profile = ServerProfile.fromDictionary(_profile as! [String : AnyObject]) 25 | profiles.append(profile) 26 | } 27 | } 28 | activeProfileId = defaults.string(forKey: "ActiveServerProfileId") 29 | } 30 | 31 | func setActiveProfiledId(_ id: String) { 32 | activeProfileId = id 33 | let defaults = UserDefaults.standard 34 | defaults.set(id, forKey: "ActiveServerProfileId") 35 | } 36 | 37 | func save() { 38 | let defaults = UserDefaults.standard 39 | var _profiles = [AnyObject]() 40 | for profile in profiles { 41 | if profile.isValid() { 42 | let _profile = profile.toDictionary() 43 | _profiles.append(_profile as AnyObject) 44 | } 45 | } 46 | defaults.set(_profiles, forKey: "ServerProfiles") 47 | 48 | if getActiveProfile() == nil { 49 | activeProfileId = nil 50 | } 51 | 52 | if activeProfileId != nil { 53 | defaults.set(activeProfileId, forKey: "ActiveServerProfileId") 54 | writeSSLocalConfFile((getActiveProfile()?.toJsonConfig())!) 55 | } else { 56 | defaults.removeObject(forKey: "ActiveServerProfileId") 57 | removeSSLocalConfFile() 58 | } 59 | } 60 | 61 | func getActiveProfile() -> ServerProfile? { 62 | if let id = activeProfileId { 63 | for p in profiles { 64 | if p.uuid == id { 65 | return p 66 | } 67 | } 68 | return nil 69 | } else { 70 | return nil 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/SetShortcutWindowController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SetShortcutWindowController.swift 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 徐开源 on 2016/11/23. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import MASShortcut 11 | 12 | class SetShortcutWindowController: NSWindowController { 13 | 14 | @IBOutlet var autoModeShortcutView: MASShortcutView! 15 | @IBOutlet var globalModeShortcutView: MASShortcutView! 16 | @IBOutlet var manualModeShortcutView: MASShortcutView! 17 | 18 | static let autoShortcutKey = "autoShortcutKey" 19 | static let globalShortcutKey = "globalShortcutKey" 20 | static let manualShortcutKey = "manualShortcutKey" 21 | 22 | override func windowDidLoad() { 23 | super.windowDidLoad() 24 | 25 | // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. 26 | 27 | autoModeShortcutView.associatedUserDefaultsKey = SetShortcutWindowController.autoShortcutKey 28 | globalModeShortcutView.associatedUserDefaultsKey = SetShortcutWindowController.globalShortcutKey 29 | manualModeShortcutView.associatedUserDefaultsKey = SetShortcutWindowController.manualShortcutKey 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/ShadowsocksX-NG-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import 6 | 7 | #import "LaunchAtLoginController.h" 8 | #import "SWBQRCodeWindowController.h" 9 | #import "Utils.h" 10 | #import "ProxyConfHelper.h" 11 | #import "ProxyConfTool.h" 12 | 13 | #import 14 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/UserRulesController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UserRulesController.swift 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 周斌佳 on 16/8/1. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class UserRulesController: NSWindowController { 12 | 13 | @IBOutlet var userRulesView: NSTextView! 14 | 15 | override func windowDidLoad() { 16 | super.windowDidLoad() 17 | 18 | let fileMgr = FileManager.default 19 | if !fileMgr.fileExists(atPath: PACUserRuleFilePath) { 20 | let src = Bundle.main.path(forResource: "user-rule", ofType: "txt") 21 | try! fileMgr.copyItem(atPath: src!, toPath: PACUserRuleFilePath) 22 | } 23 | 24 | let str = try? String(contentsOfFile: PACUserRuleFilePath, encoding: String.Encoding.utf8) 25 | userRulesView.string = str 26 | } 27 | 28 | @IBAction func didCancel(_ sender: AnyObject) { 29 | window?.performClose(self) 30 | } 31 | 32 | @IBAction func didOK(_ sender: AnyObject) { 33 | if let str = userRulesView.string { 34 | do { 35 | try str.data(using: String.Encoding.utf8)?.write(to: URL(fileURLWithPath: PACUserRuleFilePath), options: .atomic) 36 | 37 | if GeneratePACFile() { 38 | // Popup a user notification 39 | let notification = NSUserNotification() 40 | notification.title = "PAC has been updated by User Rules.".localized 41 | NSUserNotificationCenter.default 42 | .deliver(notification) 43 | } else { 44 | let notification = NSUserNotification() 45 | notification.title = "It's failed to update PAC by User Rules.".localized 46 | NSUserNotificationCenter.default 47 | .deliver(notification) 48 | } 49 | } catch {} 50 | } 51 | window?.performClose(self) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/Utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // QRCodeUtils.h 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/8. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | #ifndef QRCodeUtils_h 10 | #define QRCodeUtils_h 11 | 12 | void ScanQRCodeOnScreen(); 13 | 14 | NSDictionary* ParseSSURL(NSURL* url); 15 | 16 | #endif /* QRCodeUtils_h */ 17 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/Utils.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Utils.swift 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/7. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | extension String { 13 | var localized: String { 14 | return NSLocalizedString(self, tableName: nil, bundle: Bundle.main, value: "", comment: "") 15 | } 16 | } 17 | 18 | 19 | extension Data { 20 | func sha1() -> String { 21 | let data = self 22 | var digest = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH)) 23 | CC_SHA1((data as NSData).bytes, CC_LONG(data.count), &digest) 24 | let hexBytes = digest.map { String(format: "%02hhx", $0) } 25 | return hexBytes.joined(separator: "") 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/en.lproj/PreferencesWindowController.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSTextFieldCell"; title = "Text"; ObjectID = "COZ-Qr-bmU"; */ 3 | "COZ-Qr-bmU.title" = "Text"; 4 | 5 | /* Class = "NSWindow"; title = "Server Preferences"; ObjectID = "F0z-JX-Cv5"; */ 6 | "F0z-JX-Cv5.title" = "Server Preferences"; 7 | 8 | /* Class = "NSBox"; title = "Box"; ObjectID = "Gqv-5O-Wwf"; */ 9 | "Gqv-5O-Wwf.title" = "Box"; 10 | 11 | /* Class = "NSTextFieldCell"; title = ":"; ObjectID = "Ibr-Gs-5Js"; */ 12 | "Ibr-Gs-5Js.title" = ":"; 13 | 14 | /* Class = "NSTextFieldCell"; title = "Remarks:"; ObjectID = "MiN-VE-FtC"; */ 15 | "MiN-VE-FtC.title" = "Remarks:"; 16 | 17 | /* Class = "NSButtonCell"; title = "Enable OTA"; ObjectID = "hRZ-Rp-I5e"; */ 18 | "hRZ-Rp-I5e.title" = "Enable OTA"; 19 | 20 | /* Class = "NSButtonCell"; title = "Cacnel"; ObjectID = "j03-9E-uHW"; */ 21 | "j03-9E-uHW.title" = "Cacnel"; 22 | 23 | /* Class = "NSTextFieldCell"; title = "Password:"; ObjectID = "kil-xC-HPD"; */ 24 | "kil-xC-HPD.title" = "Password:"; 25 | 26 | /* Class = "NSTextFieldCell"; title = "Encryption:"; ObjectID = "mOh-nD-7EX"; */ 27 | "mOh-nD-7EX.title" = "Encryption:"; 28 | 29 | /* Class = "NSButtonCell"; title = "Copy URL to Clipboard"; ObjectID = "t3T-Kd-5La"; */ 30 | "t3T-Kd-5La.title" = "Copy URL to Clipboard"; 31 | 32 | /* Class = "NSTextFieldCell"; title = "Address:"; ObjectID = "yHs-XE-XEB"; */ 33 | "yHs-XE-XEB.title" = "Address:"; 34 | 35 | /* Class = "NSButtonCell"; title = "OK"; ObjectID = "zPE-oD-PwK"; */ 36 | "zPE-oD-PwK.title" = "OK"; 37 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/install_helper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # install_helper.sh 4 | # shadowsocks 5 | # 6 | # Created by clowwindy on 14-3-15. 7 | 8 | cd `dirname "${BASH_SOURCE[0]}"` 9 | sudo mkdir -p "/Library/Application Support/ShadowsocksX-NG/" 10 | sudo cp proxy_conf_helper "/Library/Application Support/ShadowsocksX-NG/" 11 | sudo chown root:admin "/Library/Application Support/ShadowsocksX-NG/proxy_conf_helper" 12 | sudo chmod +s "/Library/Application Support/ShadowsocksX-NG/proxy_conf_helper" 13 | 14 | echo done -------------------------------------------------------------------------------- /ShadowsocksX-NG/install_privoxy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # install_privoxy.sh 4 | # ShadowsocksX-NG 5 | # 6 | # Created by 王晨 on 16/10/7. 7 | # Copyright © 2016年 zhfish. All rights reserved. 8 | 9 | 10 | cd `dirname "${BASH_SOURCE[0]}"` 11 | privoxyVersion=3.0.26.static 12 | mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy-$privoxyVersion" 13 | cp -f privoxy "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy-$privoxyVersion/" 14 | rm -f "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy" 15 | ln -s "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy-$privoxyVersion/privoxy" "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy" 16 | 17 | echo done 18 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/install_ss_local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # install_ss_local.sh 4 | # ShadowsocksX-NG 5 | # 6 | # Created by 邱宇舟 on 16/6/6. 7 | # Copyright © 2016年 qiuyuzhou. All rights reserved. 8 | 9 | 10 | cd `dirname "${BASH_SOURCE[0]}"` 11 | mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local-2.4.6" 12 | cp -f ss-local "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local-2.4.6/" 13 | rm -f "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local" 14 | ln -s "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local-2.4.6/ss-local" "$HOME/Library/Application Support/ShadowsocksX-NG/ss-local" 15 | 16 | cp -f libcrypto.1.0.0.dylib "$HOME/Library/Application Support/ShadowsocksX-NG/" 17 | 18 | echo done -------------------------------------------------------------------------------- /ShadowsocksX-NG/libcrypto.1.0.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/libcrypto.1.0.0.dylib -------------------------------------------------------------------------------- /ShadowsocksX-NG/menu_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/menu_icon.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/menu_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/menu_icon@2x.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/menu_icon_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/menu_icon_disabled.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/menu_icon_disabled@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/menu_icon_disabled@2x.png -------------------------------------------------------------------------------- /ShadowsocksX-NG/privoxy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/privoxy -------------------------------------------------------------------------------- /ShadowsocksX-NG/privoxy.config.example: -------------------------------------------------------------------------------- 1 | listen-address {http} 2 | toggle 1 3 | enable-remote-toggle 1 4 | enable-remote-http-toggle 1 5 | enable-edit-actions 0 6 | enforce-blocks 0 7 | buffer-limit 4096 8 | forwarded-connect-retries 0 9 | accept-intercepted-requests 0 10 | allow-cgi-request-crunching 0 11 | split-large-forms 0 12 | keep-alive-timeout 5 13 | socket-timeout 60 14 | 15 | forward-socks5 / {socks5} . 16 | forward 192.168.*.*/ . 17 | forward 10.*.*.*/ . 18 | forward 127.*.*.*/ . 19 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/proxy_conf_helper_version.h: -------------------------------------------------------------------------------- 1 | // 2 | // proxy_conf_helper_version.h 3 | // ShadowsocksX-NG 4 | // 5 | // Created by 邱宇舟 on 16/6/10. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | #ifndef proxy_conf_helper_version_h 10 | #define proxy_conf_helper_version_h 11 | 12 | #define kProxyConfHelperVersion @"1.3.2" 13 | 14 | #endif /* proxy_conf_helper_version_h */ 15 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/reload_conf_privoxy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # reload_privoxy.sh 4 | # ShadowsocksX-NG 5 | # 6 | # Created by 王晨 on 16/10/7. 7 | # Copyright © 2016年 zhfish. All rights reserved. 8 | 9 | #launchctl kill SIGHUP "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.http.plist" 10 | 11 | launchctl unload "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.http.plist" 12 | launchctl load "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.http.plist" 13 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/reload_conf_ss_local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # reload_conf_ss_local.sh 4 | # ShadowsocksX-NG 5 | # 6 | # Created by 邱宇舟 on 16/6/6. 7 | # Copyright © 2016年 qiuyuzhou. All rights reserved. 8 | 9 | #launchctl kill SIGHUP "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist" 10 | 11 | launchctl unload "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist" 12 | launchctl load "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist" 13 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/ss-local: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShadowsocksX-NG/ss-local -------------------------------------------------------------------------------- /ShadowsocksX-NG/start_privoxy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # start_privoxy.sh 4 | # ShadowsocksX-NG 5 | # 6 | # Created by 王晨 on 16/10/7. 7 | # Copyright © 2016年 zhfish. All rights reserved. 8 | 9 | launchctl load "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.http.plist" 10 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/start_ss_local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # start_ss_local.sh 4 | # ShadowsocksX-NG 5 | # 6 | # Created by 邱宇舟 on 16/6/6. 7 | # Copyright © 2016年 qiuyuzhou. All rights reserved. 8 | 9 | launchctl load "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist" -------------------------------------------------------------------------------- /ShadowsocksX-NG/stop_privoxy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # stop_privoxy.sh 4 | # ShadowsocksX-NG 5 | # 6 | # Created by 王晨 on 16/10/7. 7 | # Copyright © 2016年 zhfish. All rights reserved. 8 | 9 | 10 | 11 | launchctl unload "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.http.plist" 12 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/stop_ss_local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # stop_ss_local.sh 4 | # ShadowsocksX-NG 5 | # 6 | # Created by 邱宇舟 on 16/6/6. 7 | # Copyright © 2016年 qiuyuzhou. All rights reserved. 8 | 9 | 10 | 11 | launchctl unload "$HOME/Library/LaunchAgents/com.qiuyuzhou.shadowsocksX-NG.local.plist" -------------------------------------------------------------------------------- /ShadowsocksX-NG/user-rule.txt: -------------------------------------------------------------------------------- 1 | ! Put user rules line by line in this file. 2 | ! See https://adblockplus.org/en/filter-cheatsheet 3 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/zh-Hans.lproj/AdvPreferencesWindowController.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSButtonCell"; title = "启用 Udp Relay"; ObjectID = "1C3-4s-Apd"; */ 3 | "1C3-4s-Apd.title" = "启用 Udp Relay"; 4 | 5 | /* Class = "NSTextFieldCell"; title = "Don't change these preferences if you have no idea what are they."; ObjectID = "8wL-qv-5nD"; */ 6 | "8wL-qv-5nD.title" = "如果你不明白这些选项是什么,请不要修改"; 7 | 8 | /* Class = "NSWindow"; title = "高级设置"; ObjectID = "F0z-JX-Cv5"; */ 9 | "F0z-JX-Cv5.title" = "高级设置"; 10 | 11 | /* Class = "NSTextFieldCell"; title = "Seconds"; ObjectID = "Gd3-Fm-sWh"; */ 12 | "Gd3-Fm-sWh.title" = "秒"; 13 | 14 | /* Class = "NSBox"; title = "Box"; ObjectID = "ayu-Tb-kmf"; */ 15 | "ayu-Tb-kmf.title" = "Box"; 16 | 17 | /* Class = "NSTextFieldCell"; title = "本地 Socks5 监听地址:"; ObjectID = "cwr-n0-zwn"; */ 18 | "cwr-n0-zwn.title" = "本地 Socks5 监听地址:"; 19 | 20 | /* Class = "NSTextFieldCell"; title = "GFW List URL:"; ObjectID = "dg0-gS-z5V"; */ 21 | "dg0-gS-z5V.title" = "GFW LIST URL:"; 22 | 23 | /* Class = "NSTextFieldCell"; title = "Timeout:"; ObjectID = "i4l-2S-gOQ"; */ 24 | "i4l-2S-gOQ.title" = "超时:"; 25 | 26 | /* Class = "NSTextFieldCell"; title = "本地 Socks5 监听端口:"; ObjectID = "qRs-ow-vVB"; */ 27 | "qRs-ow-vVB.title" = "本地 Socks5 监听端口:"; 28 | 29 | /* Class = "NSTextFieldCell"; title = "Local PAC Listen Address:"; ObjectID = "dvL-Ic-Wae"; */ 30 | "dvL-Ic-Wae.title" = "本地 PAC 监听地址:"; 31 | 32 | /* Class = "NSTextFieldCell"; title = "Local PAC Listen Port:"; ObjectID = "PSg-XK-qhl"; */ 33 | "PSg-XK-qhl.title" = "本地 PAC 监听端口:"; 34 | 35 | /* Class = "NSTextFieldCell"; title = "White List URL:"; ObjectID = "aif-uV-Lxk"; */ 36 | "aif-uV-Lxk.title" = "白名单列表 URL:"; 37 | 38 | /* Class = "NSTextFieldCell"; title = "White IP List URL:"; ObjectID = "qhu-d1-qgq"; */ 39 | "qhu-d1-qgq.title" = "白名单IP列表 URL:"; 40 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/zh-Hans.lproj/HTTPPreferencesWindowController.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSTextFieldCell"; title = "HTTP Proxy Listen Port:"; ObjectID = "2Sd-yn-gdY"; */ 3 | "2Sd-yn-gdY.title" = "HTTP 代理 监听端口:"; 4 | 5 | /* Class = "NSButtonCell"; title = "HTTP Proxy Enable"; ObjectID = "dqU-MG-Sum"; */ 6 | "dqU-MG-Sum.title" = "HTTP 代理 开启"; 7 | 8 | /* Class = "NSTextFieldCell"; title = "HTTP Proxy Listen Address:"; ObjectID = "qd0-kc-ttB"; */ 9 | "qd0-kc-ttB.title" = "HTTP 代理 监听地址:"; 10 | 11 | /* Class = "NSWindow"; title = "HTTP Proxy Preferences"; ObjectID = "vS3-DL-Nq3"; */ 12 | "vS3-DL-Nq3.title" = "HTTP 代理 设置"; 13 | 14 | /* Class = "NSButtonCell"; title = "Follow Global Mode"; ObjectID = "ofk-Pc-c8f"; */ 15 | "ofk-Pc-c8f.title" = "跟随全局模式"; 16 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | /* 8 | * SHARED STRINGS 9 | */ 10 | 11 | /* 12 | * ./PACUtils.swift 13 | */ 14 | 15 | "PAC has been updated by latest GFW List." = "已经使用最新的 GFW List 更新PAC"; 16 | 17 | "Failed to download latest GFW List." = "下载 GFW List 失败"; 18 | 19 | /* 20 | * ./PreferencesWindowController.swift 21 | */ 22 | 23 | "New Server" = "新服务器"; 24 | 25 | /* 26 | * ./AppDelegate.swift 27 | */ 28 | 29 | "Add Shadowsocks Server Profile" = "已添加新Shaodwsocks服务器配置"; 30 | 31 | "By scan QR Code" = "通过扫描二维码"; 32 | 33 | " Encription Method: \(profile.method)" = " 加密方法: \(profile.method)"; 34 | 35 | "Current server profile is not valid." = "当前服务器配置无效"; 36 | 37 | "No current server profile." = "未设置当前服务器配置"; 38 | 39 | "Shadowsocks: On" = "Shadowsocks: On"; 40 | 41 | "Turn Shadowsocks Off" = "关闭 Shadowsocks"; 42 | 43 | "Shadowsocks: Off" = "Shadowsocks: Off"; 44 | 45 | "Turn Shadowsocks On" = "打开 Shadowsocks"; 46 | 47 | "Proxy - Auto By PAC" = "代理 - PAC自动"; 48 | 49 | "Proxy - Global" = "代理 - 全局"; 50 | 51 | "Proxy - Manual" = "代理 - 手动"; 52 | 53 | "Servers" = "服务器"; 54 | 55 | "Auto" = "自动"; 56 | 57 | "Global" = "全局"; 58 | 59 | "Manual" = "手动"; 60 | 61 | "Show Running Mode On Status Bar" = "在状态栏显示运行模式"; 62 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/zh-Hans.lproj/MainMenu.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSMenuItem"; title = "Proxy Shortcut Preferences"; ObjectID = "8tY-AT-pN1"; */ 3 | "8tY-AT-pN1.title" = "切换代理快捷键设置"; 4 | 5 | /* Class = "NSMenuItem"; title = "应用用户自定规则到 PAC"; ObjectID = "6qf-cg-HXc"; */ 6 | "6qf-cg-HXc.title" = "应用用户自定规则到 PAC"; 7 | 8 | /* Class = "NSMenuItem"; title = "手动模式"; ObjectID = "8PR-gs-c5N"; */ 9 | "8PR-gs-c5N.title" = "手动模式"; 10 | 11 | /* Class = "NSMenu"; title = "服务器"; ObjectID = "9Y1-db-3HK"; */ 12 | "9Y1-db-3HK.title" = "服务器"; 13 | 14 | /* Class = "NSMenuItem"; title = "打开 ShadowsocksX"; ObjectID = "GSu-Tf-StS"; */ 15 | "GSu-Tf-StS.title" = "打开 ShadowsocksX"; 16 | 17 | /* Class = "NSMenu"; title = "ShadowsocksX-NG"; ObjectID = "Hob-KD-bx9"; */ 18 | "Hob-KD-bx9.title" = "ShadowsocksX-NG"; 19 | 20 | /* Class = "NSMenuItem"; title = "显示日志..."; ObjectID = "Jfy-sf-Fhl"; */ 21 | "Jfy-sf-Fhl.title" = "显示日志..."; 22 | 23 | /* Class = "NSMenuItem"; title = "关于"; ObjectID = "LgB-6g-Gba"; */ 24 | "LgB-6g-Gba.title" = "关于"; 25 | 26 | /* Class = "NSMenuItem"; title = "服务器设置..."; ObjectID = "M5r-E7-44f"; */ 27 | "M5r-E7-44f.title" = "服务器设置..."; 28 | 29 | /* Class = "NSMenuItem"; title = "全局模式"; ObjectID = "Mw3-Jm-eXA"; */ 30 | "Mw3-Jm-eXA.title" = "全局模式"; 31 | 32 | /* Class = "NSMenuItem"; title = "扫描屏幕上的二维码..."; ObjectID = "Qe6-bF-paT"; */ 33 | "Qe6-bF-paT.title" = "扫描屏幕上的二维码..."; 34 | 35 | /* Class = "NSMenuItem"; title = "显示当前服务器的二维码..."; ObjectID = "R6A-96-Zcb"; */ 36 | "R6A-96-Zcb.title" = "显示当前服务器的二维码..."; 37 | 38 | /* Class = "NSMenuItem"; title = "从 GFW List 更新PAC"; ObjectID = "TFc-Ec-duM"; */ 39 | "TFc-Ec-duM.title" = "从 GFW List 更新PAC"; 40 | 41 | /* Class = "NSMenuItem"; title = "反馈"; ObjectID = "W7u-7g-Gv4"; */ 42 | "W7u-7g-Gv4.title" = "反馈"; 43 | 44 | /* Class = "NSMenu"; title = "代理"; ObjectID = "YZp-bf-L40"; */ 45 | "YZp-bf-L40.title" = "代理"; 46 | 47 | /* Class = "NSMenuItem"; title = "高级设置..."; ObjectID = "bZ3-fy-34d"; */ 48 | "bZ3-fy-34d.title" = "高级设置..."; 49 | 50 | /* Class = "NSMenuItem"; title = "代理"; ObjectID = "diI-fB-Rss"; */ 51 | "diI-fB-Rss.title" = "代理"; 52 | 53 | /* Class = "NSMenuItem"; title = "登录时自动启动"; ObjectID = "eUq-p7-ICK"; */ 54 | "eUq-p7-ICK.title" = "登录时自动启动"; 55 | 56 | /* Class = "NSMenuItem"; title = "Showsocks: On"; ObjectID = "fzk-mE-CEV"; */ 57 | "fzk-mE-CEV.title" = "Showsocks: On"; 58 | 59 | /* Class = "NSMenuItem"; title = "PAC自动模式"; ObjectID = "r07-Gu-aEz"; */ 60 | "r07-Gu-aEz.title" = "PAC自动模式"; 61 | 62 | /* Class = "NSMenuItem"; title = "编辑PAC用户自定规则..."; ObjectID = "rms-p0-CvB"; */ 63 | "rms-p0-CvB.title" = "编辑PAC用户自定规则..."; 64 | 65 | /* Class = "NSMenuItem"; title = "高级设置..."; ObjectID = "sbx-yz-3lO"; */ 66 | "sbx-yz-3lO.title" = "高级设置..."; 67 | 68 | /* Class = "NSMenuItem"; title = "服务器"; ObjectID = "u5M-hQ-VSc"; */ 69 | "u5M-hQ-VSc.title" = "服务器"; 70 | 71 | /* Class = "NSMenuItem"; title = "退出"; ObjectID = "vJS-JW-byz"; */ 72 | "vJS-JW-byz.title" = "退出"; 73 | 74 | /* Class = "NSMenuItem"; title = "Ping server"; ObjectID = "zfR-Jt-GmS"; */ 75 | "zfR-Jt-GmS.title" = "服务器测速"; 76 | 77 | /* Class = "NSMenuItem"; title = "Show network speed"; ObjectID = "a3h-uQ-DuO"; */ 78 | "a3h-uQ-DuO.title" = "显示网速"; 79 | 80 | /* Class = "NSMenuItem"; title = "Connect At Launch"; ObjectID = "aB3-cf-5j0"; */ 81 | "aB3-cf-5j0.title" = "打开时自动连接"; 82 | 83 | /* Class = "NSMenuItem"; title = "HTTP Proxy Preference ..."; ObjectID = "uEp-Gz-cu0"; */ 84 | "uEp-Gz-cu0.title" = "HTTP代理设置..."; 85 | 86 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/zh-Hans.lproj/PreferencesWindowController.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSTextFieldCell"; title = "Text"; ObjectID = "COZ-Qr-bmU"; */ 3 | "COZ-Qr-bmU.title" = "Text"; 4 | 5 | /* Class = "NSWindow"; title = "Server Preferences"; ObjectID = "F0z-JX-Cv5"; */ 6 | "F0z-JX-Cv5.title" = "服务器设置"; 7 | 8 | /* Class = "NSBox"; title = "Box"; ObjectID = "Gqv-5O-Wwf"; */ 9 | "Gqv-5O-Wwf.title" = "Box"; 10 | 11 | /* Class = "NSTextFieldCell"; title = ":"; ObjectID = "Ibr-Gs-5Js"; */ 12 | "Ibr-Gs-5Js.title" = ":"; 13 | 14 | /* Class = "NSTextFieldCell"; title = "Remarks:"; ObjectID = "MiN-VE-FtC"; */ 15 | "MiN-VE-FtC.title" = "备注:"; 16 | 17 | /* Class = "NSButtonCell"; title = "Enable OTA"; ObjectID = "hRZ-Rp-I5e"; */ 18 | "hRZ-Rp-I5e.title" = "启用 OTA"; 19 | 20 | /* Class = "NSButtonCell"; title = "Cacnel"; ObjectID = "j03-9E-uHW"; */ 21 | "j03-9E-uHW.title" = "取消"; 22 | 23 | /* Class = "NSTextFieldCell"; title = "Password:"; ObjectID = "kil-xC-HPD"; */ 24 | "kil-xC-HPD.title" = "密码:"; 25 | 26 | /* Class = "NSTextFieldCell"; title = "Encryption:"; ObjectID = "mOh-nD-7EX"; */ 27 | "mOh-nD-7EX.title" = "加密方法:"; 28 | 29 | /* Class = "NSButtonCell"; title = "Copy URL to Clipboard"; ObjectID = "t3T-Kd-5La"; */ 30 | "t3T-Kd-5La.title" = "复制服务器URL到剪贴板"; 31 | 32 | /* Class = "NSTextFieldCell"; title = "Address:"; ObjectID = "yHs-XE-XEB"; */ 33 | "yHs-XE-XEB.title" = "地址:"; 34 | 35 | /* Class = "NSButtonCell"; title = "OK"; ObjectID = "zPE-oD-PwK"; */ 36 | "zPE-oD-PwK.title" = "确定"; 37 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/zh-Hans.lproj/ProxyPreferencesController.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSWindow"; title = "Advanced Proxy Preferences"; ObjectID = "F0z-JX-Cv5"; */ 3 | "F0z-JX-Cv5.title" = "高级代理设置"; 4 | 5 | /* Class = "NSButtonCell"; title = "Auto Configure"; ObjectID = "FLv-D9-CRw"; */ 6 | "FLv-D9-CRw.title" = "自动设置"; 7 | 8 | /* Class = "NSButtonCell"; title = "Cancel"; ObjectID = "lsQ-1C-OhG"; */ 9 | "lsQ-1C-OhG.title" = "取消"; 10 | 11 | /* Class = "NSButtonCell"; title = "OK"; ObjectID = "rWE-M6-TvV"; */ 12 | "rWE-M6-TvV.title" = "确定"; 13 | 14 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/zh-Hans.lproj/SetShortcutWindowController.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSTextFieldCell"; title = "ManualModeShortcut:"; ObjectID = "Qdx-Rt-w7I"; */ 3 | "Qdx-Rt-w7I.title" = "手动代理快捷键:"; 4 | 5 | /* Class = "NSWindow"; title = "Proxy Shortcut Preferences"; ObjectID = "QvC-M9-y7g"; */ 6 | "QvC-M9-y7g.title" = "切换代理快捷键设置"; 7 | 8 | /* Class = "NSTextFieldCell"; title = "AutoModeShortcut:"; ObjectID = "muK-1q-l3F"; */ 9 | "muK-1q-l3F.title" = "自动代理快捷键:"; 10 | 11 | /* Class = "NSTextFieldCell"; title = "GlobalModeShortcut:"; ObjectID = "oyw-5u-SOU"; */ 12 | "oyw-5u-SOU.title" = "全局代理快捷键:"; 13 | -------------------------------------------------------------------------------- /ShadowsocksX-NG/zh-Hans.lproj/UserRulesController.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSButtonCell"; title = "OK"; ObjectID = "0Sc-cm-Vyu"; */ 3 | "0Sc-cm-Vyu.title" = "确定"; 4 | 5 | /* Class = "NSWindow"; title = "User Rules"; ObjectID = "F0z-JX-Cv5"; */ 6 | "F0z-JX-Cv5.title" = "用户规则"; 7 | 8 | /* Class = "NSButtonCell"; title = "Cancel"; ObjectID = "QAR-9i-kmv"; */ 9 | "QAR-9i-kmv.title" = "取消"; 10 | -------------------------------------------------------------------------------- /ShadowsocksX-NGTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ShadowsocksX-NGTests/ShadowsocksX_NGTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ShadowsocksX_NGTests.swift 3 | // ShadowsocksX-NGTests 4 | // 5 | // Created by 邱宇舟 on 16/6/5. 6 | // Copyright © 2016年 qiuyuzhou. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import ShadowsocksX_NG 11 | 12 | class ShadowsocksX_NGTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ShortcutSS.app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenMarshall/ShortcutSS/5dade84988c4068e633141c00c931b28ad58133e/ShortcutSS.app.zip --------------------------------------------------------------------------------