From bd2a939a72e0106b14bd67f46bec646b53a0a0d4 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 7 Jul 2025 09:40:28 +0200 Subject: [PATCH] fix: Correctly name `Enable ROM signature spoofing` patch --- patches/api/patches.api | 4 +- .../spotify/misc/fix/SpoofClientPatch.kt | 90 ------------------- .../kotlin/app/revanced/util/ResourceUtils.kt | 2 +- 3 files changed, 3 insertions(+), 93 deletions(-) diff --git a/patches/api/patches.api b/patches/api/patches.api index aa2e2ece2..98b690329 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -116,8 +116,8 @@ public final class app/revanced/patches/all/misc/shortcut/sharetargets/RemoveSha public static final fun getRemoveShareTargetsPatch ()Lapp/revanced/patcher/patch/ResourcePatch; } -public final class app/revanced/patches/all/misc/spoof/SignatureSpoofPatchKt { - public static final fun getSignatureSpoofPatch ()Lapp/revanced/patcher/patch/ResourcePatch; +public final class app/revanced/patches/all/misc/spoof/EnableRomSignatureSpoofingKt { + public static final fun getEnableRomSignatureSpoofing ()Lapp/revanced/patcher/patch/ResourcePatch; } public final class app/revanced/patches/all/misc/targetSdk/SetTargetSdkVersion34Kt { diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofClientPatch.kt index c35dc1346..f40127734 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofClientPatch.kt @@ -37,20 +37,6 @@ val spoofClientPatch = bytecodePatch( dependsOn( sharedExtensionPatch, - hexPatch(ignoreMissingTargetFiles = true, block = fun HexPatchBuilder.() { - listOf( - "arm64-v8a", - "armeabi-v7a", - "x86", - "x86_64" - ).forEach { architecture -> - "https://login5.spotify.com/v3/login" to "http://127.0.0.1:$requestListenerPort/v3/login" inFile - "lib/$architecture/liborbit-jni-spotify.so" - - "https://login5.spotify.com/v4/login" to "http://127.0.0.1:$requestListenerPort/v4/login" inFile - "lib/$architecture/liborbit-jni-spotify.so" - } - }) ) compatibleWith("com.spotify.music") @@ -103,82 +89,6 @@ val spoofClientPatch = bytecodePatch( // region Spoof client. - loadOrbitLibraryFingerprint.method.addInstructions( - 0, - """ - const/16 v0, $requestListenerPort - invoke-static { v0 }, $EXTENSION_CLASS_DESCRIPTOR->launchListener(I)V - """ - ) - - startupPageLayoutInflateFingerprint.method.apply { - val openLoginWebViewDescriptor = - "$EXTENSION_CLASS_DESCRIPTOR->launchLogin(Landroid/view/LayoutInflater;)V" - - addInstructions( - 0, - "invoke-static/range { p1 .. p1 }, $openLoginWebViewDescriptor" - ) - } - - renderStartLoginScreenFingerprint.method.apply { - val onEventIndex = indexOfFirstInstructionOrThrow { - opcode == Opcode.INVOKE_INTERFACE && getReference()?.name == "getView" - } - - val buttonRegister = getInstruction(onEventIndex + 1).registerA - - addInstruction( - onEventIndex + 2, - "invoke-static { v$buttonRegister }, $EXTENSION_CLASS_DESCRIPTOR->setNativeLoginHandler(Landroid/view/View;)V" - ) - } - - renderSecondLoginScreenFingerprint.method.apply { - val getViewIndex = indexOfFirstInstructionOrThrow { - opcode == Opcode.INVOKE_INTERFACE && getReference()?.name == "getView" - } - - val buttonRegister = getInstruction(getViewIndex + 1).registerA - - // Early return the render for loop since the first item of the loop is the login button. - addInstructions( - getViewIndex + 2, - """ - invoke-virtual { v$buttonRegister }, Landroid/view/View;->performClick()Z - return-void - """ - ) - } - - renderThirdLoginScreenFingerprint.method.apply { - val invokeSetListenerIndex = indexOfFirstInstructionOrThrow { - val reference = getReference() - reference?.definingClass == "Landroid/view/View;" && reference.name == "setOnClickListener" - } - - val buttonRegister = getInstruction(invokeSetListenerIndex).registerC - - addInstruction( - invokeSetListenerIndex + 1, - "invoke-virtual { v$buttonRegister }, Landroid/view/View;->performClick()Z" - ) - } - - thirdLoginScreenLoginOnClickFingerprint.method.apply { - // Use placeholder credentials to pass the login screen. - val loginActionIndex = indexOfFirstInstructionOrThrow(Opcode.RETURN_VOID) - 1 - val loginActionInstruction = getInstruction(loginActionIndex) - - addInstructions( - loginActionIndex, - """ - const-string v${loginActionInstruction.registerD}, "placeholder" - const-string v${loginActionInstruction.registerE}, "placeholder" - """ - ) - } - // endregion // region Disable verdicts. diff --git a/patches/src/main/kotlin/app/revanced/util/ResourceUtils.kt b/patches/src/main/kotlin/app/revanced/util/ResourceUtils.kt index 51135beba..9eb4115e5 100644 --- a/patches/src/main/kotlin/app/revanced/util/ResourceUtils.kt +++ b/patches/src/main/kotlin/app/revanced/util/ResourceUtils.kt @@ -144,7 +144,7 @@ internal fun Node.addResource( appendChild(resource.serialize(ownerDocument, resourceCallback)) } -internal fun org.w3c.dom.Document.getNode(tagName: String) = this.getElementsByTagName(tagName).item(0) +internal fun Document.getNode(tagName: String) = getElementsByTagName(tagName).item(0) internal fun NodeList.findElementByAttributeValue(attributeName: String, value: String): Element? { for (i in 0 until length) {