generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(YouTube - Client spoof): Fix low resolution precise seeking thumb…
…nails (#3249)
- Loading branch information
1 parent
28e5c03
commit 0cb41ef
Showing
9 changed files
with
232 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofSignatureResourcePatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package app.revanced.patches.youtube.misc.fix.playback | ||
|
||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch | ||
import app.revanced.patches.youtube.misc.settings.SettingsPatch | ||
|
||
@Patch(dependencies = [SettingsPatch::class, ResourceMappingPatch::class]) | ||
object SpoofSignatureResourcePatch : ResourcePatch() { | ||
internal var scrubbedPreviewThumbnailResourceId: Long = -1 | ||
|
||
override fun execute(context: ResourceContext) { | ||
scrubbedPreviewThumbnailResourceId = ResourceMappingPatch.resourceMappings.single { | ||
it.type == "id" && it.name == "thumbnail" | ||
}.id | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...es/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplLiveStreamFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package app.revanced.patches.youtube.misc.fix.playback.fingerprints | ||
|
||
import app.revanced.extensions.containsWideLiteralInstructionValue | ||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
object PlayerResponseModelImplLiveStreamFingerprint : MethodFingerprint( | ||
returnType = "Ljava/lang/String;", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
parameters = emptyList(), | ||
opcodes = listOf( | ||
Opcode.RETURN_OBJECT, | ||
Opcode.CONST_4, | ||
Opcode.RETURN_OBJECT | ||
), | ||
customFingerprint = handler@{ methodDef, _ -> | ||
if (!methodDef.definingClass.endsWith("/PlayerResponseModelImpl;")) return@handler false | ||
|
||
methodDef.containsWideLiteralInstructionValue(70276274) | ||
} | ||
) |
23 changes: 23 additions & 0 deletions
23
...patches/youtube/misc/fix/playback/fingerprints/PlayerResponseModelImplRecommendedLevel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package app.revanced.patches.youtube.misc.fix.playback.fingerprints | ||
|
||
import app.revanced.extensions.containsWideLiteralInstructionValue | ||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
object PlayerResponseModelImplRecommendedLevel : MethodFingerprint( | ||
returnType = "I", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
parameters = emptyList(), | ||
opcodes = listOf( | ||
Opcode.SGET_OBJECT, | ||
Opcode.IGET, | ||
Opcode.RETURN | ||
), | ||
customFingerprint = handler@{ methodDef, _ -> | ||
if (!methodDef.definingClass.endsWith("/PlayerResponseModelImpl;")) return@handler false | ||
|
||
methodDef.containsWideLiteralInstructionValue(55735497) | ||
} | ||
) |
27 changes: 27 additions & 0 deletions
27
...vanced/patches/youtube/misc/fix/playback/fingerprints/ScrubbedPreviewLayoutFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package app.revanced.patches.youtube.misc.fix.playback.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patches.youtube.misc.fix.playback.SpoofSignatureResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
object ScrubbedPreviewLayoutFingerprint : LiteralValueFingerprint( | ||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, | ||
returnType = "V", | ||
parameters = listOf("Landroid/content/Context;", "Landroid/util/AttributeSet;", "I", "I"), | ||
opcodes = listOf( | ||
Opcode.INVOKE_STATIC, | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.CONST, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.CHECK_CAST, | ||
Opcode.IPUT_OBJECT, // preview imageview | ||
), | ||
// This resource is used in ~ 40 different locations, but this method has a distinct list of parameters to match to. | ||
literalSupplier = { SpoofSignatureResourcePatch.scrubbedPreviewThumbnailResourceId } | ||
) |
23 changes: 23 additions & 0 deletions
23
...be/misc/fix/playback/fingerprints/StoryboardRendererDecoderRecommendedLevelFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package app.revanced.patches.youtube.misc.fix.playback.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
/** | ||
* Resolves to the same method as [StoryboardRendererDecoderSpecFingerprint]. | ||
*/ | ||
object StoryboardRendererDecoderRecommendedLevelFingerprint : MethodFingerprint( | ||
returnType = "V", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
parameters = listOf("Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;"), | ||
opcodes = listOf( | ||
Opcode.INVOKE_INTERFACE, | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.IPUT_OBJECT, | ||
Opcode.INVOKE_INTERFACE, | ||
Opcode.MOVE_RESULT | ||
), | ||
strings = listOf("#-1#") | ||
) |
23 changes: 23 additions & 0 deletions
23
...atches/youtube/misc/fix/playback/fingerprints/StoryboardRendererDecoderSpecFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package app.revanced.patches.youtube.misc.fix.playback.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
/** | ||
* Resolves to the same method as [StoryboardRendererDecoderRecommendedLevelFingerprint]. | ||
*/ | ||
object StoryboardRendererDecoderSpecFingerprint : MethodFingerprint( | ||
returnType = "V", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
parameters = listOf("Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;"), | ||
opcodes = listOf( | ||
Opcode.INVOKE_INTERFACE, // First instruction of the method. | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.CONST_4, | ||
Opcode.CONST_4, | ||
Opcode.IF_NEZ, | ||
), | ||
strings = listOf("#-1#") | ||
) |
15 changes: 0 additions & 15 deletions
15
...anced/patches/youtube/misc/fix/playback/fingerprints/StoryboardRendererInitFingerprint.kt
This file was deleted.
Oops, something went wrong.