10 |
11 | @interface ReceiptUtils : NSObject
12 | + (BOOL)verifyReceiptAtPath: (NSString *)receiptPath;
13 | @end
14 |
--------------------------------------------------------------------------------
/Potatso/Utils/RegexUtils.swift:
--------------------------------------------------------------------------------
1 | //
2 | // RegexUtils.swift
3 | // Potatso
4 | //
5 | // Created by LEI on 6/23/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | class Regex {
12 |
13 | let internalExpression: NSRegularExpression
14 | let pattern: String
15 |
16 | init(_ pattern: String) throws {
17 | self.pattern = pattern
18 | self.internalExpression = try NSRegularExpression(pattern: pattern, options: .CaseInsensitive)
19 | }
20 |
21 | func test(input: String) -> Bool {
22 | let matches = self.internalExpression.matchesInString(input, options: NSMatchingOptions.ReportCompletion, range:NSMakeRange(0, input.characters.count))
23 | return matches.count > 0
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Potatso/ad.block:
--------------------------------------------------------------------------------
1 | ## 视频网站
2 | # 优酷土豆
3 | ad\.api\.3g\.youku\.com
4 | atm\.youku\.com
5 | ad\.api\.3g\.tudou\.com
6 |
7 | # 腾讯视频
8 | lives\.l\.qq\.com
9 |
10 | # 乐视
11 | ark\.letv\.com
12 |
13 | # PPTV
14 | asimgs\.pplive\.cn
15 |
16 | # 搜狐视频
17 | agn\.aty\.sohu\.com
18 |
19 | # 芒果 tv
20 | x\.da\.hunantv\.com
21 |
22 | ## App 内广告
23 |
24 | # 网易
25 | ^(https?:\/\/)?([^/:]*\.)?163\.com\/madr
26 |
27 | # 下厨房
28 | ^(https?:\/\/)?api\.xiachufang\.com\/v\d\/ad\/show\.json
29 |
30 | # 微博
31 | ^(https?:\/\/)?(.*)[weibo|sina](.*)\/interface\/(.*)\/(.*)ad.php
32 |
33 | # 联通 DNS
34 | 124.160.194.11:8080
35 |
36 | ## 广告联盟
37 |
38 | # 秒针
39 | miaozhen\.com
40 |
41 | # 百度
42 | ^(https?:\/\/)?(.*)?ads(.*)?\.baidu\.com
43 |
44 | # Google(AdMob)
45 | ^(https?:\/\/)?(.*)ads\.g\.doubleclick\.net
46 |
47 | # Inmobi
48 | ^(https?:\/\/)?([^/:]*\.)?inmob\.com
49 |
50 | # 易传媒(AdChina)
51 | ^(https?:\/\/)?amob\.acs86\.com
52 |
53 | # 多盟
54 | ^(https?:\/\/)?([^/:]*\.)?domob(cdn)?\.[cn|com]
55 | ^(https?:\/\/)?([^/:]*\.)?duomeng\.[net|cn|org]
56 |
57 | # MoPub
58 | ^(https?:\/\/)?([^/:]*\.)?ads\.mopub\.[com|cn]
59 |
60 | # Unity
61 | ^(https?:\/\/)?impact\.applifier\.com
62 |
63 | # 腾讯 广点通
64 | ^(https?:\/\/)?(.*)?gdt\.qq\.com
65 |
66 | # 忘了
67 | ^(https?:\/\/)?(.*)?litchix\.com
68 |
--------------------------------------------------------------------------------
/Potatso/data/AppleIncRootCertificate.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jefby/Potatso-iOS/9004cd40434852a47d880d2a2ff4e90d042f0041/Potatso/data/AppleIncRootCertificate.cer
--------------------------------------------------------------------------------
/Potatso/template.bundle/mod-local-help:
--------------------------------------------------------------------------------
1 | Local Privoxy support:
2 |
3 |
4 | You can consult the online documentation for more information about this Privoxy installation.
5 |
6 |
7 |
8 | Address e-mail questions about this Privoxy installation to
9 | @admin-address@
,
10 | who will be glad to help you.
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Potatso/template.bundle/mod-title:
--------------------------------------------------------------------------------
1 |
2 | This is Privoxy @version@ on @my-hostname@ (@my-ip-address@), port @my-port@,
3 | @if-enabled-display-then@enabled@else-not-enabled-display@disabled@endif-enabled-display@
4 |
5 |
--------------------------------------------------------------------------------
/Potatso/template.bundle/mod-unstable-warning:
--------------------------------------------------------------------------------
1 | Warning:
2 |
3 | This Privoxy version is based on @code-status@ code and
4 | not intended for production systems!
5 |
Use at your own risk. See the license for details.
7 |
8 |
--------------------------------------------------------------------------------
/Potatso/template.bundle/url-info-osd.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Privoxy URL Info
4 |
5 | Enter a URL to see which Privoxy actions apply.
6 | Only works while the browser is configured to use Privoxy.
7 |
8 | UTF-8
9 | UTF-8
10 | Privoxy Team
11 | ijbswa-developers@lists.sourceforge.net
12 | @default-cgi@favicon.ico
13 |
14 |
15 |
--------------------------------------------------------------------------------
/PotatsoBase/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.4.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 98
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/PotatsoBase/JSONUtils.h:
--------------------------------------------------------------------------------
1 | //
2 | // JSONUtils.h
3 | // Potatso
4 | //
5 | // Created by LEI on 3/15/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSString (JSON)
12 |
13 | - (NSDictionary * _Nullable)jsonDictionary;
14 |
15 | - (NSArray * _Nullable)jsonArray;
16 |
17 | @end
18 |
19 |
20 | @interface NSDictionary (JSON)
21 |
22 | - (NSData * _Nullable)jsonData;
23 |
24 | - (NSString * _Nullable)jsonString;
25 |
26 | @end
27 |
28 | @interface NSArray (JSON)
29 |
30 | - (NSData * _Nullable)jsonData;
31 |
32 | - (NSString * _Nullable)jsonString;
33 |
34 | @end
--------------------------------------------------------------------------------
/PotatsoBase/JSONUtils.m:
--------------------------------------------------------------------------------
1 | //
2 | // JSONUtils.m
3 | // Potatso
4 | //
5 | // Created by LEI on 3/15/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | #import "JSONUtils.h"
10 |
11 | @implementation NSString (JSON)
12 |
13 | - (NSDictionary *)jsonDictionary {
14 | return [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil];
15 | }
16 |
17 | - (NSArray *)jsonArray {
18 | return [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil];
19 | }
20 |
21 | @end
22 |
23 | @implementation NSDictionary (JSON)
24 |
25 | - (NSData *)jsonData {
26 | return [NSJSONSerialization dataWithJSONObject:self options:0 error:nil];
27 | }
28 |
29 | - (NSString *)jsonString {
30 | return [[NSString alloc] initWithData:[self jsonData] encoding:NSUTF8StringEncoding];
31 | }
32 |
33 | @end
34 |
35 | @implementation NSArray (JSON)
36 |
37 | - (NSData *)jsonData {
38 | return [NSJSONSerialization dataWithJSONObject:self options:0 error:nil];
39 | }
40 |
41 | - (NSString *)jsonString {
42 | return [[NSString alloc] initWithData:[self jsonData] encoding:NSUTF8StringEncoding];
43 | }
44 |
45 | @end
--------------------------------------------------------------------------------
/PotatsoBase/NSError+Helper.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSError+Helper.h
3 | // Potatso
4 | //
5 | // Created by LEI on 3/23/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSError (Helper)
12 |
13 | + (NSError *)errorWithCode: (NSInteger)code description: (NSString *)description;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/PotatsoBase/NSError+Helper.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSError+Helper.m
3 | // Potatso
4 | //
5 | // Created by LEI on 3/23/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | #import "NSError+Helper.h"
10 |
11 | @implementation NSError (Helper)
12 |
13 | + (NSError *)errorWithCode: (NSInteger)code description: (NSString *)description {
14 | return [NSError errorWithDomain:@"com.touchingapp.potatso" code:code userInfo:@{NSLocalizedDescriptionKey: description}];
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/PotatsoBase/Potatso.h:
--------------------------------------------------------------------------------
1 | //
2 | // PotatsoManager.h
3 | // Potatso
4 | //
5 | // Created by LEI on 4/4/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | extern NSString * _Nonnull sharedGroupIdentifier;
12 |
13 | @interface Potatso : NSObject
14 | + (NSURL * _Nonnull)sharedUrl;
15 | + (NSURL * _Nonnull)sharedDatabaseUrl;
16 | + (NSUserDefaults * _Nonnull)sharedUserDefaults;
17 |
18 | + (NSURL * _Nonnull)sharedGeneralConfUrl;
19 | + (NSURL * _Nonnull)sharedSocksConfUrl;
20 | + (NSURL * _Nonnull)sharedProxyConfUrl;
21 | + (NSURL * _Nonnull)sharedHttpProxyConfUrl;
22 | + (NSURL * _Nonnull)sharedLogUrl;
23 | @end
24 |
--------------------------------------------------------------------------------
/PotatsoBase/PotatsoBase.h:
--------------------------------------------------------------------------------
1 | //
2 | // PotatsoBase.h
3 | // PotatsoBase
4 | //
5 | // Created by LEI on 4/4/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for PotatsoBase.
12 | FOUNDATION_EXPORT double PotatsoBaseVersionNumber;
13 |
14 | //! Project version string for PotatsoBase.
15 | FOUNDATION_EXPORT const unsigned char PotatsoBaseVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 | #import "Potatso.h"
20 | #import "JSONUtils.h"
21 | #import "NSError+Helper.h"
--------------------------------------------------------------------------------
/PotatsoLibrary/Image.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Images.swift
3 | // Potatso
4 | //
5 | // Created by LEI on 1/23/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public extension String {
12 |
13 | public var image: UIImage? {
14 | return UIImage(named: self)
15 | }
16 |
17 | public var templateImage: UIImage? {
18 | return UIImage(named: self)?.imageWithRenderingMode(.AlwaysTemplate)
19 | }
20 |
21 | public var originalImage: UIImage? {
22 | return UIImage(named: self)?.imageWithRenderingMode(.AlwaysOriginal)
23 | }
24 |
25 | }
--------------------------------------------------------------------------------
/PotatsoLibrary/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.4.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 98
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/PotatsoLibrary/Logging.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Logging.swift
3 | // Potatso
4 | //
5 | // Created by LEI on 4/22/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | private let kLoggingLevelIdentifier = "loggingLevel"
12 |
13 | public enum LoggingLevel: Int{
14 | case OFF = 0
15 | case DEBUG = 1
16 |
17 | public static var currentLoggingLevel: LoggingLevel {
18 | get {
19 | if let saved = NSUserDefaults.standardUserDefaults().objectForKey(kLoggingLevelIdentifier) as? Int {
20 | return LoggingLevel(rawValue: saved) ?? .DEBUG
21 | }else{
22 | return .DEBUG
23 | }
24 | }
25 | set(o) {
26 | NSUserDefaults.standardUserDefaults().setObject(o.rawValue, forKey: kLoggingLevelIdentifier)
27 | NSUserDefaults.standardUserDefaults().synchronize()
28 | }
29 | }
30 |
31 | }
32 |
33 | extension LoggingLevel: CustomStringConvertible {
34 |
35 | public var description: String {
36 | switch self {
37 | case .OFF:
38 | return "Off"
39 | case .DEBUG:
40 | return "Debug"
41 | }
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/PotatsoLibrary/PotatsoLibrary.h:
--------------------------------------------------------------------------------
1 | //
2 | // PotatsoLibrary.h
3 | // PotatsoLibrary
4 | //
5 | // Created by LEI on 12/16/15.
6 | // Copyright © 2015 TouchingApp. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for PotatsoLibrary.
12 | FOUNDATION_EXPORT double PotatsoLibraryVersionNumber;
13 |
14 | //! Project version string for PotatsoLibrary.
15 | FOUNDATION_EXPORT const unsigned char PotatsoLibraryVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
--------------------------------------------------------------------------------
/PotatsoLibraryTests/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.4.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 98
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PotatsoModel/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.4.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 98
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/PotatsoModel/PotatsoModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // PotatsoModel.h
3 | // PotatsoModel
4 | //
5 | // Created by LEI on 4/4/16.
6 | // Copyright © 2016 TouchingApp. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for PotatsoModel.
12 | FOUNDATION_EXPORT double PotatsoModelVersionNumber;
13 |
14 | //! Project version string for PotatsoModel.
15 | FOUNDATION_EXPORT const unsigned char PotatsoModelVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
--------------------------------------------------------------------------------
/PotatsoTests/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.4.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 98
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PotatsoTests/PotatsoTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PotatsoTests.swift
3 | // PotatsoTests
4 | //
5 | // Created by LEI on 12/12/15.
6 | // Copyright © 2015 TouchingApp. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import Potatso
11 |
12 | class PotatsoTests: 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.measureBlock {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/TodayWidget/Base.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 | /*
2 | Localizable.strings
3 | Potatso
4 |
5 | Created by LEI on 4/19/16.
6 | Copyright © 2016 TouchingApp. All rights reserved.
7 | */
8 |
9 | "widget.none" = "None";
10 | "widget.connect" = "Connect";
11 | "widget.disconnect" = "Disconnect";
12 |
--------------------------------------------------------------------------------
/TodayWidget/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | Potatso
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | XPC!
19 | CFBundleShortVersionString
20 | 1.4.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 98
25 | NSExtension
26 |
27 | NSExtensionPointIdentifier
28 | com.apple.widget-extension
29 | NSExtensionPrincipalClass
30 | TodayWidget.TodayViewController
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/TodayWidget/TodayWidget.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.developer.networking.networkextension
6 |
7 | packet-tunnel-provider
8 | app-proxy-provider
9 | content-filter-provider
10 |
11 | com.apple.security.application-groups
12 |
13 | group.com.touchingapp.potatso
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/TodayWidget/zh-Hans.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 | /*
2 | Localizable.strings
3 | Potatso
4 |
5 | Created by LEI on 4/19/16.
6 | Copyright © 2016 TouchingApp. All rights reserved.
7 | */
8 |
9 | "widget.none" = "无";
10 | "widget.connect" = "连接";
11 | "widget.disconnect" = "关闭";
12 |
--------------------------------------------------------------------------------