[Main] Execute patches
This commit is contained in:
parent
72bcdd5128
commit
e08178a916
3 changed files with 25 additions and 1 deletions
3
Makefile
3
Makefile
|
|
@ -9,4 +9,7 @@ VendettaTweak_FILES = $(shell find Sources/VendettaTweak -name '*.swift') $(shel
|
|||
VendettaTweak_SWIFTFLAGS = -ISources/VendettaTweakC/include
|
||||
VendettaTweak_CFLAGS = -fobjc-arc -ISources/VendettaTweakC/include
|
||||
|
||||
VendettaTweak_BUNDLE_NAME = VendettaPatches
|
||||
VendettaTweak_BUNDLE_RESOURCE_DIRS = VendettaXposed/App/src/main/assets/js Resources
|
||||
|
||||
include $(THEOS_MAKE_PATH)/tweak.mk
|
||||
|
|
|
|||
1
Resources/identity.js
Normal file
1
Resources/identity.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
this.__vendetta_loader={name:"VendettaTweak",features:{loaderConfig:false,devtools:{prop:"__vendetta_rdc",version:"4.27.1"}}};
|
||||
|
|
@ -3,10 +3,30 @@ import VendettaTweakC
|
|||
import os
|
||||
|
||||
let vendettaLog = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "vendetta")
|
||||
let source = URL(string: "vendetta")!
|
||||
|
||||
let vendettaPatchesBundlePath =
|
||||
FileManager.default.fileExists(
|
||||
atPath: "/Library/Application Support/VendettaTweak/VendettaPatches.bundle")
|
||||
? "/Library/Application Support/VendettaTweak/VendettaPatches.bundle"
|
||||
: "\(Bundle.main.bundleURL.path)/VendettaPatches.bundle"
|
||||
|
||||
class LoadHook: ClassHook<RCTCxxBridge> {
|
||||
func executeApplicationScript(_ script: Data, url: URL, async: Bool) {
|
||||
os_log("executeApplicationScript called!", log: vendettaLog, type: .debug)
|
||||
orig.executeApplicationScript(script, url: url, async: async)
|
||||
|
||||
let vendettaPatchesBundle = Bundle(path: vendettaPatchesBundlePath)!
|
||||
|
||||
os_log("Executing patches", log: vendettaLog, type: .info)
|
||||
for patch in ["modules", "devtools", "identity"] {
|
||||
if let patchPath = vendettaPatchesBundle.url(forResource: patch, withExtension: "js") {
|
||||
let patchData = try! Data(contentsOf: patchPath)
|
||||
os_log("Executing %{public}@ patch", log: vendettaLog, type: .debug, patch)
|
||||
orig.executeApplicationScript(patchData, url: source, async: false)
|
||||
}
|
||||
}
|
||||
|
||||
os_log("Executing original script", log: vendettaLog, type: .info)
|
||||
orig.executeApplicationScript(script, url: url, async: false)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue