summaryrefslogtreecommitdiff
path: root/MobileCydia.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-02-25 04:07:08 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-07 02:41:18 -0800
commit5df7ecfbd8ada3b6bd104d4508c7b7e551f3278a (patch)
treea6bc8c2f102872258353d0d2a2aa5d26ee00cb82 /MobileCydia.mm
parent8a2c6d14978ee52cfb6b90973a8b05b0338a098d (diff)
Implement a flexible cydia object whitelist.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r--MobileCydia.mm18
1 files changed, 12 insertions, 6 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 5ff7013..694be20 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -1066,6 +1066,8 @@ static time_t now_;
bool IsWildcat_;
static CGFloat ScreenScale_;
static NSString *Idiom_;
+
+static NSSet *CydiaHosts_;
/* }}} */
/* Display Helpers {{{ */
@@ -4127,6 +4129,8 @@ static NSString *Warning_;
+ (NSString *) webScriptNameForSelector:(SEL)selector {
if (false);
+ else if (selector == @selector(addCydiaHost:))
+ return @"addCydiaHost";
else if (selector == @selector(addTrivialSource:))
return @"addTrivialSource";
else if (selector == @selector(close))
@@ -4227,6 +4231,10 @@ static NSString *Warning_;
return [NSString stringWithCString:value];
}
+- (void) addCydiaHost:(NSString *)host {
+ [CydiaHosts_ performSelectorOnMainThread:@selector(addObject:) withObject:host waitUntilDone:NO];
+}
+
- (void) addTrivialSource:(NSString *)href {
[delegate_ performSelectorOnMainThread:@selector(addTrivialSource:) withObject:href waitUntilDone:NO];
}
@@ -4563,7 +4571,7 @@ static NSString *Warning_;
NSURLResponse *response([source response]);
NSURL *url([response URL]);
- NSString *scheme([url scheme]);
+ //NSString *scheme([url scheme]);
NSString *host([url host]);
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
@@ -4572,11 +4580,7 @@ static NSString *Warning_;
[self setHeaders:headers forHost:host];
}
- if (
- [host isEqualToString:@"cydia.saurik.com"] ||
- [host hasSuffix:@".cydia.saurik.com"] ||
- [scheme isEqualToString:@"file"]
- )
+ if ([CydiaHosts_ containsObject:host])
[window setValue:cydia_ forKey:@"cydia"];
}
@@ -9924,6 +9928,8 @@ int main(int argc, char *argv[]) { _pooled
NSLog(@"unknown UIUserInterfaceIdiom!");
}
+ CydiaHosts_ = [NSMutableSet setWithObject:[[NSURL URLWithString:CydiaURL(@"")] host]];
+
UI_ = CydiaURL([NSString stringWithFormat:@"ui/ios~%@", Idiom_]);
PackageName = reinterpret_cast<CYString &(*)(Package *, SEL)>(method_getImplementation(class_getInstanceMethod([Package class], @selector(cyname))));