fix(youtube/client-spoof): update settings text for known side effects of spoof signature (#2476)

This commit is contained in:
LisoUseInAIKyrios 2023-06-23 17:46:27 +04:00 committed by GitHub
parent 1686cb7b30
commit 6756f80e3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 38 deletions

View file

@ -1,11 +0,0 @@
package app.revanced.patches.youtube.misc.fix.playback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object SubtitleWindowSettingsConstructorFingerprint : MethodFingerprint(
parameters = listOf("I", "I", "I", "Z", "Z"),
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/google/android/libraries/youtube/player/subtitles/model/SubtitleWindowSettings;"
&& methodDef.name == "<init>"
}
)

View file

@ -17,11 +17,9 @@ 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.fix.playback.fingerprints.OpenCronetDataSourceFingerprint import app.revanced.patches.youtube.misc.fix.playback.fingerprints.OpenCronetDataSourceFingerprint
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ProtobufParameterBuilderFingerprint import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ProtobufParameterBuilderFingerprint
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.SubtitleWindowSettingsConstructorFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.video.videoid.patch.VideoIdPatch
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("spoof-signature-verification") @Name("spoof-signature-verification")
@ -30,14 +28,12 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
IntegrationsPatch::class, IntegrationsPatch::class,
SettingsPatch::class, SettingsPatch::class,
PlayerTypeHookPatch::class, PlayerTypeHookPatch::class,
VideoIdPatch::class
]) ])
@Version("0.0.1") @Version("0.0.1")
class SpoofSignatureVerificationPatch : BytecodePatch( class SpoofSignatureVerificationPatch : BytecodePatch(
listOf( listOf(
ProtobufParameterBuilderFingerprint, ProtobufParameterBuilderFingerprint,
OpenCronetDataSourceFingerprint, OpenCronetDataSourceFingerprint,
SubtitleWindowSettingsConstructorFingerprint,
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
@ -48,7 +44,8 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
StringResource("revanced_spoof_signature_verification_summary_on", StringResource("revanced_spoof_signature_verification_summary_on",
"App signature spoofed\\n\\n" "App signature spoofed\\n\\n"
+ "Side effects include:\\n" + "Side effects include:\\n"
+ "• End screen cards are always hidden\\n" + "• Ambient mode may not work\\n"
+ "• Seekbar thumbnails are hidden\\n"
+ "• Downloading videos may not work"), + "• Downloading videos may not work"),
StringResource("revanced_spoof_signature_verification_summary_off", "App signature not spoofed"), StringResource("revanced_spoof_signature_verification_summary_off", "App signature not spoofed"),
StringResource("revanced_spoof_signature_verification_user_dialog_message", StringResource("revanced_spoof_signature_verification_user_dialog_message",
@ -56,9 +53,6 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
) )
) )
// Hook video id, required for subtitle fix.
VideoIdPatch.injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
// hook parameter // hook parameter
ProtobufParameterBuilderFingerprint.result?.let { ProtobufParameterBuilderFingerprint.result?.let {
val setParamMethod = context val setParamMethod = context
@ -95,25 +89,6 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
} ?: return OpenCronetDataSourceFingerprint.toErrorResult() } ?: return OpenCronetDataSourceFingerprint.toErrorResult()
// hook override subtitles
SubtitleWindowSettingsConstructorFingerprint.result?.let {
it.mutableMethod.apply {
addInstructions(
0,
"""
invoke-static {p1, p2, p3, p4, p5}, $INTEGRATIONS_CLASS_DESCRIPTOR->getSubtitleWindowSettingsOverride(IIIZZ)[I
move-result-object v0
const/4 v1, 0x0
aget p1, v0, v1 # ap, anchor position
const/4 v1, 0x1
aget p2, v0, v1 # ah, horizontal anchor
const/4 v1, 0x2
aget p3, v0, v1 # av, vertical anchor
"""
)
}
} ?: return SubtitleWindowSettingsConstructorFingerprint.toErrorResult()
return PatchResultSuccess() return PatchResultSuccess()
} }