Skip to content

Commit 39f7b1d

Browse files
committed
1.4-beta1
1: Improved uicache to avoid broken tweak-enabled apps causing dpkg failures. 2: Automatically run varClean for jailbroken apps and tweak-enabled trollstore apps 3: Reimplemented prefs-hook to keep var clean 4: Added "Hide all jailbroken/trollstore apps" button 5: add built-in roothide manager app 6: update built-in sileo
1 parent 89c6c71 commit 39f7b1d

File tree

18 files changed

+211
-24
lines changed

18 files changed

+211
-24
lines changed

Bootstrap.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@
571571
"$(inherited)",
572572
"@executable_path/Frameworks",
573573
);
574-
MARKETING_VERSION = 1.3.2;
574+
MARKETING_VERSION = "1.4-beta1";
575575
OTHER_LDFLAGS = "";
576576
PRODUCT_BUNDLE_IDENTIFIER = com.roothide.Bootstrap;
577577
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -609,7 +609,7 @@
609609
"$(inherited)",
610610
"@executable_path/Frameworks",
611611
);
612-
MARKETING_VERSION = 1.3.2;
612+
MARKETING_VERSION = "1.4-beta1";
613613
OTHER_LDFLAGS = "";
614614
PRODUCT_BUNDLE_IDENTIFIER = com.roothide.Bootstrap;
615615
PRODUCT_NAME = "$(TARGET_NAME)";

Bootstrap/AppEnabler.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ int enableForApp(NSString* bundlePath)
206206
NSString* err=nil;
207207
if(spawnBootstrap((char*[]){"/usr/bin/uicache","-p", bundlePath.UTF8String, NULL}, &log, &err) != 0) {
208208
STRAPLOG("%@\nERR:%@", log, err);
209+
AppInfo* app = [AppInfo appWithBundleIdentifier:appInfo[@"CFBundleIdentifier"]];
210+
if(app && [app.bundleURL.path hasPrefix:@"/Applications/"]) {
211+
ASSERT([fm removeItemAtPath:bundlePath error:nil]);
212+
}
209213
ABORT();
210214
}
211215
}

Bootstrap/AppViewController.m

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@
77
#include "AppDelegate.h"
88
#include <sys/stat.h>
99

10-
@interface PrivateApi_LSApplicationWorkspace
11-
- (NSArray*)allInstalledApplications;
12-
- (BOOL)openApplicationWithBundleID:(id)arg1;
13-
- (NSArray*)privateURLSchemes;
14-
- (NSArray*)publicURLSchemes;
15-
- (BOOL)_LSPrivateRebuildApplicationDatabasesForSystemApps:(BOOL)arg1
16-
internal:(BOOL)arg2
17-
user:(BOOL)arg3;
18-
@end
19-
2010
@interface AppViewController () {
2111
UISearchController *searchController;
2212
NSArray *appsArray;
@@ -149,8 +139,7 @@ -(BOOL)tweakEnabled:(AppInfo*)app {
149139

150140
- (void)updateData:(BOOL)sort {
151141
NSMutableArray* applications = [NSMutableArray new];
152-
PrivateApi_LSApplicationWorkspace* _workspace = [NSClassFromString(@"LSApplicationWorkspace") new];
153-
NSArray* allInstalledApplications = [_workspace allInstalledApplications];
142+
NSArray* allInstalledApplications = [LSApplicationWorkspace.defaultWorkspace allInstalledApplications];
154143

155144
for(id proxy in allInstalledApplications)
156145
{
@@ -366,8 +355,7 @@ - (void)cellLongPress:(UIGestureRecognizer *)recognizer
366355
AppInfo* app = isFiltered? filteredApps[indexPath.row] : appsArray[indexPath.row];
367356

368357
dispatch_async(dispatch_get_global_queue(0, 0), ^{
369-
PrivateApi_LSApplicationWorkspace* _workspace = [NSClassFromString(@"LSApplicationWorkspace") new];
370-
[_workspace openApplicationWithBundleID:app.bundleIdentifier];
358+
[LSApplicationWorkspace.defaultWorkspace openApplicationWithBundleID:app.bundleIdentifier];
371359
});
372360
}
373361
}

Bootstrap/ViewController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ void unbootstrapAction();
1515
BOOL updateOpensshStatus(BOOL notify);
1616
void resetMobilePassword();
1717
void URLSchemesAction(BOOL enable);
18+
void hideAllCTBugApps();
19+
void unhideAllCTBugApps();
20+
BOOL isAllCTBugAppsHidden();

Bootstrap/ViewController.m

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ void initFromSwiftUI()
143143
{
144144
if(checkServer()) {
145145
[AppDelegate addLogText:Localized(@"bootstrap server check successful")];
146+
147+
if(isAllCTBugAppsHidden()) {
148+
UIAlertController *alert = [UIAlertController alertControllerWithTitle:Localized(@"Jailbreak Apps is Hidden") message:Localized(@"Do you want to restore them now?") preferredStyle:UIAlertControllerStyleAlert];
149+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"NO") style:UIAlertActionStyleCancel handler:nil]];
150+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"YES") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
151+
unhideAllCTBugApps();
152+
}]];
153+
[AppDelegate showAlert:alert];
154+
}
146155
}
147156

148157
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillEnterForegroundNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
@@ -599,3 +608,125 @@ void resetMobilePassword()
599608
}]];
600609
[AppDelegate showAlert:alert];
601610
}
611+
612+
void hideAllCTBugApps()
613+
{
614+
UIAlertController *alert = [UIAlertController alertControllerWithTitle:Localized(@"Warning") message:Localized(@"This operation will make all apps installed via TrollStore/Bootstrap disappear from the Home Screen. You can restore them later via TrollStore Helper->[Refresh App Registrations] and Bootstrap->Settings->[Unhide Jailbreak Apps]") preferredStyle:UIAlertControllerStyleAlert];
615+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"Cancel") style:UIAlertActionStyleDefault handler:nil]];
616+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"Hide") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action){
617+
618+
dispatch_async(dispatch_get_global_queue(0, 0), ^{
619+
[AppDelegate showHudMsg:Localized(@"Hiding All Jailbreak/TrollStore Apps...")];
620+
621+
NSArray* allInstalledApplications = [LSApplicationWorkspace.defaultWorkspace allInstalledApplications];
622+
623+
BOOL TSHelperFound = NO;
624+
for(LSApplicationProxy* proxy in allInstalledApplications) {
625+
NSString* TSHelperMarker = [proxy.bundleURL.path stringByAppendingPathComponent:@".TrollStorePersistenceHelper"];
626+
if([NSFileManager.defaultManager fileExistsAtPath:TSHelperMarker]) {
627+
TSHelperFound = YES;
628+
break;
629+
}
630+
}
631+
632+
if(!TSHelperFound) {
633+
[AppDelegate dismissHud];
634+
635+
UIAlertController *alert = [UIAlertController alertControllerWithTitle:Localized(@"Error") message:Localized(@"You haven't installed TrollStore Helper yet, please install it in TrollStore->Settings first.") preferredStyle:UIAlertControllerStyleAlert];
636+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"OK") style:UIAlertActionStyleDefault handler:nil]];
637+
[AppDelegate showAlert:alert];
638+
639+
return;
640+
}
641+
642+
for(LSApplicationProxy* proxy in allInstalledApplications)
643+
{
644+
if([NSFileManager.defaultManager fileExistsAtPath:[proxy.bundleURL.path stringByAppendingString:@"/../_TrollStore"]])
645+
{
646+
if([proxy.bundleIdentifier isEqualToString:NSBundle.mainBundle.bundleIdentifier]) {
647+
continue;
648+
}
649+
650+
NSString* log=nil;
651+
NSString* err=nil;
652+
int status = spawnBootstrap((char*[]){"/usr/bin/uicache","-u",rootfsPrefix(proxy.bundleURL.path).fileSystemRepresentation,NULL}, &log, &err);
653+
if(status != 0) {
654+
[AppDelegate dismissHud];
655+
656+
NSString* msg = [NSString stringWithFormat:@"code(%d)\n%@\n\nstderr:\n%@",status,log,err];
657+
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:msg preferredStyle:UIAlertControllerStyleAlert];
658+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"OK") style:UIAlertActionStyleDefault handler:nil]];
659+
[AppDelegate showAlert:alert];
660+
661+
return;
662+
}
663+
}
664+
}
665+
666+
for(NSString* bundle in [NSFileManager.defaultManager directoryContentsAtPath:jbroot(@"/Applications")])
667+
{
668+
NSString* bundlePath = [@"/Applications" stringByAppendingPathComponent:bundle];
669+
NSDictionary* appInfo = [NSDictionary dictionaryWithContentsOfFile:[bundlePath stringByAppendingPathComponent:@"Info.plist"]];
670+
671+
if([appInfo[@"CFBundleIdentifier"] hasPrefix:@"com.apple."] && [NSFileManager.defaultManager fileExistsAtPath:bundlePath]) {
672+
continue;
673+
}
674+
675+
NSString* log=nil;
676+
NSString* err=nil;
677+
int status = spawnBootstrap((char*[]){"/usr/bin/uicache","-u",bundlePath.fileSystemRepresentation,NULL}, &log, &err);
678+
if(status != 0) {
679+
[AppDelegate dismissHud];
680+
681+
NSString* msg = [NSString stringWithFormat:@"code(%d)\n%@\n\nstderr:\n%@",status,log,err];
682+
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:msg preferredStyle:UIAlertControllerStyleAlert];
683+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"OK") style:UIAlertActionStyleDefault handler:nil]];
684+
[AppDelegate showAlert:alert];
685+
686+
return;
687+
}
688+
}
689+
690+
[AppDelegate dismissHud];
691+
692+
[[NSString stringWithFormat:@"%llX",jbrand()] writeToFile:jbroot(@"/var/mobile/.allctbugappshidden") atomically:YES encoding:NSUTF8StringEncoding error:nil];
693+
694+
NSString* log=nil;
695+
NSString* err=nil;
696+
int status = spawnBootstrap((char*[]){"/usr/bin/uicache","-u",rootfsPrefix(NSBundle.mainBundle.bundlePath).fileSystemRepresentation,NULL}, &log, &err);
697+
if(status != 0) {
698+
NSString* msg = [NSString stringWithFormat:@"code(%d)\n%@\n\nstderr:\n%@",status,log,err];
699+
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:msg preferredStyle:UIAlertControllerStyleAlert];
700+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"OK") style:UIAlertActionStyleDefault handler:nil]];
701+
[AppDelegate showAlert:alert];
702+
} else {
703+
exit(0);
704+
}
705+
});
706+
707+
}]];
708+
[AppDelegate showAlert:alert];
709+
}
710+
711+
void unhideAllCTBugApps()
712+
{
713+
NSString* log=nil;
714+
NSString* err=nil;
715+
int status = spawnBootstrap((char*[]){"/usr/bin/uicache","-a",NULL}, &log, &err);
716+
NSString* msg = (status==0) ? Localized(@"Done") : [NSString stringWithFormat:@"code(%d)\n%@\n\nstderr:\n%@",status,log,err];
717+
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:msg preferredStyle:UIAlertControllerStyleAlert];
718+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"OK") style:UIAlertActionStyleDefault handler:nil]];
719+
[AppDelegate showAlert:alert];
720+
721+
[NSFileManager.defaultManager removeItemAtPath:jbroot(@"/var/mobile/.allctbugappshidden") error:nil];
722+
}
723+
724+
BOOL isAllCTBugAppsHidden()
725+
{
726+
if(!isBootstrapInstalled() || !isSystemBootstrapped()) {
727+
return NO;
728+
}
729+
730+
NSString* flag = [NSString stringWithContentsOfFile:jbroot(@"/var/mobile/.allctbugappshidden") encoding:NSUTF8StringEncoding error:nil];
731+
return flag && [flag isEqualToString:[NSString stringWithFormat:@"%llX",jbrand()]];
732+
}

Bootstrap/Views/OptionsView.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct OptionsView: View {
1919
@Binding var tweakEnable: Bool
2020
@StateObject var allowURLSchemes = toggleState(state: isBootstrapInstalled() && FileManager.default.fileExists(atPath: jbroot("/var/mobile/.allow_url_schemes")))
2121
@StateObject var opensshStatus = toggleState(state: updateOpensshStatus(false))
22+
@StateObject var allCTBugAppsHidden = toggleState(state: isAllCTBugAppsHidden())
2223

2324
@Binding var colorScheme: Int
2425

@@ -177,6 +178,32 @@ struct OptionsView: View {
177178
)
178179
.disabled(!isSystemBootstrapped() || !checkBootstrapVersion())
179180

181+
Button {
182+
Haptic.shared.play(.light)
183+
if isAllCTBugAppsHidden() {
184+
unhideAllCTBugApps()
185+
} else {
186+
hideAllCTBugApps()
187+
}
188+
allCTBugAppsHidden.state = isAllCTBugAppsHidden()
189+
} label: {
190+
Label(
191+
title: { Text( allCTBugAppsHidden.state && isAllCTBugAppsHidden() ? "Unhide Jailbreak Apps" : "Hide All JB/TS Apps") },
192+
icon: { Image(systemName: "arrow.clockwise") }
193+
)
194+
.frame(maxWidth: .infinity)
195+
.padding(.vertical, 10)
196+
.foregroundColor((!isSystemBootstrapped() || !checkBootstrapVersion()) ? Color.accentColor : Color.init(uiColor: UIColor.label))
197+
}
198+
.frame(width: 250)
199+
.background(Color.clear)
200+
.overlay(
201+
RoundedRectangle(cornerRadius: 10)
202+
.stroke(.gray, lineWidth: 1)
203+
.opacity(0.3)
204+
)
205+
.disabled(!isSystemBootstrapped() || !checkBootstrapVersion())
206+
180207
Button {
181208
Haptic.shared.play(.light)
182209
resetMobilePassword()

Bootstrap/basebin/bootstrap.dylib

34.5 KB
Binary file not shown.

Bootstrap/basebin/bootstrapd

1 KB
Binary file not shown.

Bootstrap/basebin/devtest

0 Bytes
Binary file not shown.

Bootstrap/basebin/preload

272 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)