diff --git a/PyoncordTweak.plist b/BunnyTweak.plist similarity index 100% rename from PyoncordTweak.plist rename to BunnyTweak.plist diff --git a/Makefile b/Makefile index e5f4971..0b88da2 100644 --- a/Makefile +++ b/Makefile @@ -7,13 +7,13 @@ endif include $(THEOS)/makefiles/common.mk -TWEAK_NAME = PyoncordTweak +TWEAK_NAME = BunnyTweak -PyoncordTweak_FILES = $(shell find Sources/PyoncordTweak -name '*.swift') $(shell find Sources/PyoncordTweakC -name '*.m' -o -name '*.c' -o -name '*.mm' -o -name '*.cpp') -PyoncordTweak_SWIFTFLAGS = -ISources/PyoncordTweakC/include -PyoncordTweak_CFLAGS = -fobjc-arc -ISources/PyoncordTweakC/include +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 -PyoncordTweak_BUNDLE_NAME = PyoncordPatches -PyoncordTweak_BUNDLE_RESOURCE_DIRS = Resources +BunnyTweak_BUNDLE_NAME = BunnyPatches +BunnyTweak_BUNDLE_RESOURCE_DIRS = Resources include $(THEOS_MAKE_PATH)/tweak.mk diff --git a/Package.swift b/Package.swift index a76267f..1e010ca 100644 --- a/Package.swift +++ b/Package.swift @@ -65,23 +65,23 @@ let swiftFlags: [String] = libFlags + [ ] let package = Package( - name: "PyoncordTweak", + name: "BunnyTweak", platforms: [.iOS(deploymentTarget)], products: [ .library( - name: "PyoncordTweak", - targets: ["PyoncordTweak"] + name: "BunnyTweak", + targets: ["BunnyTweak"] ), ], targets: [ .target( - name: "PyoncordTweakC", + name: "BunnyTweakC", cSettings: [.unsafeFlags(cFlags)], cxxSettings: [.unsafeFlags(cxxFlags)] ), .target( - name: "PyoncordTweak", - dependencies: ["PyoncordTweakC"], + name: "BunnyTweak", + dependencies: ["BunnyTweakC"], swiftSettings: [.unsafeFlags(swiftFlags)] ), ] diff --git a/README.md b/README.md index 199ea77..5f894e4 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ Builds can be found in the [Releases](https://github.com/pyoncord/BunnyTweak/rel ### Jailbroken (Rootful/Rootless) 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 `.deb` file (or by building your own, see [Building BunnyTweak locally](#building-pyoncordtweak-locally)). Use the file ending in `arm.deb` for rootful jailbreaks, and the file ending in `arm64.deb` for rootless jailbreaks. +1. Install Bunny by downloading the appropriate `.deb` file (or by building your own, see [Building BunnyTweak locally](#building-bunnytweak-locally)). Use the file ending in `arm.deb` for rootful jailbreaks, and the file ending in `arm64.deb` for rootless jailbreaks. ### Non-Jailbroken -1. Download and install `Pyoncord.ipa` using your preferred sideloading method. +1. Download and install `Bunny.ipa` using your preferred sideloading method. ## Building BunnyTweak locally diff --git a/Resources/payload-base.js b/Resources/payload-base.js index 8de0727..d1fd4a0 100644 --- a/Resources/payload-base.js +++ b/Resources/payload-base.js @@ -1,7 +1,6 @@ globalThis.__PYON_LOADER__ = { loaderName: "BunnyTweak", - loaderVersion: "0.2.0", + loaderVersion: "0.3.0", hasThemeSupport: true, - storedTheme: null, - fontPatch: 2 + storedTheme: null } diff --git a/Sources/PyoncordTweak/Fonts.x.swift b/Sources/BunnyTweak/Fonts.x.swift similarity index 82% rename from Sources/PyoncordTweak/Fonts.x.swift rename to Sources/BunnyTweak/Fonts.x.swift index 468a73d..14f9b71 100644 --- a/Sources/PyoncordTweak/Fonts.x.swift +++ b/Sources/BunnyTweak/Fonts.x.swift @@ -1,4 +1,4 @@ -import PyoncordTweakC +import BunnyTweakC import Orion import UIKit import os @@ -35,7 +35,7 @@ class FontsHook: ClassHook { func patchFonts(_ main: [String: String], fontDefName: String) { for (fontName, url) in main { - os_log("Replacing font %{public}@ with URL: %{public}@", log: pyoncordLog, type: .info, fontName, url) + os_log("Replacing font %{public}@ with URL: %{public}@", log: bunnyLog, type: .info, fontName, url) let fontExtension = URL(string: url)!.pathExtension let fontCachePath = pyoncordDirectory @@ -45,26 +45,26 @@ func patchFonts(_ main: [String: String], fontDefName: String) { .appendingPathComponent("\(fontName).\(fontExtension)") do { - os_log("Attempting to register font %{public}@ from %{public}@", log: pyoncordLog, type: .info, fontName, url) + os_log("Attempting to register font %{public}@ from %{public}@", log: bunnyLog, type: .info, fontName, url) let parent = fontCachePath.deletingLastPathComponent() if !FileManager.default.fileExists(atPath: parent.path) { - os_log("Creating parent directory: %{public}@", log: pyoncordLog, type: .debug, parent.path) + os_log("Creating parent directory: %{public}@", log: bunnyLog, type: .debug, parent.path) try FileManager.default.createDirectory( at: parent, withIntermediateDirectories: true, attributes: nil) } // JS side should download these already, but just in case... if !FileManager.default.fileExists(atPath: fontCachePath.path) { - os_log("Downloading font %{public}@ from %{public}@", log: pyoncordLog, type: .debug, fontName, url) + os_log("Downloading font %{public}@ from %{public}@", log: bunnyLog, type: .debug, fontName, url) if let data = try? Data(contentsOf: URL(string: url)!) { - os_log("Writing font data to: %{public}@", log: pyoncordLog, type: .debug, fontCachePath.path) + os_log("Writing font data to: %{public}@", log: bunnyLog, type: .debug, fontCachePath.path) try? data.write(to: fontCachePath) } } if let data = try? Data(contentsOf: fontCachePath) { - os_log("Registering font %{public}@ with provider", log: pyoncordLog, type: .debug, fontName) + os_log("Registering font %{public}@ with provider", log: bunnyLog, type: .debug, fontName) let provider = CGDataProvider(data: data as CFData) let font = CGFont(provider!) var error: Unmanaged? @@ -73,7 +73,7 @@ func patchFonts(_ main: [String: String], fontDefName: String) { if let existingFont = CGFont(font!.postScriptName!) { var unregisterError: Unmanaged? if !CTFontManagerUnregisterGraphicsFont(existingFont, &unregisterError) { - os_log("Failed to deregister font %{public}@: %{public}@", log: pyoncordLog, type: .error, + os_log("Failed to deregister font %{public}@: %{public}@", log: bunnyLog, type: .error, font!.postScriptName! as String, String(describing: unregisterError!.takeUnretainedValue())) } @@ -81,15 +81,15 @@ func patchFonts(_ main: [String: String], fontDefName: String) { if CTFontManagerRegisterGraphicsFont(font!, &error) { fontMap[fontName] = font!.postScriptName! as String - os_log("Successfully registered font %{public}@ to %{public}@", log: pyoncordLog, type: .info, fontName, font!.postScriptName! as String) + os_log("Successfully registered font %{public}@ to %{public}@", log: bunnyLog, type: .info, fontName, font!.postScriptName! as String) } else { - os_log("Failed to register font %{public}@: %{public}@", log: pyoncordLog, type: .error, fontName, String(describing: error!.takeUnretainedValue())) + os_log("Failed to register font %{public}@: %{public}@", log: bunnyLog, type: .error, fontName, String(describing: error!.takeUnretainedValue())) } } else { - os_log("Failed to read font data from: %{public}@", log: pyoncordLog, type: .error, fontCachePath.path) + os_log("Failed to read font data from: %{public}@", log: bunnyLog, type: .error, fontCachePath.path) } } catch { - os_log("Failed to register font %{public}@: %{public}@", log: pyoncordLog, type: .error, fontName, error.localizedDescription) + os_log("Failed to register font %{public}@: %{public}@", log: bunnyLog, type: .error, fontName, error.localizedDescription) } } } \ No newline at end of file diff --git a/Sources/PyoncordTweak/LoaderConfig.x.swift b/Sources/BunnyTweak/LoaderConfig.x.swift similarity index 81% rename from Sources/PyoncordTweak/LoaderConfig.x.swift rename to Sources/BunnyTweak/LoaderConfig.x.swift index 96f2940..729e3ba 100644 --- a/Sources/PyoncordTweak/LoaderConfig.x.swift +++ b/Sources/BunnyTweak/LoaderConfig.x.swift @@ -25,7 +25,7 @@ let pyoncordDirectory = getPyoncordDirectory() let loaderConfigUrl = pyoncordDirectory.appendingPathComponent("loader.json") func getLoaderConfig() -> LoaderConfig { - os_log("Getting loader config", log: pyoncordLog, type: .debug) + os_log("Getting loader config", log: bunnyLog, type: .debug) let fileManager = FileManager.default do { @@ -33,14 +33,14 @@ func getLoaderConfig() -> LoaderConfig { let data = try Data(contentsOf: loaderConfigUrl) let loaderConfig = try JSONDecoder().decode(LoaderConfig.self, from: data) - os_log("Got loader config", log: pyoncordLog, type: .debug) + os_log("Got loader config", log: bunnyLog, type: .debug) return loaderConfig } else { throw LoaderConfigError.doesNotExist } } catch { - os_log("Couldn't get loader config", log: pyoncordLog, type: .error) + os_log("Couldn't get loader config", log: bunnyLog, type: .error) return defaultLoaderConfig } diff --git a/Sources/PyoncordTweak/Themes.x.swift b/Sources/BunnyTweak/Themes.x.swift similarity index 81% rename from Sources/PyoncordTweak/Themes.x.swift rename to Sources/BunnyTweak/Themes.x.swift index fe8d377..3eb8277 100644 --- a/Sources/PyoncordTweak/Themes.x.swift +++ b/Sources/BunnyTweak/Themes.x.swift @@ -1,6 +1,6 @@ import Orion import UIKit -import PyoncordTweakC +import BunnyTweakC import os struct Author: Codable { @@ -56,7 +56,7 @@ func hexToUIColor(_ hex: String) -> UIColor? { } func swizzleDCDThemeColor(_ semanticColors: [String: [String]]) { - os_log("Swizzling DCDThemeColor", log: pyoncordLog, type: .info) + os_log("Swizzling DCDThemeColor", log: bunnyLog, type: .info) let DCDTheme: AnyClass = NSClassFromString("DCDTheme")! let dcdThemeTarget: AnyClass = object_getClass(DCDTheme)! @@ -68,25 +68,25 @@ func swizzleDCDThemeColor(_ semanticColors: [String: [String]]) { let themeIndex: ThemeIndexType = unsafeBitCast(themeIndexImpl, to: ThemeIndexType.self) let DCDThemeColor: AnyClass = NSClassFromString("DCDThemeColor")! - os_log("Found instance of DCDThemeColor", log: pyoncordLog, type: .debug) + os_log("Found instance of DCDThemeColor", log: bunnyLog, type: .debug) let target: AnyClass = object_getClass(DCDThemeColor)! - os_log("Found DCDThemeColor", log: pyoncordLog, type: .debug) + os_log("Found DCDThemeColor", log: bunnyLog, type: .debug) var methodCount: UInt32 = 0 let methods = class_copyMethodList(target, &methodCount)! - os_log("DCDThemeColor has %{public}d methods", log: pyoncordLog, type: .debug, methodCount) + os_log("DCDThemeColor has %{public}d methods", log: bunnyLog, type: .debug, methodCount) for i in 0.. UIColor @@ -115,28 +115,28 @@ func swizzleDCDThemeColor(_ semanticColors: [String: [String]]) { } func swizzleUIColor(_ rawColors: [String: String]) { - os_log("Swizzling UIColor", log: pyoncordLog, type: .info) + os_log("Swizzling UIColor", log: bunnyLog, type: .info) let UIColor: AnyClass = NSClassFromString("UIColor")! - os_log("Found instance of UIColor", log: pyoncordLog, type: .debug) + os_log("Found instance of UIColor", log: bunnyLog, type: .debug) let target: AnyClass = object_getClass(UIColor)! - os_log("Found UIColor", log: pyoncordLog, type: .debug) + os_log("Found UIColor", log: bunnyLog, type: .debug) var methodCount: UInt32 = 0 let methods = class_copyMethodList(target, &methodCount)! - os_log("UIColor has %{public}d methods", log: pyoncordLog, type: .debug, methodCount) + os_log("UIColor has %{public}d methods", log: bunnyLog, type: .debug, methodCount) for i in 0.. UIColor = { (self: AnyObject) -> UIColor in return hexToUIColor(rawColor)! diff --git a/Sources/PyoncordTweak/Tweak.x.swift b/Sources/BunnyTweak/Tweak.x.swift similarity index 75% rename from Sources/PyoncordTweak/Tweak.x.swift rename to Sources/BunnyTweak/Tweak.x.swift index c349bb8..cde4f6b 100644 --- a/Sources/PyoncordTweak/Tweak.x.swift +++ b/Sources/BunnyTweak/Tweak.x.swift @@ -1,18 +1,18 @@ import Orion -import PyoncordTweakC +import BunnyTweakC import os -let pyoncordLog = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "pyoncord") +let bunnyLog = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "bunny") let source = URL(string: "bunny")! let install_prefix = String(cString: get_install_prefix()) -let isJailbroken = FileManager.default.fileExists(atPath: "\(install_prefix)/Library/Application Support/PyoncordTweak/PyoncordPatches.bundle") +let isJailbroken = FileManager.default.fileExists(atPath: "\(install_prefix)/Library/Application Support/BunnyTweak/BunnyPatches.bundle") -let pyoncordPatchesBundlePath = isJailbroken ? "\(install_prefix)/Library/Application Support/PyoncordTweak/PyoncordPatches.bundle" : "\(Bundle.main.bundleURL.path)/PyoncordPatches.bundle" +let bunnyPatchesBundlePath = isJailbroken ? "\(install_prefix)/Library/Application Support/BunnyTweak/BunnyPatches.bundle" : "\(Bundle.main.bundleURL.path)/BunnyPatches.bundle" class FileManagerLoadHook: ClassHook { func containerURLForSecurityApplicationGroupIdentifier(_ groupIdentifier: NSString?) -> URL? { - os_log("containerURLForSecurityApplicationGroupIdentifier called! %{public}@ groupIdentifier", log: pyoncordLog, type: .debug, groupIdentifier ?? "nil") + os_log("containerURLForSecurityApplicationGroupIdentifier called! %{public}@ groupIdentifier", log: bunnyLog, type: .debug, groupIdentifier ?? "nil") if (isJailbroken) { return orig.containerURLForSecurityApplicationGroupIdentifier(groupIdentifier) @@ -26,15 +26,15 @@ class FileManagerLoadHook: ClassHook { class LoadHook: ClassHook { func executeApplicationScript(_ script: Data, url: URL, async: Bool) { - os_log("executeApplicationScript called!", log: pyoncordLog, type: .debug) + os_log("executeApplicationScript called!", log: bunnyLog, type: .debug) let loaderConfig = getLoaderConfig() - let pyoncordPatchesBundle = Bundle(path: pyoncordPatchesBundlePath)! + let bunnyPatchesBundle = Bundle(path: bunnyPatchesBundlePath)! - if let patchPath = pyoncordPatchesBundle.url(forResource: "payload-base", withExtension: "js") { + if let patchPath = bunnyPatchesBundle.url(forResource: "payload-base", withExtension: "js") { let patchData = try! Data(contentsOf: patchPath) - os_log("Executing payload base", log: pyoncordLog, type: .debug) + os_log("Executing payload base", log: bunnyLog, type: .debug) orig.executeApplicationScript(patchData, url: source, async: true) } @@ -48,7 +48,7 @@ class LoadHook: ClassHook { var bundleUrl: URL if loaderConfig.customLoadUrl.enabled { os_log( - "Custom load URL enabled, with URL %{public}@ ", log: pyoncordLog, type: .info, + "Custom load URL enabled, with URL %{public}@ ", log: bunnyLog, type: .info, loaderConfig.customLoadUrl.url.absoluteString) bundleUrl = loaderConfig.customLoadUrl.url } else { @@ -56,7 +56,7 @@ class LoadHook: ClassHook { string: "https://raw.githubusercontent.com/pyoncord/bunny-builds/main/bunny.js")! } - os_log("Fetching JS bundle", log: pyoncordLog, type: .info) + os_log("Fetching JS bundle", log: bunnyLog, type: .info) var bundleRequest = URLRequest( url: bundleUrl, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 3.0) @@ -68,7 +68,7 @@ class LoadHook: ClassHook { let fetchTask = URLSession.shared.dataTask(with: bundleRequest) { data, response, error in if let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 { - os_log("Successfully fetched JS Bundle", log: pyoncordLog, type: .debug) + os_log("Successfully fetched JS Bundle", log: bunnyLog, type: .debug) bundle = data try? bundle?.write(to: pyoncordDirectory.appendingPathComponent("bundle.js")) @@ -101,7 +101,7 @@ class LoadHook: ClassHook { for fileURL in contents { if fileURL.pathExtension == "js" { os_log( - "Executing preload JS file %{public}@ ", log: pyoncordLog, type: .info, fileURL.absoluteString) + "Executing preload JS file %{public}@ ", log: bunnyLog, type: .info, fileURL.absoluteString) if let data = try? Data(contentsOf: fileURL) { orig.executeApplicationScript(data, url: source, async: async) @@ -109,23 +109,23 @@ class LoadHook: ClassHook { } } } catch { - os_log("Error reading contents of preloads directory", log: pyoncordLog, type: .error) + os_log("Error reading contents of preloads directory", log: bunnyLog, type: .error) } } if bundle != nil { - os_log("Executing JS bundle", log: pyoncordLog, type: .info) + os_log("Executing JS bundle", log: bunnyLog, type: .info) orig.executeApplicationScript(bundle!, url: source, async: async) } else { - os_log("Unable to fetch JS bundle", log: pyoncordLog, type: .error) + os_log("Unable to fetch JS bundle", log: bunnyLog, type: .error) } - os_log("Executing original script", log: pyoncordLog, type: .info) + os_log("Executing original script", log: bunnyLog, type: .info) orig.executeApplicationScript(script, url: url, async: async) } } -struct PyoncordTweak: Tweak { +struct BunnyTweak: Tweak { func tweakDidActivate() { if let themeData = try? Data( contentsOf: pyoncordDirectory.appendingPathComponent("current-theme.json")) { diff --git a/Sources/PyoncordTweak/Utils.x.swift b/Sources/BunnyTweak/Utils.x.swift similarity index 100% rename from Sources/PyoncordTweak/Utils.x.swift rename to Sources/BunnyTweak/Utils.x.swift diff --git a/Sources/PyoncordTweakC/Tweak.m b/Sources/BunnyTweakC/Tweak.m similarity index 100% rename from Sources/PyoncordTweakC/Tweak.m rename to Sources/BunnyTweakC/Tweak.m diff --git a/Sources/PyoncordTweakC/include/RCTCxxBridge.h b/Sources/BunnyTweakC/include/RCTCxxBridge.h similarity index 100% rename from Sources/PyoncordTweakC/include/RCTCxxBridge.h rename to Sources/BunnyTweakC/include/RCTCxxBridge.h diff --git a/Sources/PyoncordTweakC/include/Tweak.h b/Sources/BunnyTweakC/include/Tweak.h similarity index 100% rename from Sources/PyoncordTweakC/include/Tweak.h rename to Sources/BunnyTweakC/include/Tweak.h diff --git a/Sources/PyoncordTweakC/include/module.modulemap b/Sources/BunnyTweakC/include/module.modulemap similarity index 57% rename from Sources/PyoncordTweakC/include/module.modulemap rename to Sources/BunnyTweakC/include/module.modulemap index d6117b6..2e175d3 100644 --- a/Sources/PyoncordTweakC/include/module.modulemap +++ b/Sources/BunnyTweakC/include/module.modulemap @@ -1,4 +1,4 @@ -module PyoncordTweakC { +module BunnyTweakC { umbrella "." export * } diff --git a/control b/control index 0cbb126..5fe9316 100644 --- a/control +++ b/control @@ -1,11 +1,11 @@ Package: io.github.pyoncord.app Name: Bunny -Version: 0.2.0 +Version: 0.3.0 Architecture: iphoneos-arm Description: A mod for Discord's mobile apps. Maintainer: Pylix -Author: FieryFlames -Icon: https://avatars.githubusercontent.com/u/112445065 +Author: Pylix, FieryFlames +Icon: https://avatars.githubusercontent.com/u/132727175 Section: Tweaks Depends: ${ORION}, firmware (>= 13.0) Conflicts: app.enmity, mod.vendetta