diff --git a/Resources/identity.js b/Resources/identity.js index 1fe91ca..313cff1 100644 --- a/Resources/identity.js +++ b/Resources/identity.js @@ -1 +1 @@ -this.__vendetta_loader={name:"VendettaTweak",features:{loaderConfig:false,devtools:{prop:"__vendetta_rdc",version:"4.27.1"}}}; \ No newline at end of file +this.__vendetta_loader={name:"VendettaTweak",features:{loaderConfig:true,devtools:{prop:"__vendetta_rdc",version:"4.27.1"}}}; \ No newline at end of file diff --git a/Sources/VendettaTweak/Tweak.x.swift b/Sources/VendettaTweak/Tweak.x.swift index 78e28ce..f19eb60 100644 --- a/Sources/VendettaTweak/Tweak.x.swift +++ b/Sources/VendettaTweak/Tweak.x.swift @@ -15,10 +15,17 @@ class LoadHook: ClassHook { func executeApplicationScript(_ script: Data, url: URL, async: Bool) { os_log("executeApplicationScript called!", log: vendettaLog, type: .debug) + let loaderConfig = getLoaderConfig() + let vendettaPatchesBundle = Bundle(path: vendettaPatchesBundlePath)! + var patches = ["modules", "identity"] + if loaderConfig.loadReactDevTools { + os_log("DevTools patch enabled", log: vendettaLog, type: .info) + patches.append("devtools") + } os_log("Executing patches", log: vendettaLog, type: .info) - for patch in ["modules", "devtools", "identity"] { + for patch in patches { 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) @@ -33,9 +40,18 @@ class LoadHook: ClassHook { let group = DispatchGroup() group.enter() + var vendettaUrl: URL + if loaderConfig.customLoadUrl.enabled { + os_log( + "Custom load URL enabled, with URL %{public}@ ", log: vendettaLog, type: .info, + loaderConfig.customLoadUrl.url.absoluteString) + vendettaUrl = loaderConfig.customLoadUrl.url + } else { + vendettaUrl = URL( + string: "https://raw.githubusercontent.com/vendetta-mod/builds/master/vendetta.js")! + } + os_log("Fetching vendetta.js", log: vendettaLog, type: .info) - let vendettaUrl = URL( - string: "https://raw.githubusercontent.com/vendetta-mod/builds/master/vendetta.js")! var vendettaRequest = URLRequest( url: vendettaUrl, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 3.0)