Skip to content

Commit

Permalink
beta 1.2.5
Browse files Browse the repository at this point in the history
1: fix an issue that could cause abnormal battery drain/device overheating

2: prevent some jailbroken apps from causing kernel panics on iOS 17.0 A15+ devices

3: fixed the issue where some apps may be detected as jailbroken

4: keep the screen on during bootstrapping to prevent the device from going to sleep
  • Loading branch information
roothider committed Sep 4, 2024
1 parent 9e3523c commit 56cbfdb
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 29 deletions.
16 changes: 8 additions & 8 deletions Bootstrap.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
84438D602B26546E00A1E407 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84438D5F2B26546E00A1E407 /* MobileCoreServices.framework */; };
84438D622B2654EB00A1E407 /* MobileContainerManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84438D612B2654EB00A1E407 /* MobileContainerManager.framework */; };
84438D652B27522400A1E407 /* envbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 84438D642B27522400A1E407 /* envbuf.c */; };
84438D6C2B2CDE0100A1E407 /* AppList.m in Sources */ = {isa = PBXBuildFile; fileRef = 84438D682B2CDE0100A1E407 /* AppList.m */; };
84438D6C2B2CDE0100A1E407 /* AppInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 84438D682B2CDE0100A1E407 /* AppInfo.m */; };
84438D6D2B2CDE0100A1E407 /* AppViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84438D6B2B2CDE0100A1E407 /* AppViewController.m */; };
84438D6F2B2CE5A300A1E407 /* AppEnabler.m in Sources */ = {isa = PBXBuildFile; fileRef = 84438D6E2B2CE5A300A1E407 /* AppEnabler.m */; };
847099872B1D855D003FA4ED /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 847099862B1D855D003FA4ED /* AppDelegate.m */; };
Expand Down Expand Up @@ -83,8 +83,8 @@
84438D612B2654EB00A1E407 /* MobileContainerManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileContainerManager.framework; path = Bootstrap/Frameworks/MobileContainerManager.framework; sourceTree = "<group>"; };
84438D632B27522400A1E407 /* envbuf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = envbuf.h; sourceTree = "<group>"; };
84438D642B27522400A1E407 /* envbuf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = envbuf.c; sourceTree = "<group>"; };
84438D682B2CDE0100A1E407 /* AppList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppList.m; sourceTree = "<group>"; };
84438D692B2CDE0100A1E407 /* AppList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppList.h; sourceTree = "<group>"; };
84438D682B2CDE0100A1E407 /* AppInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppInfo.m; sourceTree = "<group>"; };
84438D692B2CDE0100A1E407 /* AppInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppInfo.h; sourceTree = "<group>"; };
84438D6A2B2CDE0100A1E407 /* AppViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppViewController.h; sourceTree = "<group>"; };
84438D6B2B2CDE0100A1E407 /* AppViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppViewController.m; sourceTree = "<group>"; };
84438D6E2B2CE5A300A1E407 /* AppEnabler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppEnabler.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -190,8 +190,8 @@
FE0633B52B41CF6600B94787 /* Views */,
FE0633B42B41CF5800B94787 /* Extensions */,
FE0633B32B41CF4D00B94787 /* Classes */,
84438D692B2CDE0100A1E407 /* AppList.h */,
84438D682B2CDE0100A1E407 /* AppList.m */,
84438D692B2CDE0100A1E407 /* AppInfo.h */,
84438D682B2CDE0100A1E407 /* AppInfo.m */,
847099852B1D855D003FA4ED /* AppDelegate.h */,
847099862B1D855D003FA4ED /* AppDelegate.m */,
847099882B1D855D003FA4ED /* SceneDelegate.h */,
Expand Down Expand Up @@ -378,7 +378,7 @@
847099982B1D855E003FA4ED /* main.m in Sources */,
84438D522B260FEB00A1E407 /* zstd_wrapper.m in Sources */,
8470998A2B1D855D003FA4ED /* SceneDelegate.m in Sources */,
84438D6C2B2CDE0100A1E407 /* AppList.m in Sources */,
84438D6C2B2CDE0100A1E407 /* AppInfo.m in Sources */,
84438D6D2B2CDE0100A1E407 /* AppViewController.m in Sources */,
84438D5D2B264A2800A1E407 /* NSUserDefaults+appDefaults.m in Sources */,
);
Expand Down Expand Up @@ -571,7 +571,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.4;
MARKETING_VERSION = 1.2.5;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.roothide.Bootstrap;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -609,7 +609,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.4;
MARKETING_VERSION = 1.2.5;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.roothide.Bootstrap;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
2 changes: 1 addition & 1 deletion Bootstrap/AppEnabler.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>
#include <sys/stat.h>
#include "AppList.h"
#include "AppInfo.h"
#include "common.h"

NSString * relativize(NSURL * to, NSURL * from, BOOL fromIsDir) {
Expand Down
2 changes: 1 addition & 1 deletion Bootstrap/AppList.h → Bootstrap/AppInfo.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#import <UIKit/UIKit.h>


@interface AppList : NSObject
@interface AppInfo : NSObject
@property (nonatomic, strong) NSString *infoPlistPath;

@property (nonatomic, readonly) NSString* bundleIdentifier;
Expand Down
4 changes: 2 additions & 2 deletions Bootstrap/AppList.m → Bootstrap/AppInfo.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://github.com/wujianguo/iOSAppsInfo
// modified by Shadow-

#import "AppList.h"
#import "AppInfo.h"
#import <dlfcn.h>

@interface UIImage ()
Expand Down Expand Up @@ -42,7 +42,7 @@ + (instancetype)applicationProxyForIdentifier:(NSString*)identifier;
@end


@implementation AppList
@implementation AppInfo
{
PrivateApi_LSApplicationProxy* _applicationProxy;
UIImage* _icon;
Expand Down
24 changes: 12 additions & 12 deletions Bootstrap/AppViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#import "AppViewController.h"
#include "AppDelegate.h"
#import "AppList.h"
#import "AppInfo.h"
#include "common.h"
#include "AppDelegate.h"
#include <sys/stat.h>
Expand Down Expand Up @@ -54,7 +54,7 @@ -(void)reloadSearch {
isFiltered = true;
filteredApps = [[NSMutableArray alloc] init];
searchText = searchText.lowercaseString;
for (AppList* app in appsArray) {
for (AppInfo* app in appsArray) {
NSRange nameRange = [app.name.lowercaseString rangeOfString:searchText options:NSCaseInsensitiveSearch];
NSRange bundleIdRange = [app.bundleIdentifier.lowercaseString rangeOfString:searchText options:NSCaseInsensitiveSearch];
if(nameRange.location != NSNotFound || bundleIdRange.location != NSNotFound) {
Expand Down Expand Up @@ -127,7 +127,7 @@ - (void)viewWillAppear:(BOOL)animated {
[self.tableView.refreshControl endRefreshing];
}

-(BOOL)tweakEnabled:(AppList*)app {
-(BOOL)tweakEnabled:(AppInfo*)app {
struct stat st;
if(lstat([app.bundleURL.path stringByAppendingPathComponent:@".jbroot"].fileSystemRepresentation, &st)==0) {
return YES;
Expand Down Expand Up @@ -156,7 +156,7 @@ - (void)updateData:(BOOL)sort {

for(id proxy in allInstalledApplications)
{
AppList* app = [AppList appWithPrivateProxy:proxy];
AppInfo* app = [AppInfo appWithPrivateProxy:proxy];

// if(app.isHiddenApp) continue;

Expand Down Expand Up @@ -196,7 +196,7 @@ - (void)updateData:(BOOL)sort {

if(sort)
{
NSArray *appsSortedByName = [applications sortedArrayUsingComparator:^NSComparisonResult(AppList *app1, AppList *app2) {
NSArray *appsSortedByName = [applications sortedArrayUsingComparator:^NSComparisonResult(AppInfo *app1, AppInfo *app2) {

BOOL enabled1 = [self tweakEnabled:app1];
BOOL enabled2 = [self tweakEnabled:app2];
Expand All @@ -217,9 +217,9 @@ - (void)updateData:(BOOL)sort {
else
{
NSMutableArray *newapps = [NSMutableArray array];
[applications enumerateObjectsUsingBlock:^(AppList *newobj, NSUInteger idx, BOOL * _Nonnull stop) {
[applications enumerateObjectsUsingBlock:^(AppInfo *newobj, NSUInteger idx, BOOL * _Nonnull stop) {
__block BOOL hasBeenContained = NO;
[self->appsArray enumerateObjectsUsingBlock:^(AppList *obj, NSUInteger idx, BOOL * _Nonnull stop) {
[self->appsArray enumerateObjectsUsingBlock:^(AppInfo *obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.bundleIdentifier isEqualToString:newobj.bundleIdentifier]) {
hasBeenContained = YES;
*stop = YES;
Expand All @@ -231,8 +231,8 @@ - (void)updateData:(BOOL)sort {
}];

NSMutableArray *tmpArray = [NSMutableArray array];
[self->appsArray enumerateObjectsUsingBlock:^(AppList *obj, NSUInteger idx, BOOL * _Nonnull stop) {
[applications enumerateObjectsUsingBlock:^(AppList *newobj, NSUInteger idx, BOOL * _Nonnull stop) {
[self->appsArray enumerateObjectsUsingBlock:^(AppInfo *obj, NSUInteger idx, BOOL * _Nonnull stop) {
[applications enumerateObjectsUsingBlock:^(AppInfo *newobj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.bundleIdentifier isEqualToString:newobj.bundleIdentifier]) {
[tmpArray addObject:newobj];
*stop = YES;
Expand Down Expand Up @@ -291,7 +291,7 @@ - (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"];

AppList* app = isFiltered? filteredApps[indexPath.row] : appsArray[indexPath.row];
AppInfo* app = isFiltered? filteredApps[indexPath.row] : appsArray[indexPath.row];

if(!app.isHiddenApp) {
UIImage *image = app.icon;
Expand Down Expand Up @@ -328,7 +328,7 @@ - (void)switchChanged:(id)sender {
CGPoint pos = [switchInCell convertPoint:switchInCell.bounds.origin toView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:pos];
BOOL enabled = switchInCell.on;
AppList* app = isFiltered? filteredApps[indexPath.row] : appsArray[indexPath.row];
AppInfo* app = isFiltered? filteredApps[indexPath.row] : appsArray[indexPath.row];

dispatch_async(dispatch_get_global_queue(0, 0), ^{
[AppDelegate showHudMsg:Localized(@"Applying")];
Expand Down Expand Up @@ -365,7 +365,7 @@ - (void)cellLongPress:(UIGestureRecognizer *)recognizer
long tag = recognizer.view.tag;
NSIndexPath* indexPath = [NSIndexPath indexPathForRow:tag&0xFFFFFFFF inSection:tag>>32];

AppList* app = isFiltered? filteredApps[indexPath.row] : appsArray[indexPath.row];
AppInfo* app = isFiltered? filteredApps[indexPath.row] : appsArray[indexPath.row];

dispatch_async(dispatch_get_global_queue(0, 0), ^{
PrivateApi_LSApplicationWorkspace* _workspace = [NSClassFromString(@"LSApplicationWorkspace") new];
Expand Down
18 changes: 16 additions & 2 deletions Bootstrap/ViewController.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "common.h"
#include "credits.h"
#include "bootstrap.h"
#include "AppList.h"
#include "AppInfo.h"
#include "AppDelegate.h"
#import "ViewController.h"
#include "AppViewController.h"
Expand Down Expand Up @@ -151,6 +151,12 @@ void initFromSwiftUI()

@end

void setIdleTimerDisabled(BOOL disabled) {
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setIdleTimerDisabled:disabled];
});
}

BOOL checkTSVersion()
{
CFURLRef binaryURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (__bridge CFStringRef)NSBundle.mainBundle.executablePath, kCFURLPOSIXPathStyle, false);
Expand Down Expand Up @@ -184,6 +190,7 @@ void rebuildappsAction()

dispatch_async(dispatch_get_global_queue(0, 0), ^{
[AppDelegate showHudMsg:Localized(@"Applying")];
setIdleTimerDisabled(YES);

NSString* log=nil;
NSString* err=nil;
Expand All @@ -194,6 +201,7 @@ void rebuildappsAction()
[AppDelegate showMesage:[NSString stringWithFormat:@"%@\n\nstderr:\n%@",log,err] title:[NSString stringWithFormat:@"code(%d)",status]];
}
[AppDelegate dismissHud];
setIdleTimerDisabled(NO);
});
}

Expand Down Expand Up @@ -240,7 +248,7 @@ void reinstallPackageManager()

int rebuildIconCache()
{
AppList* tsapp = [AppList appWithBundleIdentifier:@"com.opa334.TrollStore"];
AppInfo* tsapp = [AppInfo appWithBundleIdentifier:@"com.opa334.TrollStore"];
if(!tsapp) {
STRAPLOG("trollstore not found!");
return -1;
Expand Down Expand Up @@ -279,6 +287,7 @@ void rebuildIconCacheAction()
[AppDelegate addLogText:Localized(@"Status: Rebuilding Icon Cache")];

dispatch_async(dispatch_get_global_queue(0, 0), ^{
setIdleTimerDisabled(YES);
[AppDelegate showHudMsg:Localized(@"Rebuilding") detail:Localized(@"Don't exit Bootstrap app until show the lock screen")];

NSString* log=nil;
Expand All @@ -289,6 +298,7 @@ void rebuildIconCacheAction()
}

[AppDelegate dismissHud];
setIdleTimerDisabled(NO);
});
}

Expand Down Expand Up @@ -424,6 +434,7 @@ void bootstrapAction()
[AppDelegate showHudMsg:Localized(@"Bootstrapping")];

dispatch_async(dispatch_get_global_queue(0, 0), ^{
setIdleTimerDisabled(YES);

const char* argv[] = {NSBundle.mainBundle.executablePath.fileSystemRepresentation, "bootstrap", NULL};
int status = spawn(argv[0], argv, environ, ^(char* outstr, int length){
Expand All @@ -435,6 +446,7 @@ void bootstrapAction()
});

[AppDelegate dismissHud];
setIdleTimerDisabled(NO);

if(status != 0)
{
Expand Down Expand Up @@ -478,12 +490,14 @@ void unbootstrapAction()

dispatch_async(dispatch_get_global_queue(0, 0), ^{
[AppDelegate showHudMsg:Localized(@"Uninstalling")];
setIdleTimerDisabled(YES);

NSString* log=nil;
NSString* err=nil;
int status = spawnRoot(NSBundle.mainBundle.executablePath, @[@"unbootstrap"], &log, &err);

[AppDelegate dismissHud];
setIdleTimerDisabled(NO);

NSString* msg = (status==0) ? Localized(@"bootstrap uninstalled") : [NSString stringWithFormat:@"code(%d)\n%@\n\nstderr:\n%@",status,log,err];

Expand Down
Binary file modified Bootstrap/basebin/bootstrap.dylib
Binary file not shown.
Binary file modified Bootstrap/basebin/bootstrapd
Binary file not shown.
Binary file modified Bootstrap/basebin/devtest
Binary file not shown.
Binary file modified Bootstrap/basebin/preload
Binary file not shown.
Binary file modified Bootstrap/basebin/preload.dylib
Binary file not shown.
Binary file modified Bootstrap/basebin/rebuildapp
Binary file not shown.
Binary file modified Bootstrap/basebin/uicache
Binary file not shown.
4 changes: 2 additions & 2 deletions Bootstrap/bootstrap.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "sources.h"
#include "bootstrap.h"
#include "NSUserDefaults+appDefaults.h"
#include "AppList.h"
#include "AppInfo.h"

extern int decompress_tar_zstd(const char* src_file_path, const char* dst_file_path);

Expand Down Expand Up @@ -448,7 +448,7 @@ int unbootstrap()

[LSApplicationWorkspace.defaultWorkspace _LSPrivateRebuildApplicationDatabasesForSystemApps:YES internal:YES user:YES];

AppList* tsapp = [AppList appWithBundleIdentifier:@"com.opa334.TrollStore"];
AppInfo* tsapp = [AppInfo appWithBundleIdentifier:@"com.opa334.TrollStore"];
if(tsapp) {
NSString* log=nil;
NSString* err=nil;
Expand Down
2 changes: 1 addition & 1 deletion basebin

0 comments on commit 56cbfdb

Please sign in to comment.