mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-26 03:42:13 +02:00
feat(YouTube Music): add Sanitize sharing links
patch
This commit is contained in:
parent
4037d9c85b
commit
6451250e47
@ -0,0 +1,48 @@
|
||||
package app.revanced.patches.music.misc.tracking
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.misc.tracking.fingerprints.ShareLinkFormatterFingerprint
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.shared.fingerprints.tracking.CopyTextEndpointFingerprint
|
||||
import app.revanced.patches.shared.patch.tracking.AbstractSanitizeUrlQueryPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
|
||||
@Patch(
|
||||
name = "Sanitize sharing links",
|
||||
description = "Removes tracking query parameters from the URLs when sharing links.",
|
||||
dependencies = [SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.apps.youtube.music",
|
||||
[
|
||||
"6.15.52",
|
||||
"6.20.51",
|
||||
"6.26.51",
|
||||
"6.27.53"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object SanitizeUrlQueryPatch : AbstractSanitizeUrlQueryPatch(
|
||||
"$MUSIC_MISC_PATH/SanitizeUrlQueryPatch;",
|
||||
listOf(
|
||||
CopyTextEndpointFingerprint,
|
||||
ShareLinkFormatterFingerprint
|
||||
),
|
||||
null
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
super.execute(context)
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
"revanced_sanitize_sharing_links",
|
||||
"true"
|
||||
)
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package app.revanced.patches.music.misc.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
|
||||
*/
|
||||
object ShareLinkFormatterFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("L", "Ljava/util/Map;"),
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.GOTO,
|
||||
Opcode.CONST_STRING,
|
||||
Opcode.INVOKE_VIRTUAL
|
||||
),
|
||||
customFingerprint = custom@{ methodDef, _ ->
|
||||
if (methodDef.implementation == null)
|
||||
return@custom false
|
||||
|
||||
var count = 0
|
||||
for (instruction in methodDef.implementation!!.instructions) {
|
||||
if (instruction.opcode != Opcode.SGET_OBJECT)
|
||||
continue
|
||||
|
||||
val objectInstruction = instruction as ReferenceInstruction
|
||||
if ((objectInstruction.reference as FieldReference).name != "androidAppEndpoint")
|
||||
continue
|
||||
|
||||
count++
|
||||
}
|
||||
count == 2
|
||||
}
|
||||
)
|
@ -159,6 +159,8 @@ WARNING: Do not enable new player backgrounds while this is enabled."</string>
|
||||
<string name="revanced_ryd_enabled_summary">Shows the dislike count of videos.</string>
|
||||
<string name="revanced_ryd_failure_client_rate_limit_requested">Dislikes not available (client API limit reached).</string>
|
||||
<string name="revanced_ryd_video_likes_hidden_by_video_owner">Hidden</string>
|
||||
<string name="revanced_sanitize_sharing_links_summary">Removes tracking query parameters from the URLs when sharing links.</string>
|
||||
<string name="revanced_sanitize_sharing_links_title">Sanitize sharing links</string>
|
||||
<string name="revanced_save_playback_speed">Changing default speed to:</string>
|
||||
<string name="revanced_save_video_quality_mobile">Changing default mobile data quality to:</string>
|
||||
<string name="revanced_save_video_quality_none">Failed to set quality.</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user