fix(YouTube - Client spoof): Do not record feed videos to history by default (#3017)

This commit is contained in:
oSumAtrIX 2023-09-23 23:48:45 +02:00 committed by GitHub
parent 8e5494f03f
commit 5ccbf1bf8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 46 deletions

View File

@ -14,7 +14,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
@Patch( @Patch(
name = "Client spoof", name = "Client spoof",
description = "Spoofs the client to allow playback.", description = "Spoofs the client to allow playback.",
dependencies = [SpoofSignatureVerificationPatch::class], dependencies = [SpoofSignaturePatch::class],
compatiblePackages = [ compatiblePackages = [
CompatiblePackage( CompatiblePackage(
"com.google.android.youtube", "com.google.android.youtube",

View File

@ -18,14 +18,14 @@ import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
@Patch( @Patch(
description = "Spoofs the client to prevent playback issues.", description = "Spoofs the signature to prevent playback issues.",
dependencies = [ dependencies = [
SpoofSignatureVerificationResourcePatch::class, SpoofSignatureResourcePatch::class,
IntegrationsPatch::class, IntegrationsPatch::class,
PlayerTypeHookPatch::class PlayerTypeHookPatch::class
] ]
) )
object SpoofSignatureVerificationPatch : BytecodePatch( object SpoofSignaturePatch : BytecodePatch(
setOf( setOf(
ProtobufParameterBuilderFingerprint, ProtobufParameterBuilderFingerprint,
StoryboardThumbnailParentFingerprint, StoryboardThumbnailParentFingerprint,
@ -33,10 +33,9 @@ object SpoofSignatureVerificationPatch : BytecodePatch(
) )
) { ) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR = private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/patches/SpoofSignatureVerificationPatch;" "Lapp/revanced/integrations/patches/SpoofSignaturePatch;"
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
// hook parameter // hook parameter
ProtobufParameterBuilderFingerprint.result?.let { ProtobufParameterBuilderFingerprint.result?.let {
val setParamMethod = context val setParamMethod = context
@ -49,7 +48,7 @@ object SpoofSignatureVerificationPatch : BytecodePatch(
addInstructions( addInstructions(
0, 0,
""" """
invoke-static {p$protobufParameterRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->overrideProtobufParameter(Ljava/lang/String;)Ljava/lang/String; invoke-static {p$protobufParameterRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;)Ljava/lang/String;
move-result-object p$protobufParameterRegister move-result-object p$protobufParameterRegister
""" """
) )

View File

@ -0,0 +1,69 @@
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.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
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) {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
PreferenceScreen(
key = "revanced_spoof_signature_verification",
title = StringResource(
"revanced_spoof_signature_verification_title",
"Spoof app signature"
),
preferences = listOf(
SwitchPreference(
"revanced_spoof_signature_verification_enabled",
StringResource("revanced_spoof_signature_verification_enabled_title", "Spoof app signature"),
StringResource(
"revanced_spoof_signature_verification_enabled_summary_on",
"App signature spoofed\\n\\n"
+ "Side effects include:\\n"
+ "• No ambient mode\\n"
+ "• Videos can't be downloaded\\n"
+ "• Seekbar thumbnails are hidden"
),
StringResource(
"revanced_spoof_signature_verification_enabled_summary_off",
"App signature not spoofed\\n\\nVideo playback may not work"
),
StringResource(
"revanced_spoof_signature_verification_enabled_user_dialog_message",
"Turning off this setting will cause video playback issues."
)
),
SwitchPreference(
"revanced_spoof_signature_in_feed_enabled",
StringResource("revanced_spoof_signature_in_feed_enabled_title", "Spoof app signature in feed"),
StringResource(
"revanced_spoof_signature_in_feed_enabled_summary_on",
"App signature spoofed\\n\\n"
+ "Side effects include:\\n"
+ "• Feed videos are missing subtitles\\n"
+ "• Automatically played feed videos will show up in your watch history"
),
StringResource(
"revanced_spoof_signature_in_feed_enabled_summary_off",
"App signature not spoofed for feed videos\n\n"
+ "Feed videos will play for less than 1 minute before encountering playback issues"
)
)
)
)
)
scrubbedPreviewThumbnailResourceId = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == "thumbnail"
}.id
}
}

View File

@ -1,36 +0,0 @@
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.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@Patch(dependencies = [SettingsPatch::class, ResourceMappingPatch::class])
object SpoofSignatureVerificationResourcePatch : ResourcePatch() {
internal var scrubbedPreviewThumbnailResourceId: Long = -1
override fun execute(context: ResourceContext) {
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"
+ "• Downloading videos may not work\\n"
+ "• Seekbar thumbnails are always hidden"),
StringResource("revanced_spoof_signature_verification_summary_off", "App signature not spoofed\\n\\nVideo playback may not work"),
StringResource("revanced_spoof_signature_verification_user_dialog_message",
"Turning off this setting will cause video playback issues.")
)
)
scrubbedPreviewThumbnailResourceId = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == "thumbnail"
}.id
}
}

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.misc.fix.playback.fingerprints package app.revanced.patches.youtube.misc.fix.playback.fingerprints
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patches.youtube.misc.fix.playback.SpoofSignatureVerificationResourcePatch import app.revanced.patches.youtube.misc.fix.playback.SpoofSignatureResourcePatch
import app.revanced.util.patch.LiteralValueFingerprint import app.revanced.util.patch.LiteralValueFingerprint
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
@ -23,5 +23,5 @@ object ScrubbedPreviewLayoutFingerprint : LiteralValueFingerprint(
Opcode.IPUT_OBJECT, // preview imageview 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. // This resource is used in ~ 40 different locations, but this method has a distinct list of parameters to match to.
literalSupplier = { SpoofSignatureVerificationResourcePatch.scrubbedPreviewThumbnailResourceId } literalSupplier = { SpoofSignatureResourcePatch.scrubbedPreviewThumbnailResourceId }
) )