mirror of
https://github.com/revanced/revanced-patches
synced 2024-09-01 12:05:35 +02:00
feat(YouTube - Bypass URL redirects): Support version 18.43.45
This commit is contained in:
parent
eee51a863a
commit
e205ac761d
@ -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.SwitchPreference
|
||||
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.OpenLinksDirectlySecondaryFingerprint
|
||||
import app.revanced.patches.youtube.misc.links.fingerprints.ABUriParserFingerprint
|
||||
import app.revanced.patches.youtube.misc.links.fingerprints.HTTPUriParserFingerprint
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
@ -23,20 +23,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39",
|
||||
"18.37.36",
|
||||
"18.38.44"
|
||||
"18.43.45"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
object BypassURLRedirectsPatch : BytecodePatch(
|
||||
setOf(OpenLinksDirectlyPrimaryFingerprint, OpenLinksDirectlySecondaryFingerprint)
|
||||
setOf(ABUriParserFingerprint, HTTPUriParserFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||
@ -48,14 +41,14 @@ object BypassURLRedirectsPatch : BytecodePatch(
|
||||
)
|
||||
)
|
||||
|
||||
arrayOf(
|
||||
OpenLinksDirectlyPrimaryFingerprint,
|
||||
OpenLinksDirectlySecondaryFingerprint
|
||||
).map {
|
||||
it.result ?: throw it.exception
|
||||
}.forEach { result ->
|
||||
mapOf(
|
||||
ABUriParserFingerprint to 7, // Offset to Uri.parse.
|
||||
HTTPUriParserFingerprint to 0 // Offset to Uri.parse.
|
||||
).map { (fingerprint, offset) ->
|
||||
(fingerprint.result ?: throw fingerprint.exception) to offset
|
||||
}.forEach { (result, offset) ->
|
||||
result.mutableMethod.apply {
|
||||
val insertIndex = result.scanResult.patternScanResult!!.startIndex
|
||||
val insertIndex = result.scanResult.patternScanResult!!.startIndex + offset
|
||||
val uriStringRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
|
||||
|
||||
replaceInstruction(
|
||||
|
@ -5,16 +5,25 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object OpenLinksDirectlyPrimaryFingerprint : MethodFingerprint(
|
||||
object ABUriParserFingerprint : MethodFingerprint(
|
||||
returnType = "Ljava/lang/Object",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("Ljava/lang/Object"),
|
||||
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.MOVE_RESULT_OBJECT,
|
||||
Opcode.RETURN_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.SGET,
|
||||
Opcode.SGET_OBJECT
|
||||
)
|
||||
Opcode.CHECK_CAST
|
||||
),
|
||||
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
|
||||
}
|
||||
)
|
@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object OpenLinksDirectlySecondaryFingerprint : MethodFingerprint(
|
||||
object HTTPUriParserFingerprint : MethodFingerprint(
|
||||
returnType = "Landroid/net/Uri",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("Ljava/lang/String"),
|
Loading…
Reference in New Issue
Block a user