Skip to content

Commit

Permalink
Merge pull request #307 from hugeBlack/main
Browse files Browse the repository at this point in the history
3.2.0
  • Loading branch information
hugeBlack authored Jan 15, 2025
2 parents e20e73f + 4a71b77 commit 7ac835f
Show file tree
Hide file tree
Showing 42 changed files with 1,229 additions and 337 deletions.
2 changes: 1 addition & 1 deletion AltStoreTweak/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TARGET := iphone:clang:latest:7.0
TARGET := iphone:clang:latest:15.0
ARCHS := arm64
include $(THEOS)/makefiles/common.mk

Expand Down
1 change: 1 addition & 0 deletions AltStoreTweak/Tweak.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static void LCAltstoreHookInit(void) {
NSUserDefaults* appGroupUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:appGroupId];
[appGroupUserDefaults setObject:certData forKey:@"LCCertificateData"];
[appGroupUserDefaults setObject:[NSString stringWithUTF8String:certPassword.bytes] forKey:@"LCCertificatePassword"];
[appGroupUserDefaults setObject:NSDate.now forKey:@"LCCertificateUpdateDate"];
NSLog(@"[LC] Successfully updated JIT-Less certificate!");
synced = YES;
}
10 changes: 10 additions & 0 deletions FoundationPrivate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <Foundation/Foundation.h>

@interface NSBundle(private)
- (id)_cfBundle;
@end

@interface NSUserDefaults(private)
+ (void)setStandardUserDefaults:(id)defaults;
- (NSString*)_identifier;
@end
2 changes: 2 additions & 0 deletions LCSharedUtils.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@import Foundation;

@interface LCSharedUtils : NSObject
+ (NSString*) teamIdentifier;
+ (NSString *)appGroupID;
+ (NSURL*) appGroupPath;
+ (NSString *)certificatePassword;
+ (BOOL)askForJIT;
+ (BOOL)launchToGuestApp;
Expand Down
61 changes: 42 additions & 19 deletions LCSharedUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,29 @@

extern NSUserDefaults *lcUserDefaults;
extern NSString *lcAppUrlScheme;
extern NSBundle *lcMainBundle;

@implementation LCSharedUtils

+ (NSString*) teamIdentifier {
static NSString* ans = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
ans = [[lcMainBundle.bundleIdentifier componentsSeparatedByString:@"."] lastObject];
});
return ans;
}

+ (NSString *)appGroupID {
static dispatch_once_t once;
static NSString *appGroupID = @"group.com.SideStore.SideStore";
static NSString *appGroupID = @"Unknown";
dispatch_once(&once, ^{
for (NSString *group in NSBundle.mainBundle.infoDictionary[@"ALTAppGroups"]) {
NSArray* possibleAppGroups = @[
[@"group.com.SideStore.SideStore." stringByAppendingString:[self teamIdentifier]],
[@"group.com.rileytestut.AltStore." stringByAppendingString:[self teamIdentifier]]
];

for (NSString *group in possibleAppGroups) {
NSURL *path = [NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:group];
NSURL *bundlePath = [path URLByAppendingPathComponent:@"Apps/com.kdt.livecontainer/App.app"];
if ([NSFileManager.defaultManager fileExistsAtPath:bundlePath.path]) {
Expand All @@ -23,12 +38,22 @@ + (NSString *)appGroupID {
return appGroupID;
}

+ (NSURL*) appGroupPath {
static NSURL *appGroupPath = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
appGroupPath = [NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:[LCSharedUtils appGroupID]];
});
return appGroupPath;
}

+ (NSString *)certificatePassword {
// password of cert retrieved from the store tweak is always @"". We just keep this function so we can check if certificate presents without changing codes.
NSString* ans = [[[NSUserDefaults alloc] initWithSuiteName:[self appGroupID]] objectForKey:@"LCCertificatePassword"];
if(ans) {
return ans;
return @"";
} else {
return [lcUserDefaults objectForKey:@"LCCertificatePassword"];
return nil;
}
}

Expand All @@ -45,10 +70,12 @@ + (BOOL)launchToGuestApp {
urlScheme = @"sidestore://sidejit-enable?bid=%@";
}
NSURL *launchURL = [NSURL URLWithString:[NSString stringWithFormat:urlScheme, NSBundle.mainBundle.bundleIdentifier]];
if ([UIApplication.sharedApplication canOpenURL:launchURL]) {

UIApplication *application = [NSClassFromString(@"UIApplication") sharedApplication];
if ([application canOpenURL:launchURL]) {
//[UIApplication.sharedApplication suspend];
for (int i = 0; i < tries; i++) {
[UIApplication.sharedApplication openURL:launchURL options:@{} completionHandler:^(BOOL b) {
[application openURL:launchURL options:@{} completionHandler:^(BOOL b) {
exit(0);
}];
}
Expand All @@ -63,8 +90,9 @@ + (BOOL)askForJIT {
if (!access(tsPath.UTF8String, F_OK)) {
urlScheme = @"apple-magnifier://enable-jit?bundle-id=%@";
NSURL *launchURL = [NSURL URLWithString:[NSString stringWithFormat:urlScheme, NSBundle.mainBundle.bundleIdentifier]];
if ([UIApplication.sharedApplication canOpenURL:launchURL]) {
[UIApplication.sharedApplication openURL:launchURL options:@{} completionHandler:nil];
UIApplication *application = [NSClassFromString(@"UIApplication") sharedApplication];
if ([application canOpenURL:launchURL]) {
[application openURL:launchURL options:@{} completionHandler:nil];
[LCSharedUtils launchToGuestApp];
return YES;
}
Expand Down Expand Up @@ -131,8 +159,7 @@ + (NSURL*)appLockPath {
static NSURL *infoPath;

dispatch_once(&once, ^{
NSURL *appGroupPath = [NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:[LCSharedUtils appGroupID]];
infoPath = [appGroupPath URLByAppendingPathComponent:@"LiveContainer/appLock.plist"];
infoPath = [[LCSharedUtils appGroupPath] URLByAppendingPathComponent:@"LiveContainer/appLock.plist"];
});
return infoPath;
}
Expand All @@ -142,8 +169,7 @@ + (NSURL*)containerLockPath {
static NSURL *infoPath;

dispatch_once(&once, ^{
NSURL *appGroupPath = [NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:[LCSharedUtils appGroupID]];
infoPath = [appGroupPath URLByAppendingPathComponent:@"LiveContainer/containerLock.plist"];
infoPath = [[LCSharedUtils appGroupPath] URLByAppendingPathComponent:@"LiveContainer/containerLock.plist"];
});
return infoPath;
}
Expand Down Expand Up @@ -250,8 +276,7 @@ + (void)moveSharedAppFolderBack {
.lastObject;
NSURL *docPathUrl = [fm URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]
.lastObject;
NSURL *appGroupPath = [NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:[LCSharedUtils appGroupID]];
NSURL *appGroupFolder = [appGroupPath URLByAppendingPathComponent:@"LiveContainer"];
NSURL *appGroupFolder = [[LCSharedUtils appGroupPath] URLByAppendingPathComponent:@"LiveContainer"];

NSError *error;
NSString *sharedAppDataFolderPath = [libraryPathUrl.path stringByAppendingPathComponent:@"SharedDocuments"];
Expand Down Expand Up @@ -289,8 +314,7 @@ + (NSBundle*)findBundleWithBundleId:(NSString*)bundleId {
NSBundle *appBundle = [[NSBundle alloc] initWithPath:bundlePath];
// not found locally, let's look for the app in shared folder
if (!appBundle) {
NSURL *appGroupPath = [NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:[LCSharedUtils appGroupID]];
appGroupFolder = [appGroupPath URLByAppendingPathComponent:@"LiveContainer"];
appGroupFolder = [[LCSharedUtils appGroupPath] URLByAppendingPathComponent:@"LiveContainer"];

bundlePath = [NSString stringWithFormat:@"%@/Applications/%@", appGroupFolder.path, bundleId];
appBundle = [[NSBundle alloc] initWithPath:bundlePath];
Expand Down Expand Up @@ -323,10 +347,9 @@ + (void)dumpPreferenceToPath:(NSString*)plistLocationTo dataUUID:(NSString*)data

+ (NSString*)findDefaultContainerWithBundleId:(NSString*)bundleId {
// find app's default container
NSURL *appGroupPath = [NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:[LCSharedUtils appGroupID]];
NSURL* appGroupFolder = [appGroupPath URLByAppendingPathComponent:@"LiveContainer"];
NSURL* appGroupFolder = [[LCSharedUtils appGroupPath] URLByAppendingPathComponent:@"LiveContainer"];

NSString* bundleInfoPath = [NSString stringWithFormat:@"%@/Applications/%@/Info.plist", appGroupFolder.path, bundleId];
NSString* bundleInfoPath = [NSString stringWithFormat:@"%@/Applications/%@/LCAppInfo.plist", appGroupFolder.path, bundleId];
NSDictionary* infoDict = [NSDictionary dictionaryWithContentsOfFile:bundleInfoPath];
return infoDict[@"LCDataUUID"];
}
Expand Down
1 change: 1 addition & 0 deletions LiveContainerSwiftUI/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import SwiftUI
let contentView = LCTabView()
window.rootViewController = UIHostingController(rootView: contentView)
window.makeKeyAndVisible()
application.shortcutItems = nil
return true
}

Expand Down
7 changes: 5 additions & 2 deletions LiveContainerSwiftUI/LCAppInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ typedef NS_ENUM(NSInteger, LCOrientationLock){
};

@interface LCAppInfo : NSObject {
NSMutableDictionary* _info;
NSString* _bundlePath;
NSMutableDictionary* _info;
NSMutableDictionary* _infoPlist;
NSString* _bundlePath;
}
@property NSString* relativeBundlePath;
@property bool isShared;
@property bool isJITNeeded;
@property bool isLocked;
@property bool isHidden;
@property bool doSymlinkInbox;
@property bool ignoreDlopenError;
@property bool fixBlackScreen;
@property bool bypassAssertBarrierOnQueue;
@property UIColor* cachedColor;
@property Signer signer;
Expand Down
Loading

0 comments on commit 7ac835f

Please sign in to comment.