forked from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(YouTube - Spoof client): show video time and chapters while using…
… seekbar (ReVanced#2607)
- Loading branch information
1 parent
1f25b62
commit 9546d12
Showing
6 changed files
with
167 additions
and
22 deletions.
There are no files selected for viewing
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.patch.SpoofSignatureVerificationResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import org.jf.dexlib2.AccessFlags | ||
import org.jf.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. | ||
literal = SpoofSignatureVerificationResourcePatch.scrubbedPreviewThumbnailResourceId | ||
) |
23 changes: 23 additions & 0 deletions
23
...revanced/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailFingerprint.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.method.impl.MethodFingerprint | ||
import org.jf.dexlib2.AccessFlags | ||
import org.jf.dexlib2.Opcode | ||
|
||
/** | ||
* Resolves using the class found in [StoryboardThumbnailParentFingerprint]. | ||
*/ | ||
object StoryboardThumbnailFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "Z", | ||
parameters = listOf(), | ||
opcodes = listOf( | ||
Opcode.MOVE_RESULT, | ||
Opcode.IF_GTZ, | ||
Opcode.GOTO, | ||
Opcode.CONST_4, | ||
Opcode.RETURN, | ||
Opcode.RETURN, // Last instruction of method. | ||
), | ||
) |
17 changes: 17 additions & 0 deletions
17
...ed/patches/youtube/misc/fix/playback/fingerprints/StoryboardThumbnailParentFingerprint.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,17 @@ | ||
package app.revanced.patches.youtube.misc.fix.playback.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import org.jf.dexlib2.AccessFlags | ||
|
||
/** | ||
* Here lies code that creates the seekbar thumbnails. | ||
* | ||
* An additional change here might force the thumbnails to be created, | ||
* or possibly a change somewhere else (maybe involving YouTube 18.23.35 class `hte`) | ||
*/ | ||
object StoryboardThumbnailParentFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "Landroid/graphics/Bitmap;", | ||
strings = listOf("Storyboard regionDecoder.decodeRegion exception - "), | ||
) |
1 change: 0 additions & 1 deletion
1
...anced/patches/youtube/misc/fix/playback/fingerprints/UserAgentHeaderBuilderFingerprint.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
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
44 changes: 44 additions & 0 deletions
44
...vanced/patches/youtube/misc/fix/playback/patch/SpoofSignatureVerificationResourcePatch.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,44 @@ | ||
package app.revanced.patches.youtube.misc.fix.playback.patch | ||
|
||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotations.DependsOn | ||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch | ||
import app.revanced.patches.shared.settings.preference.impl.StringResource | ||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference | ||
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.* | ||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch | ||
|
||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) | ||
class SpoofSignatureVerificationResourcePatch : ResourcePatch { | ||
|
||
override fun execute(context: ResourceContext): PatchResult { | ||
SettingsPatch.PreferenceScreen.MISC.addPreferences( | ||
SwitchPreference( | ||
"revanced_spoof_signature_verification", | ||
StringResource("revanced_spoof_signature_verification_title", "Spoof app signature"), | ||
StringResource("revanced_spoof_signature_verification_summary_on", | ||
"App signature spoofed\\n\\n" | ||
+ "Side effects include:\\n" | ||
+ "• Ambient mode may not work\\n" | ||
+ "• Seekbar thumbnails are hidden\\n" | ||
+ "• Downloading videos may not work"), | ||
StringResource("revanced_spoof_signature_verification_summary_off", "App signature not spoofed"), | ||
StringResource("revanced_spoof_signature_verification_user_dialog_message", | ||
"Turning off this setting may cause playback issues.") | ||
) | ||
) | ||
|
||
scrubbedPreviewThumbnailResourceId = ResourceMappingPatch.resourceMappings.single { | ||
it.type == "id" && it.name == "thumbnail" | ||
}.id | ||
|
||
return PatchResultSuccess() | ||
} | ||
|
||
companion object { | ||
var scrubbedPreviewThumbnailResourceId: Long = -1 | ||
} | ||
} |