mirror of
https://github.com/opa334/TrollStore.git
synced 2026-07-02 11:17:51 +08:00
1.4
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
<string>iPhoneOS</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.3.5</string>
|
||||
<string>1.4</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIDeviceFamily</key>
|
||||
|
||||
@@ -366,7 +366,7 @@ extern UIImage* imageWithSize(UIImage* image, CGSize size);
|
||||
_archive = archive_read_new();
|
||||
archive_read_support_format_all(_archive);
|
||||
archive_read_support_filter_all(_archive);
|
||||
int r = archive_read_open_filename(_archive, _path.UTF8String, 10240);
|
||||
int r = archive_read_open_filename(_archive, _path.fileSystemRepresentation, 10240);
|
||||
return r ? r : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ UIImage* imageWithSize(UIImage* image, CGSize size)
|
||||
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls
|
||||
{
|
||||
NSString* pathToIPA = urls.firstObject.path;
|
||||
[TSInstallationController presentInstallationAlertForFile:pathToIPA completion:nil];
|
||||
[TSInstallationController presentInstallationAlertIfEnabledForFile:pathToIPA isRemoteInstall:NO completion:nil];
|
||||
}
|
||||
|
||||
- (void)openAppPressedForRowAtIndexPath:(NSIndexPath*)indexPath
|
||||
|
||||
@@ -30,6 +30,12 @@
|
||||
case 167:
|
||||
errorDescription = @"The IPA file does not appear to contain an app.";
|
||||
break;
|
||||
case 168:
|
||||
errorDescription = @"Failed to extract IPA file.";
|
||||
break;
|
||||
case 169:
|
||||
errorDescription = @"Failed to extract update tar file.";
|
||||
break;
|
||||
// App install errors
|
||||
case 170:
|
||||
errorDescription = @"Failed to create container for app bundle.";
|
||||
@@ -61,10 +67,9 @@
|
||||
case 179:
|
||||
errorDescription = @"The app you tried to install has the same identifier as a system app already installed on the device. The installation has been prevented to protect you from possible bootloops or other issues.";
|
||||
break;
|
||||
// App detach errors
|
||||
/*case 184:
|
||||
errorDescription = @"Refusing to detach, the app is still signed with a fake root certificate. The detach option is only for when you have installed an App Store app on top of a TrollStore app.";
|
||||
break;*/
|
||||
case 180:
|
||||
errorDescription = @"The LSApplicationWorkspace app installation failed.";
|
||||
break;
|
||||
}
|
||||
|
||||
NSError* error = [NSError errorWithDomain:TrollStoreErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey : errorDescription}];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
@interface TSInstallationController : NSObject
|
||||
|
||||
+ (void)presentInstallationAlertForFile:(NSString*)pathToIPA completion:(void (^)(BOOL, NSError*))completion;
|
||||
+ (void)presentInstallationAlertIfEnabledForFile:(NSString*)pathToIPA isRemoteInstall:(BOOL)remoteInstall completion:(void (^)(BOOL, NSError*))completionBlock;
|
||||
|
||||
+ (void)handleAppInstallFromFile:(NSString*)pathToIPA forceInstall:(BOOL)force completion:(void (^)(BOOL, NSError*))completion;
|
||||
+ (void)handleAppInstallFromFile:(NSString*)pathToIPA completion:(void (^)(BOOL, NSError*))completion;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#import <TSUtil.h>
|
||||
#import <TSPresentationDelegate.h>
|
||||
|
||||
extern NSUserDefaults* trollStoreUserDefaults(void);
|
||||
|
||||
@implementation TSInstallationController
|
||||
|
||||
+ (void)handleAppInstallFromFile:(NSString*)pathToIPA forceInstall:(BOOL)force completion:(void (^)(BOOL, NSError*))completionBlock
|
||||
@@ -73,8 +75,30 @@
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)presentInstallationAlertForFile:(NSString*)pathToIPA completion:(void (^)(BOOL, NSError*))completionBlock
|
||||
+ (void)presentInstallationAlertIfEnabledForFile:(NSString*)pathToIPA isRemoteInstall:(BOOL)remoteInstall completion:(void (^)(BOOL, NSError*))completionBlock
|
||||
{
|
||||
NSNumber* installAlertConfigurationNum = [trollStoreUserDefaults() objectForKey:@"installAlertConfiguration"];
|
||||
NSUInteger installAlertConfiguration = 0;
|
||||
if(installAlertConfigurationNum)
|
||||
{
|
||||
installAlertConfiguration = installAlertConfigurationNum.unsignedIntegerValue;
|
||||
if(installAlertConfiguration > 2)
|
||||
{
|
||||
// broken pref? revert to 0
|
||||
installAlertConfiguration = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if user disabled alert for this kind of install
|
||||
if(installAlertConfiguration > 0)
|
||||
{
|
||||
if(installAlertConfiguration == 2 || (installAlertConfiguration == 1 && !remoteInstall))
|
||||
{
|
||||
[self handleAppInstallFromFile:pathToIPA completion:completionBlock];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TSAppInfo* appInfo = [[TSAppInfo alloc] initWithIPAPath:pathToIPA];
|
||||
[appInfo loadInfoWithCompletion:^(NSError* error)
|
||||
{
|
||||
@@ -144,7 +168,7 @@
|
||||
NSString* tmpIpaPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"tmp.ipa"];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:tmpIpaPath error:nil];
|
||||
[[NSFileManager defaultManager] moveItemAtPath:location.path toPath:tmpIpaPath error:nil];
|
||||
[self presentInstallationAlertForFile:tmpIpaPath completion:^(BOOL success, NSError* error)
|
||||
[self presentInstallationAlertIfEnabledForFile:tmpIpaPath isRemoteInstall:YES completion:^(BOOL success, NSError* error)
|
||||
{
|
||||
[[NSFileManager defaultManager] removeItemAtPath:tmpIpaPath error:nil];
|
||||
if(completionBlock) completionBlock(success, error);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
if ([url.pathExtension.lowercaseString isEqualToString:@"ipa"] || [url.pathExtension.lowercaseString isEqualToString:@"tipa"])
|
||||
{
|
||||
[TSInstallationController presentInstallationAlertForFile:url.path completion:^(BOOL success, NSError* error){
|
||||
[TSInstallationController presentInstallationAlertIfEnabledForFile:url.path isRemoteInstall:NO completion:^(BOOL success, NSError* error){
|
||||
doneBlock(NO);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
#import "TSSettingsListController.h"
|
||||
#import <TSUtil.h>
|
||||
#import <Preferences/PSSpecifier.h>
|
||||
#import <Preferences/PSListItemsController.h>
|
||||
#import <TSPresentationDelegate.h>
|
||||
|
||||
@interface NSUserDefaults (Private)
|
||||
- (instancetype)_initWithSuiteName:(NSString *)suiteName container:(NSURL *)container;
|
||||
@end
|
||||
extern NSUserDefaults* trollStoreUserDefaults(void);
|
||||
|
||||
@implementation TSSettingsListController
|
||||
|
||||
- (void)viewDidLoad
|
||||
@@ -195,6 +201,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
PSSpecifier* installationSettingsGroupSpecifier = [PSSpecifier emptyGroupSpecifier];
|
||||
installationSettingsGroupSpecifier.name = @"Security";
|
||||
[installationSettingsGroupSpecifier setProperty:@"The URL Scheme, when enabled, will allow apps and websites to trigger TrollStore installations through the apple-magnifier://install?url=<IPA_URL> URL scheme." forKey:@"footerText"];
|
||||
|
||||
[_specifiers addObject:installationSettingsGroupSpecifier];
|
||||
|
||||
PSSpecifier* URLSchemeToggle = [PSSpecifier preferenceSpecifierNamed:@"URL Scheme Enabled"
|
||||
target:self
|
||||
set:@selector(setURLSchemeEnabled:forSpecifier:)
|
||||
get:@selector(getURLSchemeEnabledForSpecifier:)
|
||||
detail:nil
|
||||
cell:PSSwitchCell
|
||||
edit:nil];
|
||||
|
||||
[_specifiers addObject:URLSchemeToggle];
|
||||
|
||||
PSSpecifier* installAlertConfigurationSpecifier = [PSSpecifier preferenceSpecifierNamed:@"Show Install Confirmation Alert"
|
||||
target:self
|
||||
set:@selector(setPreferenceValue:specifier:)
|
||||
get:@selector(readPreferenceValue:)
|
||||
detail:nil
|
||||
cell:PSLinkListCell
|
||||
edit:nil];
|
||||
|
||||
installAlertConfigurationSpecifier.detailControllerClass = [PSListItemsController class];
|
||||
[installAlertConfigurationSpecifier setProperty:@"installationConfirmationValues" forKey:@"valuesDataSource"];
|
||||
[installAlertConfigurationSpecifier setProperty:@"installationConfirmationNames" forKey:@"titlesDataSource"];
|
||||
[installAlertConfigurationSpecifier setProperty:@"com.opa334.TrollStore" forKey:@"defaults"];
|
||||
[installAlertConfigurationSpecifier setProperty:@"installAlertConfiguration" forKey:@"key"];
|
||||
[installAlertConfigurationSpecifier setProperty:@0 forKey:@"default"];
|
||||
|
||||
[_specifiers addObject:installAlertConfigurationSpecifier];
|
||||
|
||||
|
||||
PSSpecifier* otherGroupSpecifier = [PSSpecifier emptyGroupSpecifier];
|
||||
[otherGroupSpecifier setProperty:[NSString stringWithFormat:@"TrollStore %@\n\n© 2022 Lars Fröder (opa334)\n\nCredits:\n@LinusHenze: CoreTrust bug\n@zhuowei: CoreTrust bug writeup and cert\n@lunotech11, @SerenaKit, @tylinux: Various contributions\n@ProcursusTeam: uicache and ldid build\n@cstar_ow: uicache\n@saurik: ldid", [self getTrollStoreVersion]] forKey:@"footerText"];
|
||||
[_specifiers addObject:otherGroupSpecifier];
|
||||
@@ -230,6 +270,16 @@
|
||||
return _specifiers;
|
||||
}
|
||||
|
||||
- (NSArray*)installationConfirmationValues
|
||||
{
|
||||
return @[@0, @1, @2];
|
||||
}
|
||||
|
||||
- (NSArray*)installationConfirmationNames
|
||||
{
|
||||
return @[@"Always (Recommended)", @"Only on Remote Installs", @"Never (Not Recommeded)"];
|
||||
}
|
||||
|
||||
- (void)respringButtonPressed
|
||||
{
|
||||
respring();
|
||||
@@ -313,9 +363,51 @@
|
||||
[TSPresentationDelegate presentViewController:selectAppAlert animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (id)getURLSchemeEnabledForSpecifier:(PSSpecifier*)specifier
|
||||
{
|
||||
BOOL URLSchemeActive = (BOOL)[NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"];
|
||||
return @(URLSchemeActive);
|
||||
}
|
||||
|
||||
- (void)setURLSchemeEnabled:(id)value forSpecifier:(PSSpecifier*)specifier
|
||||
{
|
||||
NSNumber* newValue = value;
|
||||
NSString* newStateString = [newValue boolValue] ? @"enable" : @"disable";
|
||||
spawnRoot(rootHelperPath(), @[@"url-scheme", newStateString], nil, nil);
|
||||
|
||||
UIAlertController* rebuildNoticeAlert = [UIAlertController alertControllerWithTitle:@"URL Scheme Changed" message:@"In order to properly apply the change of the URL scheme setting, rebuilding the icon cache is needed." preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction* rebuildNowAction = [UIAlertAction actionWithTitle:@"Rebuild Now" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action)
|
||||
{
|
||||
[self rebuildIconCachePressed];
|
||||
}];
|
||||
[rebuildNoticeAlert addAction:rebuildNowAction];
|
||||
|
||||
UIAlertAction* rebuildLaterAction = [UIAlertAction actionWithTitle:@"Rebuild Later" style:UIAlertActionStyleCancel handler:nil];
|
||||
[rebuildNoticeAlert addAction:rebuildLaterAction];
|
||||
|
||||
[TSPresentationDelegate presentViewController:rebuildNoticeAlert animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)doTheDashPressed
|
||||
{
|
||||
spawnRoot(rootHelperPath(), @[@"dash"], nil, nil);
|
||||
}
|
||||
|
||||
- (void)setPreferenceValue:(NSObject*)value specifier:(PSSpecifier*)specifier
|
||||
{
|
||||
NSUserDefaults* tsDefaults = trollStoreUserDefaults();
|
||||
[tsDefaults setObject:value forKey:[specifier propertyForKey:@"key"]];
|
||||
}
|
||||
|
||||
- (NSObject*)readPreferenceValue:(PSSpecifier*)specifier
|
||||
{
|
||||
NSUserDefaults* tsDefaults = trollStoreUserDefaults();
|
||||
NSObject* toReturn = [tsDefaults objectForKey:[specifier propertyForKey:@"key"]];
|
||||
if(!toReturn)
|
||||
{
|
||||
toReturn = [specifier propertyForKey:@"default"];
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@end
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Package: com.opa334.trollstore
|
||||
Name: TrollStore
|
||||
Version: 1.3.5
|
||||
Version: 1.4
|
||||
Architecture: iphoneos-arm
|
||||
Description: An awesome application!
|
||||
Maintainer: opa334
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
#import "TSAppDelegate.h"
|
||||
#import "TSUtil.h"
|
||||
|
||||
NSUserDefaults* trollStoreUserDefaults(void)
|
||||
{
|
||||
return [[NSUserDefaults alloc] initWithSuiteName:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Preferences/com.opa334.TrollStore.plist"]];
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
@autoreleasepool {
|
||||
chineseWifiFixup();
|
||||
|
||||
Reference in New Issue
Block a user