diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/bytecode/patch/OverlayButtonsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/bytecode/patch/OverlayButtonsBytecodePatch.kt index 2504f01d9..0840bf747 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/bytecode/patch/OverlayButtonsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/bytecode/patch/OverlayButtonsBytecodePatch.kt @@ -29,7 +29,6 @@ class OverlayButtonsBytecodePatch : BytecodePatch() { "$BUTTON_PATH/AutoRepeat;", "$BUTTON_PATH/CopyWithTimeStamp;", "$BUTTON_PATH/Copy;", - "$BUTTON_PATH/Whitelists;", "$BUTTON_PATH/Speed;" ).forEach { descriptor -> PlayerControlsPatch.initializeControl(descriptor) diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/resource/patch/OverlayButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/resource/patch/OverlayButtonsPatch.kt index 0179bee62..1ded8d6e8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/resource/patch/OverlayButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/button/overlaybuttons/resource/patch/OverlayButtonsPatch.kt @@ -12,7 +12,6 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.button.autorepeat.patch.AutoRepeatPatch import app.revanced.patches.youtube.button.overlaybuttons.bytecode.patch.OverlayButtonsBytecodePatch -import app.revanced.patches.youtube.button.whitelist.patch.WhitelistPatch import app.revanced.patches.youtube.misc.overridespeed.bytecode.patch.OverrideSpeedHookPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.util.resources.ResourceUtils @@ -27,8 +26,7 @@ import app.revanced.util.resources.ResourceUtils.copyXmlNode AutoRepeatPatch::class, OverlayButtonsBytecodePatch::class, OverrideSpeedHookPatch::class, - SettingsPatch::class, - WhitelistPatch::class + SettingsPatch::class ] ) @YouTubeCompatibility @@ -65,7 +63,6 @@ class OverlayButtonsPatch : ResourcePatch { "revanced_copy_icon_with_time.png", "revanced_download_icon.png", "revanced_speed_icon.png", - "revanced_whitelist_icon.png", "yt_fill_arrow_repeat_white_24.png", "yt_outline_arrow_repeat_1_white_24.png", "yt_outline_arrow_shuffle_1_white_24.png", diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/PlayerResponseModelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/PlayerResponseModelFingerprint.kt deleted file mode 100644 index e1915c07b..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/PlayerResponseModelFingerprint.kt +++ /dev/null @@ -1,16 +0,0 @@ -package app.revanced.patches.youtube.button.whitelist.fingerprint - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.AccessFlags - -object PlayerResponseModelFingerprint : MethodFingerprint( - returnType = "Z", - access = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf("J", "L"), - strings = listOf( - "Attempting to seek during an ad", - "currentPositionMs.", - ) -) - diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/PlayerResponseModelParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/PlayerResponseModelParentFingerprint.kt deleted file mode 100644 index 653390fea..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/PlayerResponseModelParentFingerprint.kt +++ /dev/null @@ -1,14 +0,0 @@ -package app.revanced.patches.youtube.button.whitelist.fingerprint - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.AccessFlags - -object PlayerResponseModelParentFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), - strings = listOf( - "setMetadata may only be called once", - "Person", - ) -) - diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/PrimaryInjectFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/PrimaryInjectFingerprint.kt deleted file mode 100644 index 4c03b23c8..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/PrimaryInjectFingerprint.kt +++ /dev/null @@ -1,23 +0,0 @@ -package app.revanced.patches.youtube.button.whitelist.fingerprint - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode - -object PrimaryInjectFingerprint : MethodFingerprint( - returnType = "V", - access = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf(), - opcodes = listOf( - Opcode.IF_NEZ, - Opcode.CONST_STRING, - Opcode.INVOKE_STATIC, - Opcode.RETURN_VOID, - Opcode.IGET_OBJECT - ), - strings = listOf( - "play() called when the player wasn\'t loaded.", - ) -) - diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/SecondaryInjectFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/SecondaryInjectFingerprint.kt deleted file mode 100644 index da53b8a8a..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/fingerprint/SecondaryInjectFingerprint.kt +++ /dev/null @@ -1,26 +0,0 @@ -package app.revanced.patches.youtube.button.whitelist.fingerprint - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode - -object SecondaryInjectFingerprint : MethodFingerprint( - returnType = "V", - access = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf("L"), - opcodes = listOf( - Opcode.INVOKE_INTERFACE, - Opcode.MOVE_RESULT, - Opcode.IF_EQZ, - Opcode.INVOKE_INTERFACE, - Opcode.MOVE_RESULT_OBJECT, - Opcode.CHECK_CAST, - Opcode.INVOKE_VIRTUAL, - Opcode.GOTO, - Opcode.IPUT_OBJECT, - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT - ) -) - diff --git a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/patch/WhitelistPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/patch/WhitelistPatch.kt deleted file mode 100644 index a569852d4..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/button/whitelist/patch/WhitelistPatch.kt +++ /dev/null @@ -1,134 +0,0 @@ -package app.revanced.patches.youtube.button.whitelist.patch - -import app.revanced.extensions.toErrorResult -import app.revanced.patcher.annotation.Name -import app.revanced.patcher.annotation.Version -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.addInstruction -import app.revanced.patcher.extensions.or -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable -import app.revanced.patcher.util.smali.toInstructions -import app.revanced.patches.shared.annotation.YouTubeCompatibility -import app.revanced.patches.youtube.button.whitelist.fingerprint.* -import app.revanced.util.integrations.Constants.VIDEO_PATH -import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode -import org.jf.dexlib2.builder.instruction.BuilderInstruction21c -import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference -import org.jf.dexlib2.iface.instruction.ReferenceInstruction -import org.jf.dexlib2.iface.reference.FieldReference -import org.jf.dexlib2.iface.reference.MethodReference -import org.jf.dexlib2.immutable.ImmutableMethod -import org.jf.dexlib2.immutable.ImmutableMethodImplementation - -@Name("channel-whitelist") -@YouTubeCompatibility -@Version("0.0.1") -class WhitelistPatch : BytecodePatch( - listOf( - PlayerResponseModelFingerprint, - PlayerResponseModelParentFingerprint, - PrimaryInjectFingerprint, - SecondaryInjectFingerprint - ) -) { - override fun execute(context: BytecodeContext): PatchResult { - - PlayerResponseModelParentFingerprint.result?.mutableMethod?.let { method -> - val instructions = method.implementation!!.instructions - val injectIndex = instructions.indexOfFirst { - it.opcode == Opcode.CONST_STRING && - (it as BuilderInstruction21c).reference.toString() == "Person" - } + 2 - fourthRef = (instructions.elementAt(injectIndex) as ReferenceInstruction).reference as DexBackedMethodReference - } ?: return PlayerResponseModelParentFingerprint.toErrorResult() - - PlayerResponseModelFingerprint.result?.let { result -> - - with (result.method.implementation!!.instructions) { - firstRef = (elementAt(2) as ReferenceInstruction).reference as FieldReference - secondRef = (elementAt(3) as ReferenceInstruction).reference as FieldReference - thirdRef = (elementAt(4) as ReferenceInstruction).reference as MethodReference - } - - with (result.mutableClass) { - methods.add( - ImmutableMethod( - type, - "setCurrentVideoInformation", - listOf(), - "V", - AccessFlags.PRIVATE or AccessFlags.FINAL, - null, - null, - ImmutableMethodImplementation( - 2, """ - iget-object v0, v1, ${result.classDef.type}->${firstRef.name}:${firstRef.type} - iget-object v0, v0, ${firstRef.type}->${secondRef.name}:${secondRef.type} - invoke-interface {v0}, $thirdRef - move-result-object v0 - invoke-interface {v0}, $fourthRef - move-result-object v0 - invoke-static {v0}, $VIDEO_PATH/VideoInformation;->setChannelName(Ljava/lang/String;)V - return-void - """.toInstructions(), null, null - ) - ).toMutable() - ) - } - - listOf( - PrimaryInjectFingerprint, - SecondaryInjectFingerprint - ).map { - it.result ?: return it.toErrorResult() - }.forEach { - val method = it.mutableMethod - val index = it.scanResult.patternScanResult!!.endIndex + 1 - method.addInstruction( - index, - "invoke-direct {p0}, ${result.classDef.type}->setCurrentVideoInformation()V" - ) - } - } ?: return PlayerResponseModelFingerprint.toErrorResult() - - val PlayerResponseModelResult = PlayerResponseModelFingerprint.result!! - - val classDef = PlayerResponseModelResult.mutableClass - classDef.methods.add( - ImmutableMethod( - classDef.type, - "setCurrentVideoInformation", - listOf(), - "V", - AccessFlags.PRIVATE or AccessFlags.FINAL, - null, - null, - ImmutableMethodImplementation( - 2, """ - iget-object v0, v1, ${PlayerResponseModelResult.classDef.type}->${firstRef.name}:${firstRef.type} - iget-object v0, v0, ${firstRef.type}->${secondRef.name}:${secondRef.type} - invoke-interface {v0}, $thirdRef - move-result-object v0 - invoke-interface {v0}, $fourthRef - move-result-object v0 - invoke-static {v0}, $VIDEO_PATH/VideoInformation;->setChannelName(Ljava/lang/String;)V - return-void - """.toInstructions(), null, null - ) - ).toMutable() - ) - - return PatchResultSuccess() - } - - companion object { - private lateinit var firstRef: FieldReference - private lateinit var secondRef: FieldReference - private lateinit var thirdRef: MethodReference - private lateinit var fourthRef: DexBackedMethodReference - } -} diff --git a/src/main/resources/youtube/overlaybuttons/drawable-xxhdpi/revanced_whitelist_icon.png b/src/main/resources/youtube/overlaybuttons/drawable-xxhdpi/revanced_whitelist_icon.png deleted file mode 100644 index 1aac0caf4..000000000 Binary files a/src/main/resources/youtube/overlaybuttons/drawable-xxhdpi/revanced_whitelist_icon.png and /dev/null differ diff --git a/src/main/resources/youtube/overlaybuttons/host/layout/youtube_controls_bottom_ui_container.xml b/src/main/resources/youtube/overlaybuttons/host/layout/youtube_controls_bottom_ui_container.xml index 5b33ba62c..48dfe834c 100644 --- a/src/main/resources/youtube/overlaybuttons/host/layout/youtube_controls_bottom_ui_container.xml +++ b/src/main/resources/youtube/overlaybuttons/host/layout/youtube_controls_bottom_ui_container.xml @@ -1,7 +1,6 @@ - - + diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index 0d9e3edc4..860a34cd1 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -471,9 +471,6 @@ Please do not report any issues you encounter while using this feature."Speed button is hidden Speed button is shown Show speed button - Whitelist button is hidden - Whitelist button is shown - Show whitelist button Current Header: Default Header Current Header: Premium Header Premium Header @@ -536,24 +533,6 @@ Since these setting is quite outdated, it may not be valid" Video ads are shown Video ads are hidden Hide video ads - Channel %s was added to the %s whitelist - Failed to add channel %s to the %s whitelist - Video Ads - Ads - Channel Name - There are no whitelisted channels - Not added to whitelist - Failed to retrieve channel details, received code %d - Added to whitelist - Reboot to apply channel whitelist settings - Channel %s was removed from the %s whitelist - Failed to remove channel %s from the %s whitelist - Check or remove the list of channels added to the whitelist - Whitelist settings - Video Speed - SponsorBlock - SB - Channel Whitelist Enable SponsorBlock SponsorBlock is a crowd-sourced system for skipping annoying parts of YouTube videos diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 307e249dd..783dd2cce 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -371,7 +371,6 @@ - @@ -381,9 +380,6 @@ - - - PREFERENCE: OVERLAY_BUTTONS -->