feat(YouTube - Bypass URL redirects): Support version 18.43.45

This commit is contained in:
oSumAtrIX 2023-11-12 00:47:21 +01:00
parent eee51a863a
commit e205ac761d
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
3 changed files with 26 additions and 24 deletions

View File

@ -10,8 +10,8 @@ import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.links.fingerprints.OpenLinksDirectlyPrimaryFingerprint import app.revanced.patches.youtube.misc.links.fingerprints.ABUriParserFingerprint
import app.revanced.patches.youtube.misc.links.fingerprints.OpenLinksDirectlySecondaryFingerprint import app.revanced.patches.youtube.misc.links.fingerprints.HTTPUriParserFingerprint
import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
@ -23,20 +23,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
CompatiblePackage( CompatiblePackage(
"com.google.android.youtube", "com.google.android.youtube",
[ [
"18.16.37", "18.43.45"
"18.19.35",
"18.20.39",
"18.23.35",
"18.29.38",
"18.32.39",
"18.37.36",
"18.38.44"
] ]
) )
] ]
) )
object BypassURLRedirectsPatch : BytecodePatch( object BypassURLRedirectsPatch : BytecodePatch(
setOf(OpenLinksDirectlyPrimaryFingerprint, OpenLinksDirectlySecondaryFingerprint) setOf(ABUriParserFingerprint, HTTPUriParserFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.MISC.addPreferences( SettingsPatch.PreferenceScreen.MISC.addPreferences(
@ -48,14 +41,14 @@ object BypassURLRedirectsPatch : BytecodePatch(
) )
) )
arrayOf( mapOf(
OpenLinksDirectlyPrimaryFingerprint, ABUriParserFingerprint to 7, // Offset to Uri.parse.
OpenLinksDirectlySecondaryFingerprint HTTPUriParserFingerprint to 0 // Offset to Uri.parse.
).map { ).map { (fingerprint, offset) ->
it.result ?: throw it.exception (fingerprint.result ?: throw fingerprint.exception) to offset
}.forEach { result -> }.forEach { (result, offset) ->
result.mutableMethod.apply { result.mutableMethod.apply {
val insertIndex = result.scanResult.patternScanResult!!.startIndex val insertIndex = result.scanResult.patternScanResult!!.startIndex + offset
val uriStringRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC val uriStringRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
replaceInstruction( replaceInstruction(

View File

@ -5,16 +5,25 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
object OpenLinksDirectlyPrimaryFingerprint : MethodFingerprint( object ABUriParserFingerprint : MethodFingerprint(
returnType = "Ljava/lang/Object", returnType = "Ljava/lang/Object",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("Ljava/lang/Object"), parameters = listOf("Ljava/lang/Object"),
opcodes = listOf( opcodes = listOf(
Opcode.RETURN_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.RETURN_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_STATIC, Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.RETURN_OBJECT, Opcode.RETURN_OBJECT,
Opcode.CHECK_CAST, Opcode.CHECK_CAST
Opcode.SGET, ),
Opcode.SGET_OBJECT customFingerprint = { methodDef, classDef ->
) // This method is always called "a" because this kind of class always has a single method.
methodDef.name == "a" && classDef.methods.count() == 3
}
) )

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
object OpenLinksDirectlySecondaryFingerprint : MethodFingerprint( object HTTPUriParserFingerprint : MethodFingerprint(
returnType = "Landroid/net/Uri", returnType = "Landroid/net/Uri",
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("Ljava/lang/String"), parameters = listOf("Ljava/lang/String"),