Skip to content

Commit 3b1ab17

Browse files
committed
Initial commit
0 parents  commit 3b1ab17

15 files changed

Lines changed: 215 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.theos/
2+
packages/
3+
.DS_Store

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
TARGET := iphone:clang:16.5:15.0
2+
INSTALL_TARGET_PROCESSES = SpringBoard
3+
ARCHS = arm64
4+
THEOS_PACKAGE_SCHEME = rootless
5+
6+
THEOS_DEVICE_IP = 127.0.0.1
7+
THEOS_DEVICE_PORT = 2222
8+
9+
include $(THEOS)/makefiles/common.mk
10+
11+
TWEAK_NAME = appstoretroller
12+
13+
appstoretroller_FILES = Tweak.xm
14+
appstoretroller_CFLAGS = -fobjc-arc -Wno-deprecated-declarations
15+
16+
include $(THEOS_MAKE_PATH)/tweak.mk
17+
SUBPROJECTS += appstoretrollerPrefs
18+
include $(THEOS_MAKE_PATH)/aggregate.mk

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# AppStore Troller
2+
3+
Very simple tweak to let you purchase an app to your Apple ID that requires a newer iOS version than the one you're running on your device. Afterwards, you can install the last compatible version onto your device, if it exists.

Tweak.xm

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#import <Foundation/Foundation.h>
2+
#import <UIKit/UIKit.h>
3+
4+
NSUserDefaults *prefs;
5+
6+
%group appstoredHooks
7+
8+
%hook NSMutableURLRequest
9+
10+
- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field
11+
{
12+
if ([[self.URL absoluteString] containsString:@"WebObjects/MZBuy.woa/wa/buyProduct"]) {
13+
if ([field isEqualToString:@"User-Agent"]) {
14+
value = [value stringByReplacingOccurrencesOfString:@"iOS/.*? " withString:@"iOS/99.0.0 " options:NSRegularExpressionSearch range:NSMakeRange(0, [value length])];
15+
}
16+
}
17+
%orig(value, field);
18+
}
19+
20+
%end
21+
22+
%end
23+
24+
%ctor {
25+
prefs = [[NSUserDefaults alloc] initWithSuiteName:@"dev.mineek.appstoretroller"];
26+
if (![prefs boolForKey:@"enabled"]) {
27+
return;
28+
}
29+
%init(appstoredHooks);
30+
}

appstoretroller.plist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>Filter</key>
6+
<dict>
7+
<key>Executables</key>
8+
<array>
9+
<string>appstored</string>
10+
</array>
11+
</dict>
12+
</dict>
13+
</plist>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#import <Preferences/PSListController.h>
2+
3+
@interface ATPRootListController : PSListController
4+
5+
@end
6+
7+
@interface NSTask : NSObject
8+
@property (copy) NSArray *arguments;
9+
@property (copy) NSString *launchPath;
10+
- (id)init;
11+
- (void)waitUntilExit;
12+
- (void)launch;
13+
@end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#import <Foundation/Foundation.h>
2+
#import "ATPRootListController.h"
3+
4+
@implementation ATPRootListController
5+
6+
- (NSArray *)specifiers {
7+
if (!_specifiers) {
8+
_specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self];
9+
}
10+
11+
return _specifiers;
12+
}
13+
14+
- (void)viewDidLoad {
15+
[super viewDidLoad];
16+
17+
UIBarButtonItem *respringButton = [[UIBarButtonItem alloc] initWithTitle:@"Respring" style:UIBarButtonItemStylePlain target:self action:@selector(respring)];
18+
self.navigationItem.rightBarButtonItem = respringButton;
19+
}
20+
21+
- (void)respring {
22+
NSTask *t = [[NSTask alloc] init];
23+
[t setLaunchPath:@THEOS_PACKAGE_INSTALL_PREFIX "/usr/bin/killall"];
24+
[t setArguments:[NSArray arrayWithObjects:@"-9", @"appstored", nil]];
25+
[t launch];
26+
27+
t = [[NSTask alloc] init];
28+
[t setLaunchPath:@THEOS_PACKAGE_INSTALL_PREFIX "/usr/bin/killall"];
29+
[t setArguments:[NSArray arrayWithObjects:@"SpringBoard", nil]];
30+
[t launch];
31+
32+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
33+
exit(0);
34+
});
35+
}
36+
37+
@end

appstoretrollerPrefs/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
TARGET := iphone:clang:16.5:15.0
2+
ARCHS = arm64
3+
THEOS_PACKAGE_SCHEME = rootless
4+
5+
include $(THEOS)/makefiles/common.mk
6+
7+
BUNDLE_NAME = appstoretrollerPrefs
8+
9+
appstoretrollerPrefs_FILES = ATPRootListController.m
10+
appstoretrollerPrefs_FRAMEWORKS = UIKit
11+
appstoretrollerPrefs_PRIVATE_FRAMEWORKS = Preferences
12+
appstoretrollerPrefs_INSTALL_PATH = /Library/PreferenceBundles
13+
appstoretrollerPrefs_CFLAGS = -fobjc-arc
14+
15+
include $(THEOS_MAKE_PATH)/bundle.mk
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleExecutable</key>
8+
<string>appstoretrollerPrefs</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>dev.mineek.appstoretrollerprefs</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundlePackageType</key>
14+
<string>BNDL</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>1.0.0</string>
17+
<key>CFBundleSignature</key>
18+
<string>????</string>
19+
<key>CFBundleVersion</key>
20+
<string>1.0</string>
21+
<key>NSPrincipalClass</key>
22+
<string>ATPRootListController</string>
23+
</dict>
24+
</plist>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>items</key>
6+
<array>
7+
<dict>
8+
<key>cell</key>
9+
<string>PSGroupCell</string>
10+
<key>footerText</key>
11+
<string>Enable the tweak, purchase an app, disable the tweak and then you can download the app.</string>
12+
<key>headerText</key>
13+
<string>AppStore Troller</string>
14+
</dict>
15+
<dict>
16+
<key>cell</key>
17+
<string>PSSwitchCell</string>
18+
<key>defaults</key>
19+
<string>dev.mineek.appstoretroller</string>
20+
<key>key</key>
21+
<string>enabled</string>
22+
<key>label</key>
23+
<string>Enabled</string>
24+
</dict>
25+
</array>
26+
<key>title</key>
27+
<string>AppStore Troller</string>
28+
</dict>
29+
</plist>

0 commit comments

Comments
 (0)