This commit is contained in:
opa334 2022-09-29 21:00:11 +02:00
parent f89279b620
commit 2900226770
13 changed files with 79 additions and 43 deletions

View File

@ -1,6 +1,6 @@
Package: com.opa334.trollstoreroothelper Package: com.opa334.trollstoreroothelper
Name: trollstoreroothelper Name: trollstoreroothelper
Version: 1.1 Version: 1.1.1
Architecture: iphoneos-arm Architecture: iphoneos-arm
Description: An awesome tool of some sort!! Description: An awesome tool of some sort!!
Maintainer: opa334 Maintainer: opa334

View File

@ -772,41 +772,44 @@ int installApp(NSString* appPath, BOOL sign, BOOL force)
int uninstallApp(NSString* appPath, NSString* appId) int uninstallApp(NSString* appPath, NSString* appId)
{ {
BKSTerminateApplicationForReasonAndReportWithDescription(appId, 5, false, @"TrollStore - App uninstalled"); if(appId)
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] deleting %@", containerPath); BKSTerminateApplicationForReasonAndReportWithDescription(appId, 5, false, @"TrollStore - App uninstalled");
// delete app container path
[[NSFileManager defaultManager] removeItemAtPath:containerPath error:nil];
}
// delete group container paths LSApplicationProxy* appProxy = [LSApplicationProxy applicationProxyForIdentifier:appId];
[[appProxy groupContainerURLs] enumerateKeysAndObjectsUsingBlock:^(NSString* groupId, NSURL* groupURL, BOOL* stop) MCMContainer *appContainer = [objc_getClass("MCMAppDataContainer") containerWithIdentifier:appId createIfNecessary:NO existed:nil error:nil];
{ NSString *containerPath = [appContainer url].path;
// If another app still has this group, don't delete it if(containerPath)
NSArray<LSApplicationProxy*>* appsWithGroup = applicationsWithGroupId(groupId);
if(appsWithGroup.count > 1)
{ {
NSLog(@"[uninstallApp] not deleting %@, appsWithGroup.count:%lu", groupURL, appsWithGroup.count); NSLog(@"[uninstallApp] deleting %@", containerPath);
return; // delete app container path
[[NSFileManager defaultManager] removeItemAtPath:containerPath error:nil];
} }
NSLog(@"[uninstallApp] deleting %@", groupURL); // delete group container paths
[[NSFileManager defaultManager] removeItemAtURL:groupURL error:nil]; [[appProxy groupContainerURLs] enumerateKeysAndObjectsUsingBlock:^(NSString* groupId, NSURL* groupURL, BOOL* stop)
}];
// delete app plugin paths
for(LSPlugInKitProxy* pluginProxy in appProxy.plugInKitPlugins)
{
NSURL* pluginURL = pluginProxy.dataContainerURL;
if(pluginURL)
{ {
NSLog(@"[uninstallApp] deleting %@", pluginURL); // If another app still has this group, don't delete it
[[NSFileManager defaultManager] removeItemAtURL:pluginURL error:nil]; NSArray<LSApplicationProxy*>* 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; if(!appPath) return 1;
NSString* appId = appIdForAppPath(appPath); NSString* appId = appIdForAppPath(appPath);
if(!appId) return 1;
return uninstallApp(appPath, appId); return uninstallApp(appPath, appId);
} }

View File

@ -52,6 +52,7 @@ BOOL constructContainerizationForEntitlements(NSDictionary* entitlements)
{ {
if(noContainer.boolValue) if(noContainer.boolValue)
{ {
NSLog(@"constructContainerizationForEntitlements NO com.apple.private.security.no-container");
return NO; return NO;
} }
} }
@ -61,10 +62,12 @@ BOOL constructContainerizationForEntitlements(NSDictionary* entitlements)
{ {
if(!containerRequired.boolValue) if(!containerRequired.boolValue)
{ {
NSLog(@"constructContainerizationForEntitlements NO com.apple.private.security.container-required");
return NO; return NO;
} }
} }
NSLog(@"constructContainerizationForEntitlements YES");
return YES; return YES;
} }

View File

@ -52,7 +52,7 @@
<string>iPhoneOS</string> <string>iPhoneOS</string>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.1</string> <string>1.1.1</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UIDeviceFamily</key> <key>UIDeviceFamily</key>

View File

@ -1,6 +1,6 @@
Package: com.opa334.trollstorehelper Package: com.opa334.trollstorehelper
Name: TrollStore Helper Name: TrollStore Helper
Version: 1.1 Version: 1.1.1
Architecture: iphoneos-arm Architecture: iphoneos-arm
Description: Helper utility to install and manage TrollStore! Description: Helper utility to install and manage TrollStore!
Maintainer: opa334 Maintainer: opa334

View File

@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>application-identifier</key> <key>application-identifier</key>
<string>com.opa334.TrollStore</string> <string>com.opa334.TrollStore</string>
<key>platform-application</key> <key>platform-application</key>
<true/> <true/>
<key>com.apple.security.exception.files.absolute-path.read-write</key> <key>com.apple.security.exception.files.absolute-path.read-write</key>
@ -18,17 +18,24 @@
<true/> <true/>
<key>com.apple.private.security.container-manager</key> <key>com.apple.private.security.container-manager</key>
<true/> <true/>
<key>com.apple.private.coreservices.canmaplsdatabase</key> <key>com.apple.private.coreservices.canmaplsdatabase</key>
<true/>
<key>com.apple.lsapplicationworkspace.rebuildappdatabases</key>
<true/>
<key>com.apple.private.MobileContainerManager.allowed</key>
<true/> <true/>
<key>com.apple.private.MobileInstallationHelperService.InstallDaemonOpsEnabled</key> <key>com.apple.lsapplicationworkspace.rebuildappdatabases</key>
<true/>
<key>com.apple.private.MobileContainerManager.allowed</key>
<true/>
<key>com.apple.private.MobileInstallationHelperService.InstallDaemonOpsEnabled</key>
<true/> <true/>
<key>com.apple.private.MobileInstallationHelperService.allowed</key> <key>com.apple.private.MobileInstallationHelperService.allowed</key>
<true/> <true/>
<key>com.apple.private.uninstall.deletion</key> <key>com.apple.private.uninstall.deletion</key>
<true/> <true/>
<key>com.apple.CommCenter.fine-grained</key>
<array>
<string>cellular-plan</string>
<string>data-usage</string>
<string>data-allowed-write</string>
<string>preferences-write</string>
</array>
</dict> </dict>
</plist> </plist>

View File

@ -1,10 +1,12 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "TSPHAppDelegate.h" #import "TSPHAppDelegate.h"
#import "../Store/TSUtil.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
@autoreleasepool { @autoreleasepool {
NSBundle* mcmBundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"]; NSBundle* mcmBundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"];
[mcmBundle load]; [mcmBundle load];
chineseWifiFixup();
return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSPHAppDelegate.class)); return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSPHAppDelegate.class));
} }
} }

View File

@ -50,7 +50,7 @@
<string>iPhoneOS</string> <string>iPhoneOS</string>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.1</string> <string>1.1.1</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UIDeviceFamily</key> <key>UIDeviceFamily</key>

View File

@ -1,5 +1,6 @@
@import Foundation; @import Foundation;
extern void chineseWifiFixup(void);
extern NSString* helperPath(void); extern NSString* helperPath(void);
extern void printMultilineNSString(NSString* stringToPrint); extern void printMultilineNSString(NSString* stringToPrint);
extern int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr); extern int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr);

View File

@ -4,11 +4,23 @@
#import <spawn.h> #import <spawn.h>
#import <sys/sysctl.h> #import <sys/sysctl.h>
@interface PSAppDataUsagePolicyCache : NSObject
+ (instancetype)sharedInstance;
- (void)setUsagePoliciesForBundle:(NSString*)bundleId cellular:(BOOL)cellular wifi:(BOOL)wifi;
@end
#define POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE 1 #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_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_uid_np(const posix_spawnattr_t* __restrict, uid_t);
extern int posix_spawnattr_set_persona_gid_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) NSString* helperPath(void)
{ {
return [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"trollstorehelper"]; return [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"trollstorehelper"];

View File

@ -1,6 +1,6 @@
Package: com.opa334.trollstore Package: com.opa334.trollstore
Name: TrollStore Name: TrollStore
Version: 1.1 Version: 1.1.1
Architecture: iphoneos-arm Architecture: iphoneos-arm
Description: An awesome application! Description: An awesome application!
Maintainer: opa334 Maintainer: opa334

View File

@ -32,5 +32,12 @@
<true/> <true/>
<key>com.apple.private.security.storage.MobileDocuments</key> <key>com.apple.private.security.storage.MobileDocuments</key>
<true/> <true/>
<key>com.apple.CommCenter.fine-grained</key>
<array>
<string>cellular-plan</string>
<string>data-usage</string>
<string>data-allowed-write</string>
<string>preferences-write</string>
</array>
</dict> </dict>
</plist> </plist>

View File

@ -1,8 +1,10 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "TSAppDelegate.h" #import "TSAppDelegate.h"
#import "TSUtil.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
@autoreleasepool { @autoreleasepool {
chineseWifiFixup();
return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSAppDelegate.class)); return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSAppDelegate.class));
} }
} }