Compare commits

...

8 Commits

Author SHA1 Message Date
semantic-release-bot
bc8ce81bbc chore(release): 2.188.0-dev.9 [skip ci]
# [2.188.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.8...v2.188.0-dev.9) (2023-08-07)

### Features

* **YouTube - Hide video action buttons:** Hide individual action buttons ([#2723](https://github.com/ReVanced/revanced-patches/issues/2723)) ([7c131bf](7c131bfe1b))
2023-08-07 14:37:51 +00:00
LisoUseInAIKyrios
7c131bfe1b feat(YouTube - Hide video action buttons): Hide individual action buttons (#2723) 2023-08-07 18:34:53 +04:00
semantic-release-bot
f1e063ee76 chore(release): 2.188.0-dev.8 [skip ci]
# [2.188.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.7...v2.188.0-dev.8) (2023-08-07)

### Features

* **Change package name:** Append `.revanced` to package name by default ([#2750](https://github.com/ReVanced/revanced-patches/issues/2750)) ([3cd5f57](3cd5f573b1))
2023-08-07 14:10:41 +00:00
Pro-Tweaker
3cd5f573b1 feat(Change package name): Append .revanced to package name by default (#2750)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-08-07 16:07:22 +02:00
semantic-release-bot
9eaf98e4a1 chore(release): 2.188.0-dev.7 [skip ci]
# [2.188.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.6...v2.188.0-dev.7) (2023-08-07)

### Features

* **YouTube - Debug:** Logging of layout proto buffer strings ([#2759](https://github.com/ReVanced/revanced-patches/issues/2759)) ([d563085](d56308539b))
2023-08-07 07:53:51 +00:00
LisoUseInAIKyrios
d56308539b feat(YouTube - Debug): Logging of layout proto buffer strings (#2759) 2023-08-07 11:50:42 +04:00
semantic-release-bot
68c4d965cd chore(release): 2.188.0-dev.6 [skip ci]
# [2.188.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.5...v2.188.0-dev.6) (2023-08-06)

### Bug Fixes

* **YouTube - Client spoof:** Adjust spoof signature settings description ([#2760](https://github.com/ReVanced/revanced-patches/issues/2760)) ([d10b5cf](d10b5cf56e))
2023-08-06 15:44:55 +00:00
LisoUseInAIKyrios
d10b5cf56e fix(YouTube - Client spoof): Adjust spoof signature settings description (#2760) 2023-08-06 19:42:13 +04:00
8 changed files with 123 additions and 76 deletions

View File

@@ -1,3 +1,31 @@
# [2.188.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.8...v2.188.0-dev.9) (2023-08-07)
### Features
* **YouTube - Hide video action buttons:** Hide individual action buttons ([#2723](https://github.com/ReVanced/revanced-patches/issues/2723)) ([220f694](https://github.com/ReVanced/revanced-patches/commit/220f694b12e7ed013753c8215d181936ab2205c3))
# [2.188.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.7...v2.188.0-dev.8) (2023-08-07)
### Features
* **Change package name:** Append `.revanced` to package name by default ([#2750](https://github.com/ReVanced/revanced-patches/issues/2750)) ([e83e62f](https://github.com/ReVanced/revanced-patches/commit/e83e62fc2400caf1c5179d25e0ac4fbd51ddba00))
# [2.188.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.6...v2.188.0-dev.7) (2023-08-07)
### Features
* **YouTube - Debug:** Logging of layout proto buffer strings ([#2759](https://github.com/ReVanced/revanced-patches/issues/2759)) ([189f719](https://github.com/ReVanced/revanced-patches/commit/189f719720551f36c6e006c45558fe5ae46ca4f8))
# [2.188.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.5...v2.188.0-dev.6) (2023-08-06)
### Bug Fixes
* **YouTube - Client spoof:** Adjust spoof signature settings description ([#2760](https://github.com/ReVanced/revanced-patches/issues/2760)) ([f71d893](https://github.com/ReVanced/revanced-patches/commit/f71d8937663fdbfc93d8e3ce1cdb47e1667554f0))
# [2.188.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.4...v2.188.0-dev.5) (2023-08-04)

View File

@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 2.188.0-dev.5
version = 2.188.0-dev.9

File diff suppressed because one or more lines are too long

View File

@@ -9,39 +9,43 @@ import org.w3c.dom.Element
@Patch(false)
@Name("Change package name")
@Description("Changes the package name.")
@Description("Changes the package name. Appends \".revanced\" to the package name by default.")
class ChangePackageNamePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
packageName?.let { packageName ->
val packageNameRegex = Regex("^[a-z]\\w*(\\.[a-z]\\w*)+\$")
if (!packageName.matches(packageNameRegex))
return PatchResultError("Invalid package name")
val packageNameToUse = packageName ?: getDefaultPackageName(context)
var originalPackageName: String
context.xmlEditor["AndroidManifest.xml"].use { editor ->
val manifest = editor.file.getElementsByTagName("manifest").item(0) as Element
originalPackageName = manifest.getAttribute("package")
}
val packageNameRegex = Regex("^[a-z]\\w*(\\.[a-z]\\w*)+\$")
if (!packageNameToUse.matches(packageNameRegex))
return PatchResultError("Invalid package name")
if (!originalPackageName.matches(packageNameRegex))
return PatchResultError("Failed to get the original package name")
val originalPackageName = getOriginalPackageName(context)
context["AndroidManifest.xml"].apply {
readText().replace(originalPackageName, packageName).let(::writeText)
}
} ?: return PatchResultError("No package name provided")
context["AndroidManifest.xml"].apply {
readText().replace(originalPackageName, packageNameToUse).let(::writeText)
}
return PatchResultSuccess()
}
private fun getDefaultPackageName(context: ResourceContext): String {
val originalPackageName = getOriginalPackageName(context)
return "$originalPackageName.revanced"
}
private fun getOriginalPackageName(context: ResourceContext): String {
context.xmlEditor["AndroidManifest.xml"].use { editor ->
val manifest = editor.file.getElementsByTagName("manifest").item(0) as Element
return manifest.getAttribute("package")
}
}
companion object : OptionsContainer() {
var packageName: String? by option(
PatchOption.StringOption(
key = "packageName",
default = null,
title = "Package name",
description = "The name of the package to rename of the app.",
description = "The name of the package to rename the app to.",
)
)
}

View File

@@ -34,6 +34,30 @@ class HideButtonsPatch : ResourcePatch {
StringResource("revanced_hide_like_dislike_button_summary_on", "Like and dislike buttons are hidden"),
StringResource("revanced_hide_like_dislike_button_summary_off", "Like and dislike buttons are shown")
),
SwitchPreference(
"revanced_hide_live_chat_button",
StringResource("revanced_hide_live_chat_button_title", "Hide live chat button"),
StringResource("revanced_hide_live_chat_button_summary_on", "Live chat button is hidden"),
StringResource("revanced_hide_live_chat_button_summary_off", "Live chat button is shown")
),
SwitchPreference(
"revanced_hide_share_button",
StringResource("revanced_hide_share_button_title", "Hide share button"),
StringResource("revanced_hide_share_button_summary_on", "Share button is hidden"),
StringResource("revanced_hide_share_button_summary_off", "Share button is shown")
),
SwitchPreference(
"revanced_hide_report_button",
StringResource("revanced_hide_report_button_title", "Hide report button"),
StringResource("revanced_hide_report_button_summary_on", "Report button is hidden"),
StringResource("revanced_hide_report_button_summary_off", "Report button is shown")
),
SwitchPreference(
"revanced_hide_remix_button",
StringResource("revanced_hide_remix_button_title", "Hide remix button"),
StringResource("revanced_hide_remix_button_summary_on", "Remix button is hidden"),
StringResource("revanced_hide_remix_button_summary_off", "Remix button is shown")
),
SwitchPreference(
"revanced_hide_download_button",
StringResource("revanced_hide_download_button_title", "Hide download button"),
@@ -41,24 +65,28 @@ class HideButtonsPatch : ResourcePatch {
StringResource("revanced_hide_download_button_summary_off", "Download button is shown")
),
SwitchPreference(
"revanced_hide_playlist_button",
StringResource("revanced_hide_playlist_button_title", "Hide playlist button"),
StringResource("revanced_hide_playlist_button_summary_on", "Playlist button is hidden"),
StringResource("revanced_hide_playlist_button_summary_off", "Playlist button is shown")
"revanced_hide_thanks_button",
StringResource("revanced_hide_thanks_button_title", "Hide thanks button"),
StringResource("revanced_hide_thanks_button_summary_on", "Thanks button is hidden"),
StringResource("revanced_hide_thanks_button_summary_off", "Thanks button is shown")
),
SwitchPreference(
"revanced_hide_clip_button",
StringResource("revanced_hide_clip_button_title", "Hide clip button"),
StringResource("revanced_hide_clip_button_summary_on", "Clip button is hidden"),
StringResource("revanced_hide_clip_button_summary_off", "Clip button is shown"),
StringResource("revanced_hide_clip_button_user_dialog_message",
"Hiding the clip button might not work reliably. In the case it does not work, it can only be hidden by enabling \\'Hide all other action buttons\\'")
),
SwitchPreference(
"revanced_hide_action_buttons",
StringResource("revanced_hide_action_buttons_title", "Hide all other action buttons"),
StringResource("revanced_hide_action_buttons_summary_on", "Share, remix, thanks, shop, live chat buttons are hidden"),
StringResource("revanced_hide_action_buttons_summary_off", "Share, remix, thanks, shop, live chat buttons are shown")
"revanced_hide_playlist_button",
StringResource("revanced_hide_playlist_button_title", "Hide save to playlist button"),
StringResource("revanced_hide_playlist_button_summary_on", "Save button is hidden"),
StringResource("revanced_hide_playlist_button_summary_off", "Save button is shown")
),
SwitchPreference(
"revanced_hide_shop_button",
StringResource("revanced_hide_shop_button_title", "Hide shop button"),
StringResource("revanced_hide_shop_button_summary_on", "Shop button is hidden"),
StringResource("revanced_hide_shop_button_summary_off", "Shop button is shown")
)
),
StringResource("revanced_hide_buttons_preference_screen_summary", "Hide or show buttons under videos")

View File

@@ -32,6 +32,15 @@ class DebuggingPatch : ResourcePatch {
StringResource("revanced_debug_summary_on", "Debug logs are enabled"),
StringResource("revanced_debug_summary_off", "Debug logs are disabled")
),
SwitchPreference(
"revanced_debug_protobuffer",
StringResource(
"revanced_debug_protobuffer_title",
"Log protocol buffer"
),
StringResource("revanced_debug_protobuffer_summary_on", "Debug logs include proto buffer"),
StringResource("revanced_debug_protobuffer_summary_off", "Debug logs do not include proto buffer")
),
SwitchPreference(
"revanced_debug_stacktrace",
StringResource(

View File

@@ -23,11 +23,11 @@ class SpoofSignatureVerificationResourcePatch : ResourcePatch {
"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"),
+ "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 may cause playback issues.")
"If you do not have a YouTube Premium subscription,\\n\\nthen turning off this setting will cause video playback issues.")
)
)

View File

@@ -9,23 +9,19 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.litho.filter.fingerprints.*
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
import org.jf.dexlib2.iface.instruction.Instruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.immutable.ImmutableField
import java.io.Closeable
@DependsOn([IntegrationsPatch::class])
@@ -41,32 +37,29 @@ class LithoFilterPatch : BytecodePatch(
* Additionally, the method contains a reference to the components identifier.
* The identifier is used to filter components by their identifier.
*
* In addition to that, a static field is added to the class of this method. (See protobufBufferField).
* This field holds a reference to the protobuf buffer object.
* The field is being set in another method that holds a reference to the protobuf buffer object.
* The object contains a large byte array that represents the component tree.
* The protobuf buffer is passed along from a different injection point before the filtering occurs.
* The buffer is a large byte array that represents the component tree.
* This byte array is searched for strings that indicate the current component.
*
* The following pseudo code shows how the patch works:
*
* class ComponentContextParser {
* public static ByteBuffer buffer; // Inserted by this patch.
*
* public ComponentContext parseBytesToComponentContext(...) {
* ...
* if (filter(identifier, pathBuilder, buffer)); // Inserted by this patch.
* return emptyComponent;
* ...
* }
* }
*
* class SomeOtherClass {
* // Called before ComponentContextParser.parseBytesToComponentContext method.
* public void someOtherMethod(ByteBuffer byteBuffer) {
* ComponentContextParser.buffer = byteBuffer; // Inserted by this patch.
* IntegrationsClass.setProtoBuffer(byteBuffer); // Inserted by this patch.
* ...
* }
* }
*
* class ComponentContextParser {
*
* public ComponentContext parseBytesToComponentContext(...) {
* ...
* if (IntegrationsClass.filter(identifier, pathBuilder)); // Inserted by this patch.
* return emptyComponent;
* ...
* }
* }
*/
override fun execute(context: BytecodeContext): PatchResult {
ComponentContextParserFingerprint.result?.also {
@@ -78,21 +71,12 @@ class LithoFilterPatch : BytecodePatch(
return fingerprint.toErrorResult()
}
}?.let { bytesToComponentContextMethod ->
// region Add a static field that holds a reference to the protobuf buffer object.
val protobufBufferField = ImmutableField(
bytesToComponentContextMethod.mutableClass.type,
"buffer",
"Ljava/nio/ByteBuffer;",
AccessFlags.PUBLIC or AccessFlags.STATIC,
null,
null,
null
).toMutable()
bytesToComponentContextMethod.mutableClass.staticFields.add(protobufBufferField)
// Set the field with the reference to the protobuf buffer object.
// region Pass the buffer into Integrations.
ProtobufBufferReferenceFingerprint.result
?.mutableMethod?.addInstruction(0, "sput-object p2, $protobufBufferField")
?.mutableMethod?.addInstruction(0,
" invoke-static { p2 }, $INTEGRATIONS_CLASS_DESCRIPTOR->setProtoBuffer(Ljava/nio/ByteBuffer;)V")
?: return ProtobufBufferReferenceFingerprint.toErrorResult()
// endregion
@@ -135,17 +119,13 @@ class LithoFilterPatch : BytecodePatch(
// region Patch the method.
// Insert the instructions that are responsible
// to return an EmptyComponent instead of the original component if the filter method returns false.
// to return an EmptyComponent instead of the original component if the filter method returns true.
addInstructionsWithLabels(
insertHookIndex,
"""
# Register "free1" holds the protobuf buffer object
sget-object v$free1, $protobufBufferField
# Invoke the filter method.
invoke-static { v$stringBuilderRegister, v$identifierRegister, v$free1 }, $FILTER_METHOD_DESCRIPTOR
invoke-static { v$identifierRegister, v$stringBuilderRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->filter(Ljava/lang/String;Ljava/lang/StringBuilder;)Z
move-result v$free1
if-eqz v$free1, :unfiltered
@@ -197,9 +177,7 @@ class LithoFilterPatch : BytecodePatch(
private val Instruction.descriptor
get() = (this as ReferenceInstruction).reference.toString()
private const val FILTER_METHOD_DESCRIPTOR =
"Lapp/revanced/integrations/patches/components/LithoFilterPatch;" +
"->filter(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/nio/ByteBuffer;)Z"
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/LithoFilterPatch;"
internal lateinit var addFilter: (String) -> Unit
private set