Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rewrite to objc and logos #20

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
"MD029": false,
"MD033": false,
"MD045": false,
}
},
"VsCodeTaskButtons.tasks": [
{
"label": "$(tools) Make and Copy",
"task": "Make and Copy Tweak",
"tooltip": "Make and copy Tweak"
}
],
}
35 changes: 35 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Make and Copy Tweak",
"command": "zsh",
"args": [
"-c",
"rm -rf packages && make clean && make package FINALPACKAGE=1 THEOS_PACKAGE_SCHEME=rootless && cp ./packages/app.pyoncord_*arm64.deb ~/Library/Mobile\\ Documents/com~apple~CloudDocs/"
],
"problemMatcher": {
"owner": "cpp",
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"close": true
}
}
]
}
File renamed without changes.
5 changes: 5 additions & 0 deletions Headers/Fonts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

extern NSMutableDictionary<NSString *, NSString *> *fontMap;
void patchFonts(NSDictionary<NSString *, NSString *> *mainFonts, NSString *fontDefName);
8 changes: 8 additions & 0 deletions Headers/LoaderConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#import <Foundation/Foundation.h>

@interface LoaderConfig : NSObject
@property (nonatomic, assign) BOOL customLoadUrlEnabled;
@property (nonatomic, strong) NSURL *customLoadUrl;
+ (instancetype)defaultConfig;
+ (instancetype)getLoaderConfig;
@end
4 changes: 4 additions & 0 deletions Headers/Logger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import <Foundation/Foundation.h>

#define LOG_PREFIX @"[Bunny]"
#define BunnyLog(fmt, ...) NSLog((LOG_PREFIX @" " fmt), ##__VA_ARGS__)
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@import Foundation;

@interface RCTCxxBridge : NSObject

- (void)executeApplicationScript:(NSData *)script url:(NSURL *)url async:(BOOL)async;

@end
@end
5 changes: 5 additions & 0 deletions Headers/Theme.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

void swizzleDCDThemeColor(NSDictionary<NSString *, NSArray<NSString *> *> *semanticColors);
void swizzleUIColor(NSDictionary<NSString *, NSString *> *rawColors);
6 changes: 6 additions & 0 deletions Headers/Utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NSURL *getPyoncordDirectory(void);
UIColor *hexToUIColor(NSString *hex);
void showErrorAlert(NSString *title, NSString *message);
35 changes: 23 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
ifeq ($(THEOS_PACKAGE_SCHEME),rootless)
TARGET := iphone:clang:latest:15.0
else
TARGET := iphone:clang:latest:12.2
endif

TARGET := iphone:clang:latest:14.0
ARCHS = arm64
INSTALL_TARGET_PROCESSES = Discord

include $(THEOS)/makefiles/common.mk

TWEAK_NAME = BunnyTweak
TWEAK_NAME = Bunny
BUNDLE_NAME = BunnyResources

BunnyTweak_FILES = $(shell find Sources/BunnyTweak -name '*.swift') $(shell find Sources/BunnyTweakC -name '*.m' -o -name '*.c' -o -name '*.mm' -o -name '*.cpp')
BunnyTweak_SWIFTFLAGS = -ISources/BunnyTweakC/include
BunnyTweak_CFLAGS = -fobjc-arc -ISources/BunnyTweakC/include
Bunny_FILES = $(wildcard Sources/*.x Sources/*.m Sources/**/*.x Sources/**/*.m)
Bunny_CFLAGS = -fobjc-arc -DPACKAGE_VERSION='@"$(THEOS_PACKAGE_BASE_VERSION)"' -I$(THEOS_PROJECT_DIR)/Headers
Bunny_FRAMEWORKS = Foundation UIKit CoreGraphics CoreText CoreFoundation

BunnyTweak_BUNDLE_NAME = BunnyPatches
BunnyTweak_BUNDLE_RESOURCE_DIRS = Resources
BunnyResources_INSTALL_PATH = "/Library/Application\ Support/"
BunnyResources_RESOURCE_DIRS = Resources

include $(THEOS_MAKE_PATH)/tweak.mk
include $(THEOS_MAKE_PATH)/bundle.mk

before-all::
$(ECHO_NOTHING)mkdir -p Resources$(ECHO_END)
$(ECHO_NOTHING)sed -e 's/@PACKAGE_VERSION@/$(THEOS_PACKAGE_BASE_VERSION)/g' \
-e 's/@TWEAK_NAME@/$(TWEAK_NAME)/g' \
Sources/payload-base.template.js > Resources/payload-base.js$(ECHO_END)

after-stage::
$(ECHO_NOTHING)find $(THEOS_STAGING_DIR) -name ".DS_Store" -delete$(ECHO_END)

after-package::
$(ECHO_NOTHING)rm -rf Resources$(ECHO_END)
88 changes: 0 additions & 88 deletions Package.swift

This file was deleted.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
Tweak to inject [Bunny](https://github.com/pyoncord/Bunny) into Discord. Forked [VendettaTweak](https://github.com/vendetta-mod/VendettaTweak), modified to match with [BunnyXposed](https://github.com/pyoncord/BunnyXposed) behavior. There are still slight differences between these two, and this tweak may be missing some loader features.

> [!NOTE]
> As of right now this tweak does not encompass some functionalities when running in a jailed environment with a wildcard certificate \
> As of right now this tweak does not encompass some functionalities when running in a jailed environment with a distribution certificate that has a different App ID \
> If you value these features sign the application with a local dev certificate:
> - setAlternateAppIcon does not work, thus breaking dynamic app icons
> - sharing files to the application/selecting items via the Files app does not work
>
> - setAlternateAppIcon does not work, thus breaking dynamic app icons (unlikely to be able to be fixed unless iOS behavior changes)
> - sharing files to the application/selecting items via the Files app does not work (this might be more of a keychain/app group issue)

## Installation

Builds can be found in the [Releases](https://github.com/pyoncord/BunnyTweak/releases/latest) tab.

> [!NOTE]
> Raw decrypted IPAs which are used to provide prepatched IPAs are sourced from the [Enmity](https://github.com/enmity-mod/) community. These raw decrypted IPAs are also used throughout Enmity related projects such as [enmity-mod/tweak](https://github.com/enmity-mod/tweak/) and [acquitelol/rosiecord](https://github.com/acquitelol/rosiecord).\
> All credits are attributed to the owner(s) of the raw IPAs.
> Decrypted IPAs are sourced from the [Enmity](https://github.com/enmity-mod/) community. These are also used throughout Enmity related projects such as [enmity-mod/tweak](https://github.com/enmity-mod/tweak/) and [acquitelol/rosiecord](https://github.com/acquitelol/rosiecord).\
> All credits are attributed to the owner(s).

### Jailbroken

1. Install the Orion runtime via your preferred package manager, by adding `https://repo.chariz.com/` to your sources, then finding `Orion Runtime`.
1. Install Bunny by downloading the appropriate Debian package (or by building your own, see [Building BunnyTweak locally](#building-bunnytweak-locally)) and adding it to your package manager. Use the file ending in `arm.deb` for rootful jailbreaks, and the file ending in `arm64.deb` for rootless jailbreaks.

### Jailed
Expand All @@ -34,7 +34,7 @@ Builds can be found in the [Releases](https://github.com/pyoncord/BunnyTweak/rel
## Building BunnyTweak locally

> [!NOTE]
> These steps assume you use MacOS.
> These steps assume you use macOS.

1. Install Xcode from the App Store. If you've previously installed the `Command Line Utilities` package, you will need to run `sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer` to make sure you're using the Xcode tools instead.

Expand Down
99 changes: 0 additions & 99 deletions Sources/BunnyTweak/Fonts.x.swift

This file was deleted.

Loading