From 5649e8cda22c905a3674e67c05dddf1c0e8bffc1 Mon Sep 17 00:00:00 2001 From: staturnz <118011249+staturnzz@users.noreply.github.com> Date: Fri, 2 Jun 2023 04:22:58 -0500 Subject: [PATCH] Collection of small bug fixes (#2041) * [App] Fixes crash when removing a filter IndexPath was off due to the new 'Show Incompatible Packages' option * [App] Change community sources for palera1n based on jailbreak type * [App] Fixes jailbreak detection names for some * [App] Fixes userspace reboot args * [App] dist/iphoneos-arm64-rootless/1900 -> dist/1900 for iOS 16 --- .../ZBCommunitySourcesTableViewController.m | 23 ++++++++++++------- .../ZBFilterSettingsTableViewController.m | 6 ++--- Zebra/Tabs/Sources/Helpers/ZBBaseSource.m | 17 +++++++++----- Zebra/ZBDevice.h | 3 ++- Zebra/ZBDevice.m | 10 ++++---- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/Zebra/Tabs/Home/Community Sources/ZBCommunitySourcesTableViewController.m b/Zebra/Tabs/Home/Community Sources/ZBCommunitySourcesTableViewController.m index 77de2f70d7..38cdfc5d3a 100644 --- a/Zebra/Tabs/Home/Community Sources/ZBCommunitySourcesTableViewController.m +++ b/Zebra/Tabs/Home/Community Sources/ZBCommunitySourcesTableViewController.m @@ -165,18 +165,25 @@ - (NSArray *)utilitySources { break; case ZBJailbreakPalera1n: - [result addObject:@{@"type": @"utility", - @"name": @"Procursus", - @"url" : @"https://apt.procurs.us/", - @"icon": @"https://apt.procurs.us/CydiaIcon.png"}]; + if ([ZBDevice isPrefixed]) { + [result addObject:@{@"type": @"utility", + @"name": @"Procursus", + @"url" : @"https://apt.procurs.us/", + @"icon": @"https://apt.procurs.us/CydiaIcon.png"}]; + [result addObject:@{@"type": @"utility", + @"name": @"ElleKit", + @"url" : @"https://ellekit.space/", + @"icon": @"https://ellekit.space/CydiaIcon.png"}]; + } else { + [result addObject:@{@"type": @"utility", + @"name": @"palera1n strap", + @"url" : @"https://strap.palera.in/", + @"icon": @"https://strap.palera.in/CydiaIcon.png"}]; + } [result addObject:@{@"type": @"utility", @"name": @"palera1n", @"url" : @"https://repo.palera.in/", @"icon": @"https://repo.palera.in/CydiaIcon.png"}]; - [result addObject:@{@"type": @"utility", - @"name": @"ElleKit", - @"url" : @"https://ellekit.space/", - @"icon": @"https://ellekit.space/CydiaIcon.png"}]; break; case ZBJailbreakDopamine: diff --git a/Zebra/Tabs/Home/Settings/Filters/ZBFilterSettingsTableViewController.m b/Zebra/Tabs/Home/Settings/Filters/ZBFilterSettingsTableViewController.m index a00b442523..5b925e7f71 100644 --- a/Zebra/Tabs/Home/Settings/Filters/ZBFilterSettingsTableViewController.m +++ b/Zebra/Tabs/Home/Settings/Filters/ZBFilterSettingsTableViewController.m @@ -344,7 +344,7 @@ - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *) case 3: { UITableViewRowAction *deleteFilterAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:NSLocalizedString(@"Delete", @"") handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { switch (indexPath.section) { - case 0: { + case 1: { NSString *section = self->filteredSections[indexPath.row]; [self->filteredSections removeObject:section]; @@ -352,7 +352,7 @@ - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *) [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic]; break; } - case 1: { + case 2: { ZBSource *source = self->sources[indexPath.row]; [self->filteredSources removeObjectForKey:[source baseFilename]]; [self->sources removeObjectAtIndex:indexPath.row]; @@ -361,7 +361,7 @@ - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *) [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic]; break; } - case 2: { + case 3: { NSString *author = [self->blockedAuthors allKeys][indexPath.row]; [self->blockedAuthors removeObjectForKey:author]; diff --git a/Zebra/Tabs/Sources/Helpers/ZBBaseSource.m b/Zebra/Tabs/Sources/Helpers/ZBBaseSource.m index 50f51f338b..5282b7c1e4 100644 --- a/Zebra/Tabs/Sources/Helpers/ZBBaseSource.m +++ b/Zebra/Tabs/Sources/Helpers/ZBBaseSource.m @@ -158,7 +158,7 @@ - (id)initFromSourceLine:(NSString *)debLine { debLine = [debLine stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; NSMutableArray *lineComponents = [[debLine componentsSeparatedByString:@" "] mutableCopy]; - [lineComponents removeObject:@""]; //Remove empty strings from the line which exist for some reason + [lineComponents removeObject:@""]; // Remove empty strings from the line which exist for some reason NSUInteger count = [lineComponents count]; NSString *archiveType = NULL; @@ -172,12 +172,17 @@ - (id)initFromSourceLine:(NSString *)debLine { repositoryURI = lineComponents[1]; if (([self hasCFVersionComponent:repositoryURI]) && count == 3) { // Sources that are known to use CF number in URL but for some reason aren't written in the sources.list properly + int roundedCF = 100.0 * floor((kCFCoreFoundationVersionNumber/100.0) + 0.5); + if (roundedCF > kCFCoreFoundationVersionNumber) roundedCF -= 100.0; + if ([repositoryURI containsString:@"apt.procurs.us"]) { // Have to treat this differently because its special - int roundedCF = 100.0 * floor((kCFCoreFoundationVersionNumber/100.0)+0.5); - if (roundedCF > kCFCoreFoundationVersionNumber) roundedCF -= 100.0; - NSString *kind = [ZBDevice isPrefixed] ? @"iphoneos-arm64-rootless" : @"iphoneos-arm64"; + NSString *dist = roundedCF >= 1900 ? @"" : @"iphoneos-arm64-rootless"; + NSString *kind = [ZBDevice isPrefixed] ? dist : @"iphoneos-arm64"; distribution = [NSString stringWithFormat:@"%@/%d", kind, roundedCF]; } + else if ([repositoryURI containsString:@"strap.palera.in"]) { + distribution = [NSString stringWithFormat:@"%@/%d", @"iphoneos-arm64", roundedCF]; + } else { distribution = [NSString stringWithFormat:@"ios/%.2f", kCFCoreFoundationVersionNumber]; } @@ -186,7 +191,7 @@ - (id)initFromSourceLine:(NSString *)debLine { else if (count > 2) { distribution = lineComponents[2]; - //Group all of the components into the components array + // Group all of the components into the components array for (int i = 3; i < count; i++) { NSString *component = lineComponents[i]; if (component) { @@ -243,7 +248,7 @@ - (id)initFromURL:(NSURL *)url { - (BOOL)hasCFVersionComponent:(NSString * _Nullable)repositoryURI_ { NSString *repositoryURI = repositoryURI_ ?: self.repositoryURI; - return [repositoryURI containsString:@"apt.procurs.us"] || [repositoryURI containsString:@"apt.bingner.com"] || [repositoryURI containsString:@"apt.saurik.com"]; + return [repositoryURI containsString:@"apt.procurs.us"] || [repositoryURI containsString:@"apt.bingner.com"] || [repositoryURI containsString:@"apt.saurik.com"] || [repositoryURI containsString:@"strap.palera.in"]; } - (void)verify:(nullable void (^)(ZBSourceVerificationStatus status))completion { diff --git a/Zebra/ZBDevice.h b/Zebra/ZBDevice.h index 34341080d4..a8dfa05eb3 100644 --- a/Zebra/ZBDevice.h +++ b/Zebra/ZBDevice.h @@ -40,7 +40,8 @@ typedef NS_ENUM(NSUInteger, ZBJailbreak) { ZBJailbreakMineekJB32, ZBJailbreakMineekJB64, ZBJailbreakMineekJB, - ZBJailbreakBakera1n + ZBJailbreakBakera1n, + ZBJailbreakP0insettia }; typedef NS_ENUM(NSUInteger, ZBBootstrap) { diff --git a/Zebra/ZBDevice.m b/Zebra/ZBDevice.m index 06c66984a8..1c2796df56 100644 --- a/Zebra/ZBDevice.m +++ b/Zebra/ZBDevice.m @@ -250,7 +250,7 @@ + (void)restartDevice { if (@available(iOS 15, *)) { // Try userspace reboot NSLog(@"[Zebra] Trying userspace reboot"); - if ([ZBCommand execute:@"launchctl" withArguments:@[@"userspace", @"reboot"] asRoot:YES]) { + if ([ZBCommand execute:@"launchctl" withArguments:@[@"reboot", @"userspace"] asRoot:YES]) { return; } } else if (@available(iOS 11, *)) { @@ -343,7 +343,8 @@ + (ZBJailbreak)_jailbreak { @"/.meridian_installed": @(ZBJailbreakMeridian), @"/.installed_yaluX": @(ZBJailbreakYalu), @"/.installed_g0blin": @(ZBJailbreakG0blin), - @"/cores/binpack/.installed_overlay": @(ZBJailbreakBakera1n) + @"/.installed_p0insettia": @(ZBJailbreakP0insettia), + @"/cores/binpack/.installed_overlay": @(ZBJailbreakBakera1n), }; NSDictionary *jailbreakInstalledDirs = @{ @"/binpack": @(ZBJailbreakCheckra1n), @@ -422,7 +423,7 @@ + (NSString *)jailbreakName { case ZBJailbreakDopamine: return @"Dopamine"; case ZBJailbreakSocket: return @"socket"; case ZBJailbreakH3lix: return @"h3lix"; - case ZBJailbreakBlizzard9: return @"Blizzard"; + case ZBJailbreakBlizzard9: return @"Blizzard9"; case ZBJailbreakOpenpwnage: return @"Openpwnage"; case ZBJailbreakHomeDepot: return @"Home Depot"; case ZBJailbreakKok3shi: return @"kok3shi"; @@ -430,13 +431,14 @@ + (NSString *)jailbreakName { case ZBJailbreakDoubleH3lix: return @"doubleH3lix"; case ZBJailbreakMeridian: return @"Meridian"; case ZBJailbreakYalu: return @"yalu"; - case ZBJailbreakSaigon: return @"palera1n"; + case ZBJailbreakSaigon: return @"Saïgon"; case ZBJailbreakG0blin: return @"g0blin"; case ZBJailbreakKok3shiX: return @"kok3shiX"; case ZBJailbreakMineekJB32: return @"mineekJB (32-bit)"; case ZBJailbreakMineekJB64: return @"mineekJB (64-bit)"; case ZBJailbreakMineekJB: return @"mineekJB"; case ZBJailbreakBakera1n: return @"bakera1n"; + case ZBJailbreakP0insettia: return @"p0insettia"; } }