-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCydiaWebViewController.xm
75 lines (46 loc) · 2.99 KB
/
CydiaWebViewController.xm
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
////////////////////////////////////////////////////////////////////////////////////////////
//
// CleanCydia by Ruslan Ardashev
// www.ruslanArdashev.com
// Copyright 2016
//
////////////////////////////////////////////////////////////////////////////////////////////
#include "Foundation/Foundation.h"
#include "UIKit/UIKit.h"
#define FILTERED_DOMAINS [@"https://ssl.google-analytics", @"https://www.google-analytics", @"http://www.google-analytics", @"https://googleads", @"http://go.pad", @"http://padsdel", @"http://bank-100.ads", @"http://cdn", @"http://s0", @"http://pagead2", @"http://partnercreative", @"http://ib.adnxs", @"http://click.sovrn", @"http://servedby", @"http://cm.g.", @"https://dt.adsafeprotected", @"http://tags.", @"http://www.googletagservices", @"http://partner.googleadservices", @"http://tpc.googlesyndication", @"https://securepubads", @"http://tags.", @"http://a.", @"https://tpc.", @"https://gum.criteo", @"http://mathid.mathtag", @"http://pubservcdn", @"http://ads.", @"http://banners.itunes.", @"http://static.", @"http://c2s.", @"http://www.trackimpression", @"http://dts.akamai", @"http://images.startappservice", @"http://edge.", @"http://p.vibrant.co", @"http://b.", @"http://pixel.", @"http://ads.", @"http://vap2iad1.", @"http://clickcdn"]
// @"http://js.casalemedia", @"http://as.casalemedia", @"http://dsum.casalemedia", @"http://pixel.", @"http://edge.", @"http://js.revsci.", @"http://pippio", @"http://ap.", , @"http://gslbeacon.", @"http://track2.", @"http://idsync.", @"http://bcp", @"http://s.", @"http://ds."
// modmyi @"http://ajax.",
@class WebDataSource;
@interface WebView: UIView
@end
@interface CydiaWebViewController: NSObject
- (NSURLRequest *) webThreadWebView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
@end
@interface CleanCydiaData: NSObject
+(BOOL)IsEnabled;
@end
%hook CydiaWebViewController
- (NSURLRequest *) webThreadWebView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source {
if ([CleanCydiaData IsEnabled]) {
// NSLog(@"Ruslan: webThreadWebView.");
NSURL *url = [request URL];
NSString *string = url.absoluteString;
NSArray *filteredDomains = @FILTERED_DOMAINS;
Boolean found = false;
for (NSString *domain in filteredDomains) {
if ([string hasPrefix:domain]) {
// NSLog(@"Found %@", string);
found = true;
}
}
return found ? nil : %orig;
} else {
return %orig;
}
}
%end
// - (NSURLRequest *) webView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source {
// NSLog(@"Ruslan: CydiaWebViewController: \nwebView: %@\nresource: %@\nwillSendRequest: %@\nredirectResponse: %@\nfromDataSource: %@", view, resource, request, response, source);
// return %orig;
// }