mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-07 01:51:27 +01:00
delete deprecated binary compatibility
This commit is contained in:
@@ -376,10 +376,6 @@ public final class app/revanced/patches/music/layout/buttons/HideButtonsKt {
|
||||
public static final fun getHideButtons ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/music/layout/castbutton/HideCastButtonKt {
|
||||
public static final fun getHideCastButton ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/music/layout/compactheader/HideCategoryBarKt {
|
||||
public static final fun getHideCategoryBar ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
@@ -1069,10 +1065,6 @@ public final class app/revanced/patches/soundcloud/offlinesync/EnableOfflineSync
|
||||
public static final fun getEnableOfflineSync ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/spotify/layout/hide/createbutton/HideCreateButtonPatchKt {
|
||||
public static final fun getHideCreateButtonPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/spotify/layout/theme/CustomThemePatchKt {
|
||||
public static final fun getCustomThemePatch ()Lapp/revanced/patcher/patch/ResourcePatch;
|
||||
}
|
||||
@@ -1081,10 +1073,6 @@ public final class app/revanced/patches/spotify/misc/extension/ExtensionPatchKt
|
||||
public static final fun getSharedExtensionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/spotify/misc/fix/SpoofClientPatchKt {
|
||||
public static final fun getSpoofClientPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/spotify/misc/fix/login/FixFacebookLoginPatchKt {
|
||||
public static final fun getFixFacebookLoginPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
@@ -1317,10 +1305,6 @@ public final class app/revanced/patches/twitter/misc/links/ChangeLinkSharingDoma
|
||||
public static final fun getChangeLinkSharingDomainPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/twitter/misc/links/OpenLinksWithAppChooserPatchKt {
|
||||
public static final fun getOpenLinksWithAppChooserPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatchKt {
|
||||
public static final fun getSanitizeSharingLinksPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package app.revanced.patches.music.layout.castbutton
|
||||
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.music.layout.buttons.hideButtons
|
||||
|
||||
@Deprecated("Patch was moved", ReplaceWith("hideButtons"))
|
||||
@Suppress("unused")
|
||||
val hideCastButton = bytecodePatch{
|
||||
dependsOn(hideButtons)
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package app.revanced.patches.spotify.layout.hide.createbutton
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Deprecated("Obsolete")
|
||||
internal val navigationBarItemSetClassFingerprint = fingerprint {
|
||||
strings("NavigationBarItemSet(")
|
||||
}
|
||||
|
||||
@Deprecated("Obsolete")
|
||||
internal val navigationBarItemSetConstructorFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
|
||||
// Make sure the method checks whether navigation bar items are null before adding them.
|
||||
// If this is not true, then we cannot patch the method and potentially transform the parameters into null.
|
||||
opcodes(Opcode.IF_EQZ, Opcode.INVOKE_VIRTUAL)
|
||||
custom { method, _ ->
|
||||
method.indexOfFirstInstruction {
|
||||
getReference<MethodReference>()?.name == "add"
|
||||
} >= 0
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Obsolete")
|
||||
internal val oldNavigationBarAddItemFingerprint = fingerprint {
|
||||
strings("Bottom navigation tabs exceeds maximum of 5 tabs")
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package app.revanced.patches.spotify.layout.hide.createbutton
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.spotify.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/spotify/layout/hide/createbutton/HideCreateButtonPatch;"
|
||||
|
||||
@Deprecated("Patch no longer works with the latest version of Spotify, " +
|
||||
"and Spotify has added this functionality to the app")
|
||||
@Suppress("unused")
|
||||
val hideCreateButtonPatch = bytecodePatch(
|
||||
description = "Hides the \"Create\" button in the navigation bar. The latest app targets do not need this patch.",
|
||||
) {
|
||||
compatibleWith("com.spotify.music")
|
||||
|
||||
dependsOn(sharedExtensionPatch)
|
||||
|
||||
execute {
|
||||
val oldNavigationBarAddItemMethod = oldNavigationBarAddItemFingerprint.originalMethodOrNull
|
||||
// Only throw the fingerprint error when oldNavigationBarAddItemMethod does not exist.
|
||||
val navigationBarItemSetClassDef = if (oldNavigationBarAddItemMethod == null) {
|
||||
navigationBarItemSetClassFingerprint.originalClassDef
|
||||
} else {
|
||||
navigationBarItemSetClassFingerprint.originalClassDefOrNull
|
||||
}
|
||||
|
||||
if (navigationBarItemSetClassDef != null) {
|
||||
// Main patch for newest and most versions.
|
||||
// The NavigationBarItemSet constructor accepts multiple parameters which represent each navigation bar item.
|
||||
// Each item is manually checked whether it is not null and then added to a LinkedHashSet.
|
||||
// Since the order of the items can differ, we are required to check every parameter to see whether it is the
|
||||
// Create button. So, for every parameter passed to the method, invoke our extension method and overwrite it
|
||||
// to null in case it is the Create button.
|
||||
navigationBarItemSetConstructorFingerprint.match(navigationBarItemSetClassDef).method.apply {
|
||||
// Add 1 to the index because the first parameter register is `this`.
|
||||
val parameterTypesWithRegister = parameterTypes.mapIndexed { index, parameterType ->
|
||||
parameterType to (index + 1)
|
||||
}
|
||||
|
||||
val returnNullIfIsCreateButtonDescriptor =
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->returnNullIfIsCreateButton(Ljava/lang/Object;)Ljava/lang/Object;"
|
||||
|
||||
parameterTypesWithRegister.reversed().forEach { (parameterType, parameterRegister) ->
|
||||
addInstructions(
|
||||
0,
|
||||
"""
|
||||
invoke-static { p$parameterRegister }, $returnNullIfIsCreateButtonDescriptor
|
||||
move-result-object p$parameterRegister
|
||||
check-cast p$parameterRegister, $parameterType
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oldNavigationBarAddItemMethod != null) {
|
||||
// In case an older version of the app is being patched, hook the old method which adds navigation bar items.
|
||||
// Return early if the navigation bar item title resource id is the old Create button title resource id.
|
||||
oldNavigationBarAddItemFingerprint.methodOrNull?.apply {
|
||||
val getNavigationBarItemTitleStringIndex = indexOfFirstInstructionOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
reference?.definingClass == "Landroid/content/res/Resources;" && reference.name == "getString"
|
||||
}
|
||||
// This register is a parameter register, so it can be used at the start of the method when adding
|
||||
// the new instructions.
|
||||
val oldNavigationBarItemTitleResIdRegister =
|
||||
getInstruction<FiveRegisterInstruction>(getNavigationBarItemTitleStringIndex).registerD
|
||||
|
||||
// The instruction where the normal method logic starts.
|
||||
val firstInstruction = getInstruction(0)
|
||||
|
||||
val isOldCreateButtonDescriptor =
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->isOldCreateButton(I)Z"
|
||||
|
||||
val returnEarlyInstruction = if (returnType == "V") {
|
||||
// In older implementations the method return value is void.
|
||||
"return-void"
|
||||
} else {
|
||||
// In newer implementations
|
||||
// return null because the method return value is a BottomNavigationItemView.
|
||||
"const/4 v0, 0\n" +
|
||||
"return-object v0"
|
||||
}
|
||||
|
||||
addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static { v$oldNavigationBarItemTitleResIdRegister }, $isOldCreateButtonDescriptor
|
||||
move-result v0
|
||||
|
||||
# If this navigation bar item is not the Create button, jump to the normal method logic.
|
||||
if-eqz v0, :normal-method-logic
|
||||
|
||||
$returnEarlyInstruction
|
||||
""",
|
||||
ExternalLabel("normal-method-logic", firstInstruction)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package app.revanced.patches.spotify.misc.fix
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
import app.revanced.patcher.string
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
internal val loadOrbitLibraryFingerprint = fingerprint {
|
||||
strings("/liborbit-jni-spotify.so")
|
||||
}
|
||||
|
||||
internal val setClientIdFingerprint = fingerprint {
|
||||
parameters("Ljava/lang/String;")
|
||||
custom { method, classDef ->
|
||||
classDef.type == "Lcom/spotify/connectivity/ApplicationScopeConfiguration;"
|
||||
&& method.name == "setClientId"
|
||||
}
|
||||
}
|
||||
|
||||
internal val setUserAgentFingerprint = fingerprint {
|
||||
parameters("Ljava/lang/String;")
|
||||
custom { method, classDef ->
|
||||
classDef.type == "Lcom/spotify/connectivity/ApplicationScopeConfiguration;"
|
||||
&& method.name == "setDefaultHTTPUserAgent"
|
||||
}
|
||||
}
|
||||
|
||||
internal val extensionFixConstantsFingerprint = fingerprint {
|
||||
custom { _, classDef -> classDef.type == "Lapp/revanced/extension/spotify/misc/fix/Constants;" }
|
||||
}
|
||||
|
||||
internal val runIntegrityVerificationFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returns("V")
|
||||
opcodes(
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.INVOKE_STATIC, // Calendar.getInstance()
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL, // instance.get(6)
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_EQ, // if (x == instance.get(6)) return
|
||||
)
|
||||
custom { method, _ ->
|
||||
method.indexOfFirstInstruction {
|
||||
val reference = getReference<MethodReference>()
|
||||
reference?.definingClass == "Ljava/util/Calendar;" && reference.name == "get"
|
||||
} >= 0
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package app.revanced.patches.spotify.misc.fix
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.intOption
|
||||
import app.revanced.patcher.patch.stringOption
|
||||
import app.revanced.patches.shared.misc.hex.HexPatchBuilder
|
||||
import app.revanced.patches.shared.misc.hex.hexPatch
|
||||
import app.revanced.patches.spotify.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.util.returnEarly
|
||||
|
||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/spotify/misc/fix/SpoofClientPatch;"
|
||||
|
||||
@Deprecated("Patch no longer functions")
|
||||
@Suppress("unused")
|
||||
val spoofClientPatch = bytecodePatch(
|
||||
description = "Spoofs the client to fix various functions of the app.",
|
||||
) {
|
||||
val requestListenerPort by intOption(
|
||||
key = "requestListenerPort",
|
||||
default = 4345,
|
||||
title = "Request listener port",
|
||||
description = "The port to use for the listener that intercepts and handles spoofed requests. " +
|
||||
"Port must be between 0 and 65535. " +
|
||||
"Do not change this option, if you do not know what you are doing.",
|
||||
validator = {
|
||||
it!!
|
||||
!(it < 0 || it > 65535)
|
||||
}
|
||||
)
|
||||
|
||||
val clientVersion by stringOption(
|
||||
key = "clientVersion",
|
||||
default = "iphone-9.0.58.558.g200011c",
|
||||
title = "Client version",
|
||||
description = "The client version used for spoofing the client token. " +
|
||||
"Do not change this option, if you do not know what you are doing."
|
||||
)
|
||||
|
||||
val hardwareMachine by stringOption(
|
||||
key = "hardwareMachine",
|
||||
default = "iPhone16,1",
|
||||
title = "Hardware machine",
|
||||
description = "The hardware machine used for spoofing the client token. " +
|
||||
"Do not change this option, if you do not know what you are doing."
|
||||
)
|
||||
|
||||
val systemVersion by stringOption(
|
||||
key = "systemVersion",
|
||||
default = "17.7.2",
|
||||
title = "System version",
|
||||
description = "The system version used for spoofing the client token. " +
|
||||
"Do not change this option, if you do not know what you are doing."
|
||||
)
|
||||
|
||||
dependsOn(
|
||||
sharedExtensionPatch,
|
||||
hexPatch(ignoreMissingTargetFiles = true, block = fun HexPatchBuilder.() {
|
||||
listOf(
|
||||
"arm64-v8a",
|
||||
"armeabi-v7a",
|
||||
"x86",
|
||||
"x86_64"
|
||||
).forEach { architecture ->
|
||||
"https://clienttoken.spotify.com/v1/clienttoken" to
|
||||
"http://127.0.0.1:$requestListenerPort/v1/clienttoken" inFile
|
||||
"lib/$architecture/liborbit-jni-spotify.so"
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
compatibleWith("com.spotify.music")
|
||||
|
||||
execute {
|
||||
val clientVersion = clientVersion!!
|
||||
val hardwareMachine = hardwareMachine!!
|
||||
val systemVersion = systemVersion!!
|
||||
|
||||
// region Spoof login request.
|
||||
|
||||
val version = clientVersion
|
||||
.substringAfter('-')
|
||||
.substringBeforeLast('.')
|
||||
.substringBeforeLast('.')
|
||||
|
||||
setUserAgentFingerprint.method.addInstruction(
|
||||
0,
|
||||
"const-string p1, \"Spotify/$version iOS/$systemVersion ($hardwareMachine)\""
|
||||
)
|
||||
|
||||
setClientIdFingerprint.method.addInstruction(
|
||||
0, "const-string p1, \"58bd3c95768941ea9eb4350aaa033eb3\""
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region Spoof client-token request.
|
||||
|
||||
loadOrbitLibraryFingerprint.method.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/16 v0, $requestListenerPort
|
||||
invoke-static { v0 }, $EXTENSION_CLASS_DESCRIPTOR->launchListener(I)V
|
||||
"""
|
||||
)
|
||||
|
||||
mapOf(
|
||||
"getClientVersion" to clientVersion,
|
||||
"getSystemVersion" to systemVersion,
|
||||
"getHardwareMachine" to hardwareMachine
|
||||
).forEach { (methodName, value) ->
|
||||
extensionFixConstantsFingerprint.classDef.methods.single { it.name == methodName }.returnEarly(value)
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Disable verdicts.
|
||||
|
||||
// Early return to block sending bad verdicts to the API.
|
||||
runIntegrityVerificationFingerprint.method.returnEarly()
|
||||
|
||||
// endregion
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,6 @@ package app.revanced.patches.twitter.misc.links
|
||||
import app.revanced.patcher.fingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal val openLinkFingerprint = fingerprint {
|
||||
returns("V")
|
||||
parameters("Landroid/content/Context;", "Landroid/content/Intent;", "Landroid/os/Bundle;")
|
||||
}
|
||||
|
||||
internal val sanitizeSharingLinksFingerprint = fingerprint {
|
||||
returns("Ljava/lang/String;")
|
||||
strings("<this>", "shareParam", "sessionToken")
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package app.revanced.patches.twitter.misc.links
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.twitter.misc.extension.sharedExtensionPatch
|
||||
|
||||
@Deprecated("Patch is obsolete and no longer needed with the highest supported app target. " +
|
||||
"This patch will soon be deleted.")
|
||||
@Suppress("unused")
|
||||
val openLinksWithAppChooserPatch = bytecodePatch(
|
||||
description = "Instead of opening links directly, open them with an app chooser. " +
|
||||
"As a result you can select a browser to open the link with.",
|
||||
) {
|
||||
dependsOn(sharedExtensionPatch)
|
||||
|
||||
compatibleWith("com.twitter.android"("10.48.0-release.0"))
|
||||
|
||||
execute {
|
||||
val methodReference =
|
||||
"Lapp/revanced/extension/twitter/patches/links/OpenLinksWithAppChooserPatch;->" +
|
||||
"openWithChooser(Landroid/content/Context;Landroid/content/Intent;)V"
|
||||
|
||||
openLinkFingerprint.method.addInstructions(
|
||||
0,
|
||||
"""
|
||||
invoke-static { p0, p1 }, $methodReference
|
||||
return-void
|
||||
""",
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user