Skip to content

Commit

Permalink
Merge branch 'dev' into revanced-extended
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Aug 12, 2024
2 parents 6499b7d + 9ec012d commit 2e32741
Show file tree
Hide file tree
Showing 46 changed files with 369 additions and 346 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/build_pull_request.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/discord_ping_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
content: "<@&1271197877724643461>"
title: "Patches `${{ github.event.release.tag_name }}` has been released!"
description: |
Click [here]( ${{github.event.repository.html_url }}/releases/tag/${{ github.event.release.tag_name }}) to read the changelog.
Click [here]( ${{github.event.repository.html_url }}/releases/tag/${{ github.event.release.tag_name }}) to read the changelog.
31 changes: 0 additions & 31 deletions .github/workflows/open_pull_request.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/release.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/update-gradle-wrapper.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ReVanced Extended Patches.
| `Ambient mode control` | Adds options to disable Ambient mode and to bypass Ambient mode restrictions. | 18.29.38 ~ 19.16.39 |
| `Bypass image region restrictions` | Adds an option to use a different host for static images, so that images blocked in some countries can be received. | 18.29.38 ~ 19.16.39 |
| `Change player flyout menu toggles` | Adds an option to use text toggles instead of switch toggles within the additional settings menu. | 18.29.38 ~ 19.16.39 |
| `Change share sheet` | Add option to change from in-app share sheet to system share sheet. | 18.29.38 ~ 19.16.39 |
| `Change start page` | Adds an option to set which page the app opens in instead of the homepage. | 18.29.38 ~ 19.16.39 |
| `Custom Shorts action buttons` | Changes, at compile time, the icon of the action buttons of the Shorts player. | 18.29.38 ~ 19.16.39 |
| `Custom branding icon for YouTube` | Changes the YouTube app icon to the icon specified in options.json. | 18.29.38 ~ 19.16.39 |
Expand Down Expand Up @@ -50,7 +51,7 @@ ReVanced Extended Patches.
| `Navigation bar components` | Adds options to hide or change components related to the navigation bar. | 18.29.38 ~ 19.16.39 |
| `Overlay buttons` | Adds options to display overlay buttons in the video player. | 18.29.38 ~ 19.16.39 |
| `Player components` | Adds options to hide or change components related to the video player. | 18.29.38 ~ 19.16.39 |
| `Remove background playback restrictions` | Removes restrictions on background playback, including playing kids videos in the background. | 18.29.38 ~ 19.16.39 |
| `Remove background playback restrictions` | Removes restrictions on background playback, including for music and kids videos. | 18.29.38 ~ 19.16.39 |
| `Remove viewer discretion dialog` | Adds an option to remove the dialog that appears when opening a video that has been age-restricted by accepting it automatically. This does not bypass the age restriction. | 18.29.38 ~ 19.16.39 |
| `Return YouTube Dislike` | Adds an option to show the dislike count of videos using the Return YouTube Dislike API. | 18.29.38 ~ 19.16.39 |
| `Sanitize sharing links` | Adds an option to remove tracking query parameters from URLs when sharing links. | 18.29.38 ~ 19.16.39 |
Expand Down Expand Up @@ -99,7 +100,7 @@ ReVanced Extended Patches.
| `Hide player overlay filter` | Removes, at compile time, the dark overlay that appears when single-tapping in the player. | 6.29.58 ~ 7.13.52 |
| `Navigation bar components` | Adds options to hide or change components related to the navigation bar. | 6.29.58 ~ 7.13.52 |
| `Player components` | Adds options to hide or change components related to the player. | 6.29.58 ~ 7.13.52 |
| `Remove background playback restrictions` | Removes restrictions on background playback, including playing kids videos in the background. | 6.29.58 ~ 7.13.52 |
| `Remove background playback restrictions` | Removes restrictions on background playback, including for kids videos. | 6.29.58 ~ 7.13.52 |
| `Remove viewer discretion dialog` | Adds an option to remove the dialog that appears when opening a video that has been age-restricted by accepting it automatically. This does not bypass the age restriction. | 6.29.58 ~ 7.13.52 |
| `Restore old style library shelf` | Adds an option to return the Library tab to the old style. | 6.29.58 ~ 7.13.52 |
| `Return YouTube Dislike` | Adds an option to show the dislike count of songs using the Return YouTube Dislike API. | 6.29.58 ~ 7.13.52 |
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 4.12.1
version = 4.12.3
2 changes: 1 addition & 1 deletion patches.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
@Suppress("unused")
object BackgroundPlaybackPatch : BaseBytecodePatch(
name = "Remove background playback restrictions",
description = "Removes restrictions on background playback, including playing kids videos in the background.",
description = "Removes restrictions on background playback, including for kids videos.",
compatiblePackages = COMPATIBLE_PACKAGE,
fingerprints = setOf(
BackgroundPlaybackManagerFingerprint,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.music.utils.settings.CategoryType
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.shared.tracking.BaseSanitizeUrlQueryPatch
import app.revanced.util.patch.BaseResourcePatch

@Suppress("unused")
object SanitizeUrlQueryPatch : BaseResourcePatch(
name = "Sanitize sharing links",
description = "Adds an option to remove tracking query parameters from URLs when sharing links.",
dependencies = setOf(
SanitizeUrlQueryBytecodePatch::class,
BaseSanitizeUrlQueryPatch::class,
SettingsPatch::class
),
compatiblePackages = COMPATIBLE_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,69 @@ package app.revanced.patches.shared.tracking
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.shared.integrations.Constants.PATCHES_PATH
import app.revanced.patches.shared.tracking.fingerprints.CopyTextEndpointFingerprint
import app.revanced.patches.shared.tracking.fingerprints.ShareLinkFormatterFingerprint
import app.revanced.patches.shared.tracking.fingerprints.SystemShareLinkFormatterFingerprint
import app.revanced.util.resultOrThrow
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction

abstract class BaseSanitizeUrlQueryPatch(
private val descriptor: String,
private val sharedFingerprints: List<MethodFingerprint>,
private val additionalFingerprints: List<MethodFingerprint>? = null
) : BytecodePatch(
buildSet {
addAll(sharedFingerprints)
additionalFingerprints?.let(::addAll)
}
object BaseSanitizeUrlQueryPatch : BytecodePatch(
setOf(
CopyTextEndpointFingerprint,
ShareLinkFormatterFingerprint,
SystemShareLinkFormatterFingerprint
)
) {
private fun MethodFingerprint.invoke() {
resultOrThrow().let {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"$PATCHES_PATH/SanitizeUrlQueryPatch;"

override fun execute(context: BytecodeContext) {
CopyTextEndpointFingerprint.resultOrThrow().let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.startIndex
val targetRegister = getInstruction<TwoRegisterInstruction>(targetIndex).registerA

addInstructions(
targetIndex + 2, """
invoke-static {v$targetRegister}, $descriptor->stripQueryParameters(Ljava/lang/String;)Ljava/lang/String;
invoke-static {v$targetRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->stripQueryParameters(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$targetRegister
"""
)
}
}
}

override fun execute(context: BytecodeContext) {
for (fingerprint in sharedFingerprints)
fingerprint.invoke()
arrayOf(
ShareLinkFormatterFingerprint,
SystemShareLinkFormatterFingerprint
).forEach { fingerprint ->
fingerprint.resultOrThrow().let {
it.mutableMethod.apply {
for ((index, instruction) in implementation!!.instructions.withIndex()) {
if (instruction.opcode != Opcode.INVOKE_VIRTUAL)
continue

if ((instruction as ReferenceInstruction).reference.toString() != "Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;")
continue

if (getInstruction(index + 1).opcode != Opcode.GOTO)
continue

val invokeInstruction = instruction as FiveRegisterInstruction

replaceInstruction(
index,
"invoke-static {v${invokeInstruction.registerC}, v${invokeInstruction.registerD}, v${invokeInstruction.registerE}}, "
+ "$INTEGRATIONS_CLASS_DESCRIPTOR->stripQueryParameters(Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;)V"
)
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package app.revanced.patches.music.misc.tracking.fingerprints
package app.revanced.patches.shared.tracking.fingerprints

import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.reference.FieldReference

/**
* Sharing panel of YouTube Music
* Sharing panel
*/
internal object ShareLinkFormatterFingerprint : MethodFingerprint(
returnType = "V",
parameters = listOf("L", "Ljava/util/Map;"),
opcodes = listOf(
Opcode.IGET_OBJECT,
Opcode.CHECK_CAST,
Opcode.GOTO,
Opcode.CONST_STRING,
null,
Opcode.INVOKE_VIRTUAL
),
customFingerprint = custom@{ methodDef, _ ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.tracking.fingerprints
package app.revanced.patches.shared.tracking.fingerprints

import app.revanced.patcher.fingerprint.MethodFingerprint

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Suppress("unused")
object BackgroundPlaybackPatch : BaseBytecodePatch(
name = "Remove background playback restrictions",
description = "Removes restrictions on background playback, including playing kids videos in the background.",
description = "Removes restrictions on background playback, including for music and kids videos.",
dependencies = setOf(
PlayerTypeHookPatch::class,
SettingsPatch::class
Expand Down
Loading

0 comments on commit 2e32741

Please sign in to comment.