mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
remove channel-whitelist
patch https://github.com/inotia00/ReVanced_Extended/issues/918
This commit is contained in:
@ -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)
|
||||
|
@ -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",
|
||||
|
@ -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.",
|
||||
)
|
||||
)
|
||||
|
@ -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",
|
||||
)
|
||||
)
|
||||
|
@ -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.",
|
||||
)
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
)
|
||||
|
@ -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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user