From 89afe2061e0fc081bdacc8cb298a460b8a612ecb Mon Sep 17 00:00:00 2001 From: Sam Bingner Date: Mon, 15 Oct 2018 15:00:44 -1000 Subject: Refuse to load electra repos --- MobileCydia.mm | 2 +- Sources.mm | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/MobileCydia.mm b/MobileCydia.mm index d95bbdb..5242fbb 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -753,7 +753,7 @@ bool isSectionVisible(NSString *section) { static NSString *VerifySource(NSString *href) { static RegEx href_r("(http(s?)://|file:///)[^# ]*"); - if (!href_r(href)) { + if (!href_r(href) || [href rangeOfString:@"electra" options:NSCaseInsensitiveSearch].location != NSNotFound) { [[[[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:Colon_, Error_, UCLocalize("INVALID_URL")] message:UCLocalize("INVALID_URL_EX") diff --git a/Sources.mm b/Sources.mm index 9957123..cbf7b11 100644 --- a/Sources.mm +++ b/Sources.mm @@ -51,6 +51,10 @@ void CydiaWriteSources() { if ([[source objectForKey:@"URI"] hasPrefix:@"http://apt.bingner.com"] || [[source objectForKey:@"URI"] hasPrefix:@"https://apt.bingner.com"]) continue; + // Don't add Electra sources + if ([[source objectForKey:@"URI"] rangeOfString:@"electra" options:NSCaseInsensitiveSearch].location != NSNotFound) + continue; + NSArray *sections([source objectForKey:@"Sections"] ?: [NSArray array]); fprintf(file, "%s %s %s%s%s\n", @@ -66,6 +70,14 @@ void CydiaWriteSources() { } void CydiaAddSource(NSDictionary *source) { + // Ignore it if main source is added again + if ([[source objectForKey:@"URI"] hasPrefix:@"http://apt.bingner.com"] || [[source objectForKey:@"URI"] hasPrefix:@"https://apt.bingner.com"]) + return; + + // Don't add Electra sources + if ([[source objectForKey:@"URI"] rangeOfString:@"electra" options:NSCaseInsensitiveSearch].location != NSNotFound) + return; + [Sources_ setObject:source forKey:[NSString stringWithFormat:@"%@:%@:%@", [source objectForKey:@"Type"], [source objectForKey:@"URI"], [source objectForKey:@"Distribution"]]]; } -- cgit v1.2.3