From 29002267702c3423ea4f8f7dc74cdd221d6d7593 Mon Sep 17 00:00:00 2001 From: opa334 Date: Thu, 29 Sep 2022 21:00:11 +0200 Subject: [PATCH] 1.1.1 --- Helper/control | 2 +- Helper/main.m | 62 +++++++++++++------------- Helper/uicache.m | 3 ++ PersistenceHelper/Resources/Info.plist | 2 +- PersistenceHelper/control | 2 +- PersistenceHelper/entitlements.plist | 23 ++++++---- PersistenceHelper/main.m | 2 + Store/Resources/Info.plist | 2 +- Store/TSUtil.h | 1 + Store/TSUtil.m | 12 +++++ Store/control | 2 +- Store/entitlements.plist | 7 +++ Store/main.m | 2 + 13 files changed, 79 insertions(+), 43 deletions(-) diff --git a/Helper/control b/Helper/control index 4c4200b..51af46d 100644 --- a/Helper/control +++ b/Helper/control @@ -1,6 +1,6 @@ Package: com.opa334.trollstoreroothelper Name: trollstoreroothelper -Version: 1.1 +Version: 1.1.1 Architecture: iphoneos-arm Description: An awesome tool of some sort!! Maintainer: opa334 diff --git a/Helper/main.m b/Helper/main.m index 6e10e6a..b81e367 100644 --- a/Helper/main.m +++ b/Helper/main.m @@ -772,41 +772,44 @@ int installApp(NSString* appPath, BOOL sign, BOOL force) int uninstallApp(NSString* appPath, NSString* appId) { - BKSTerminateApplicationForReasonAndReportWithDescription(appId, 5, false, @"TrollStore - App uninstalled"); - - LSApplicationProxy* appProxy = [LSApplicationProxy applicationProxyForIdentifier:appId]; - MCMContainer *appContainer = [objc_getClass("MCMAppDataContainer") containerWithIdentifier:appId createIfNecessary:NO existed:nil error:nil]; - NSString *containerPath = [appContainer url].path; - if(containerPath) + if(appId) { - NSLog(@"[uninstallApp] deleting %@", containerPath); - // delete app container path - [[NSFileManager defaultManager] removeItemAtPath:containerPath error:nil]; - } + BKSTerminateApplicationForReasonAndReportWithDescription(appId, 5, false, @"TrollStore - App uninstalled"); - // delete group container paths - [[appProxy groupContainerURLs] enumerateKeysAndObjectsUsingBlock:^(NSString* groupId, NSURL* groupURL, BOOL* stop) - { - // If another app still has this group, don't delete it - NSArray* appsWithGroup = applicationsWithGroupId(groupId); - if(appsWithGroup.count > 1) + LSApplicationProxy* appProxy = [LSApplicationProxy applicationProxyForIdentifier:appId]; + MCMContainer *appContainer = [objc_getClass("MCMAppDataContainer") containerWithIdentifier:appId createIfNecessary:NO existed:nil error:nil]; + NSString *containerPath = [appContainer url].path; + if(containerPath) { - NSLog(@"[uninstallApp] not deleting %@, appsWithGroup.count:%lu", groupURL, appsWithGroup.count); - return; + NSLog(@"[uninstallApp] deleting %@", containerPath); + // delete app container path + [[NSFileManager defaultManager] removeItemAtPath:containerPath error:nil]; } - NSLog(@"[uninstallApp] deleting %@", groupURL); - [[NSFileManager defaultManager] removeItemAtURL:groupURL error:nil]; - }]; - - // delete app plugin paths - for(LSPlugInKitProxy* pluginProxy in appProxy.plugInKitPlugins) - { - NSURL* pluginURL = pluginProxy.dataContainerURL; - if(pluginURL) + // delete group container paths + [[appProxy groupContainerURLs] enumerateKeysAndObjectsUsingBlock:^(NSString* groupId, NSURL* groupURL, BOOL* stop) { - NSLog(@"[uninstallApp] deleting %@", pluginURL); - [[NSFileManager defaultManager] removeItemAtURL:pluginURL error:nil]; + // If another app still has this group, don't delete it + NSArray* appsWithGroup = applicationsWithGroupId(groupId); + if(appsWithGroup.count > 1) + { + NSLog(@"[uninstallApp] not deleting %@, appsWithGroup.count:%lu", groupURL, appsWithGroup.count); + return; + } + + NSLog(@"[uninstallApp] deleting %@", groupURL); + [[NSFileManager defaultManager] removeItemAtURL:groupURL error:nil]; + }]; + + // delete app plugin paths + for(LSPlugInKitProxy* pluginProxy in appProxy.plugInKitPlugins) + { + NSURL* pluginURL = pluginProxy.dataContainerURL; + if(pluginURL) + { + NSLog(@"[uninstallApp] deleting %@", pluginURL); + [[NSFileManager defaultManager] removeItemAtURL:pluginURL error:nil]; + } } } @@ -855,7 +858,6 @@ int uninstallAppByPath(NSString* appPath) { if(!appPath) return 1; NSString* appId = appIdForAppPath(appPath); - if(!appId) return 1; return uninstallApp(appPath, appId); } diff --git a/Helper/uicache.m b/Helper/uicache.m index f50e214..4f388d8 100644 --- a/Helper/uicache.m +++ b/Helper/uicache.m @@ -52,6 +52,7 @@ BOOL constructContainerizationForEntitlements(NSDictionary* entitlements) { if(noContainer.boolValue) { + NSLog(@"constructContainerizationForEntitlements NO com.apple.private.security.no-container"); return NO; } } @@ -61,10 +62,12 @@ BOOL constructContainerizationForEntitlements(NSDictionary* entitlements) { if(!containerRequired.boolValue) { + NSLog(@"constructContainerizationForEntitlements NO com.apple.private.security.container-required"); return NO; } } + NSLog(@"constructContainerizationForEntitlements YES"); return YES; } diff --git a/PersistenceHelper/Resources/Info.plist b/PersistenceHelper/Resources/Info.plist index 8830808..7fe3f73 100644 --- a/PersistenceHelper/Resources/Info.plist +++ b/PersistenceHelper/Resources/Info.plist @@ -52,7 +52,7 @@ iPhoneOS CFBundleVersion - 1.1 + 1.1.1 LSRequiresIPhoneOS UIDeviceFamily diff --git a/PersistenceHelper/control b/PersistenceHelper/control index ce555b4..f4fb68c 100644 --- a/PersistenceHelper/control +++ b/PersistenceHelper/control @@ -1,6 +1,6 @@ Package: com.opa334.trollstorehelper Name: TrollStore Helper -Version: 1.1 +Version: 1.1.1 Architecture: iphoneos-arm Description: Helper utility to install and manage TrollStore! Maintainer: opa334 diff --git a/PersistenceHelper/entitlements.plist b/PersistenceHelper/entitlements.plist index e3a4663..7a6c5fa 100644 --- a/PersistenceHelper/entitlements.plist +++ b/PersistenceHelper/entitlements.plist @@ -3,7 +3,7 @@ application-identifier - com.opa334.TrollStore + com.opa334.TrollStore platform-application com.apple.security.exception.files.absolute-path.read-write @@ -18,17 +18,24 @@ com.apple.private.security.container-manager - com.apple.private.coreservices.canmaplsdatabase - - com.apple.lsapplicationworkspace.rebuildappdatabases - - com.apple.private.MobileContainerManager.allowed + com.apple.private.coreservices.canmaplsdatabase - com.apple.private.MobileInstallationHelperService.InstallDaemonOpsEnabled + com.apple.lsapplicationworkspace.rebuildappdatabases + + com.apple.private.MobileContainerManager.allowed + + com.apple.private.MobileInstallationHelperService.InstallDaemonOpsEnabled com.apple.private.MobileInstallationHelperService.allowed - com.apple.private.uninstall.deletion + com.apple.private.uninstall.deletion + com.apple.CommCenter.fine-grained + + cellular-plan + data-usage + data-allowed-write + preferences-write + \ No newline at end of file diff --git a/PersistenceHelper/main.m b/PersistenceHelper/main.m index 757f9e5..d896872 100644 --- a/PersistenceHelper/main.m +++ b/PersistenceHelper/main.m @@ -1,10 +1,12 @@ #import #import "TSPHAppDelegate.h" +#import "../Store/TSUtil.h" int main(int argc, char *argv[]) { @autoreleasepool { NSBundle* mcmBundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"]; [mcmBundle load]; + chineseWifiFixup(); return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSPHAppDelegate.class)); } } diff --git a/Store/Resources/Info.plist b/Store/Resources/Info.plist index 2b31b54..1332f83 100644 --- a/Store/Resources/Info.plist +++ b/Store/Resources/Info.plist @@ -50,7 +50,7 @@ iPhoneOS CFBundleVersion - 1.1 + 1.1.1 LSRequiresIPhoneOS UIDeviceFamily diff --git a/Store/TSUtil.h b/Store/TSUtil.h index af54257..e01f9f0 100644 --- a/Store/TSUtil.h +++ b/Store/TSUtil.h @@ -1,5 +1,6 @@ @import Foundation; +extern void chineseWifiFixup(void); extern NSString* helperPath(void); extern void printMultilineNSString(NSString* stringToPrint); extern int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr); diff --git a/Store/TSUtil.m b/Store/TSUtil.m index 1a26cf6..2a225b7 100644 --- a/Store/TSUtil.m +++ b/Store/TSUtil.m @@ -4,11 +4,23 @@ #import #import +@interface PSAppDataUsagePolicyCache : NSObject ++ (instancetype)sharedInstance; +- (void)setUsagePoliciesForBundle:(NSString*)bundleId cellular:(BOOL)cellular wifi:(BOOL)wifi; +@end + #define POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE 1 extern int posix_spawnattr_set_persona_np(const posix_spawnattr_t* __restrict, uid_t, uint32_t); extern int posix_spawnattr_set_persona_uid_np(const posix_spawnattr_t* __restrict, uid_t); extern int posix_spawnattr_set_persona_gid_np(const posix_spawnattr_t* __restrict, uid_t); +void chineseWifiFixup(void) +{ + Class K_PSAppDataUsagePolicyCache = NSClassFromString(@"PSAppDataUsagePolicyCache"); + PSAppDataUsagePolicyCache* cache = [K_PSAppDataUsagePolicyCache sharedInstance]; + [cache setUsagePoliciesForBundle:NSBundle.mainBundle.bundleIdentifier cellular:true wifi:true]; +} + NSString* helperPath(void) { return [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"trollstorehelper"]; diff --git a/Store/control b/Store/control index 1013550..dcae019 100644 --- a/Store/control +++ b/Store/control @@ -1,6 +1,6 @@ Package: com.opa334.trollstore Name: TrollStore -Version: 1.1 +Version: 1.1.1 Architecture: iphoneos-arm Description: An awesome application! Maintainer: opa334 diff --git a/Store/entitlements.plist b/Store/entitlements.plist index b1b4f33..2ead6ca 100644 --- a/Store/entitlements.plist +++ b/Store/entitlements.plist @@ -32,5 +32,12 @@ com.apple.private.security.storage.MobileDocuments + com.apple.CommCenter.fine-grained + + cellular-plan + data-usage + data-allowed-write + preferences-write + \ No newline at end of file diff --git a/Store/main.m b/Store/main.m index bcb818c..dee9a84 100644 --- a/Store/main.m +++ b/Store/main.m @@ -1,8 +1,10 @@ #import #import "TSAppDelegate.h" +#import "TSUtil.h" int main(int argc, char *argv[]) { @autoreleasepool { + chineseWifiFixup(); return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSAppDelegate.class)); } }