mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-14 13:27:17 +02:00
chore: lint code
This commit is contained in:
parent
63578407d7
commit
bca9ca9570
@ -2,19 +2,22 @@ package app.revanced.patches.music.general.branding.name
|
|||||||
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patcher.patch.PatchException
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||||
|
import app.revanced.patches.music.utils.integrations.Constants.LANGUAGE_LIST
|
||||||
|
import app.revanced.patches.shared.patch.elements.AbstractRemoveStringsElementsPatch
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Custom branding name YouTube Music",
|
name = "Custom branding name YouTube Music",
|
||||||
description = "Rename the YouTube Music app to the name specified in options.json.",
|
description = "Rename the YouTube Music app to the name specified in options.json.",
|
||||||
dependencies = [RemoveElementsPatch::class],
|
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object CustomBrandingNamePatch : ResourcePatch() {
|
object CustomBrandingNamePatch : AbstractRemoveStringsElementsPatch(
|
||||||
|
LANGUAGE_LIST,
|
||||||
|
arrayOf("app_launcher_name", "app_name")
|
||||||
|
) {
|
||||||
private const val APP_NAME_NOTIFICATION = "ReVanced Extended Music"
|
private const val APP_NAME_NOTIFICATION = "ReVanced Extended Music"
|
||||||
private const val APP_NAME_LAUNCHER = "RVX Music"
|
private const val APP_NAME_LAUNCHER = "RVX Music"
|
||||||
|
|
||||||
@ -43,6 +46,7 @@ object CustomBrandingNamePatch : ResourcePatch() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
|
super.execute(context)
|
||||||
|
|
||||||
AppNameNotification?.let { notificationName ->
|
AppNameNotification?.let { notificationName ->
|
||||||
AppNameLauncher?.let { launcherName ->
|
AppNameLauncher?.let { launcherName ->
|
||||||
|
@ -1,121 +0,0 @@
|
|||||||
package app.revanced.patches.music.general.branding.name
|
|
||||||
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import kotlin.io.path.exists
|
|
||||||
|
|
||||||
object RemoveElementsPatch : ResourcePatch() {
|
|
||||||
override fun execute(context: ResourceContext) {
|
|
||||||
|
|
||||||
LANGUAGE_LIST.forEach { path ->
|
|
||||||
val resDirectory = context["res"]
|
|
||||||
val targetXmlPath = resDirectory.resolve(path).resolve("strings.xml").toPath()
|
|
||||||
|
|
||||||
if (targetXmlPath.exists()) {
|
|
||||||
val targetXml = context["res/$path/strings.xml"]
|
|
||||||
|
|
||||||
targetXml.writeText(
|
|
||||||
targetXml.readText()
|
|
||||||
.replace(""".+"app_launcher_name".+""".toRegex(), "")
|
|
||||||
.replace(""".+"app_name".+""".toRegex(), "")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private val LANGUAGE_LIST = arrayOf(
|
|
||||||
"values",
|
|
||||||
"values-af",
|
|
||||||
"values-am",
|
|
||||||
"values-ar",
|
|
||||||
"values-ar-rXB",
|
|
||||||
"values-as",
|
|
||||||
"values-az",
|
|
||||||
"values-b+es+419",
|
|
||||||
"values-b+sr+Latn",
|
|
||||||
"values-be",
|
|
||||||
"values-bg",
|
|
||||||
"values-bn",
|
|
||||||
"values-bs",
|
|
||||||
"values-ca",
|
|
||||||
"values-cs",
|
|
||||||
"values-da",
|
|
||||||
"values-de",
|
|
||||||
"values-el",
|
|
||||||
"values-en-rAU",
|
|
||||||
"values-en-rCA",
|
|
||||||
"values-en-rGB",
|
|
||||||
"values-en-rIN",
|
|
||||||
"values-en-rXA",
|
|
||||||
"values-en-rXC",
|
|
||||||
"values-es",
|
|
||||||
"values-es-rUS",
|
|
||||||
"values-et",
|
|
||||||
"values-eu",
|
|
||||||
"values-fa",
|
|
||||||
"values-fi",
|
|
||||||
"values-fr",
|
|
||||||
"values-fr-rCA",
|
|
||||||
"values-gl",
|
|
||||||
"values-gu",
|
|
||||||
"values-hi",
|
|
||||||
"values-hr",
|
|
||||||
"values-hu",
|
|
||||||
"values-hy",
|
|
||||||
"values-id",
|
|
||||||
"values-in",
|
|
||||||
"values-is",
|
|
||||||
"values-it",
|
|
||||||
"values-iw",
|
|
||||||
"values-ja",
|
|
||||||
"values-ka",
|
|
||||||
"values-kk",
|
|
||||||
"values-km",
|
|
||||||
"values-kn",
|
|
||||||
"values-ko",
|
|
||||||
"values-ky",
|
|
||||||
"values-lo",
|
|
||||||
"values-lt",
|
|
||||||
"values-lv",
|
|
||||||
"values-mk",
|
|
||||||
"values-ml",
|
|
||||||
"values-mn",
|
|
||||||
"values-mr",
|
|
||||||
"values-ms",
|
|
||||||
"values-my",
|
|
||||||
"values-nb",
|
|
||||||
"values-ne",
|
|
||||||
"values-nl",
|
|
||||||
"values-no",
|
|
||||||
"values-or",
|
|
||||||
"values-pa",
|
|
||||||
"values-pl",
|
|
||||||
"values-pt",
|
|
||||||
"values-pt-rBR",
|
|
||||||
"values-pt-rPT",
|
|
||||||
"values-ro",
|
|
||||||
"values-ru",
|
|
||||||
"values-si",
|
|
||||||
"values-sk",
|
|
||||||
"values-sl",
|
|
||||||
"values-sq",
|
|
||||||
"values-sr",
|
|
||||||
"values-sv",
|
|
||||||
"values-sw",
|
|
||||||
"values-ta",
|
|
||||||
"values-te",
|
|
||||||
"values-th",
|
|
||||||
"values-tl",
|
|
||||||
"values-tr",
|
|
||||||
"values-uk",
|
|
||||||
"values-ur",
|
|
||||||
"values-uz",
|
|
||||||
"values-vi",
|
|
||||||
"values-zh",
|
|
||||||
"values-zh-rCN",
|
|
||||||
"values-zh-rHK",
|
|
||||||
"values-zh-rTW",
|
|
||||||
"values-zu"
|
|
||||||
)
|
|
||||||
}
|
|
@ -18,12 +18,7 @@ import app.revanced.patches.shared.patch.tracking.AbstractSanitizeUrlQueryPatch
|
|||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SanitizeUrlQueryPatch : AbstractSanitizeUrlQueryPatch(
|
object SanitizeUrlQueryPatch : AbstractSanitizeUrlQueryPatch(
|
||||||
"$MISC_PATH/SanitizeUrlQueryPatch;",
|
"$MISC_PATH/SanitizeUrlQueryPatch;"
|
||||||
listOf(
|
|
||||||
CopyTextEndpointFingerprint,
|
|
||||||
ShareLinkFormatterFingerprint
|
|
||||||
),
|
|
||||||
null
|
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
super.execute(context)
|
super.execute(context)
|
||||||
|
@ -23,4 +23,99 @@ object Constants {
|
|||||||
const val GENERAL = "$GENERAL_PATH/GeneralPatch;"
|
const val GENERAL = "$GENERAL_PATH/GeneralPatch;"
|
||||||
const val NAVIGATION = "$NAVIGATION_PATH/NavigationPatch;"
|
const val NAVIGATION = "$NAVIGATION_PATH/NavigationPatch;"
|
||||||
const val PLAYER = "$PLAYER_PATH/PlayerPatch;"
|
const val PLAYER = "$PLAYER_PATH/PlayerPatch;"
|
||||||
|
|
||||||
|
val LANGUAGE_LIST = arrayOf(
|
||||||
|
"values",
|
||||||
|
"values-af",
|
||||||
|
"values-am",
|
||||||
|
"values-ar",
|
||||||
|
"values-ar-rXB",
|
||||||
|
"values-as",
|
||||||
|
"values-az",
|
||||||
|
"values-b+es+419",
|
||||||
|
"values-b+sr+Latn",
|
||||||
|
"values-be",
|
||||||
|
"values-bg",
|
||||||
|
"values-bn",
|
||||||
|
"values-bs",
|
||||||
|
"values-ca",
|
||||||
|
"values-cs",
|
||||||
|
"values-da",
|
||||||
|
"values-de",
|
||||||
|
"values-el",
|
||||||
|
"values-en-rAU",
|
||||||
|
"values-en-rCA",
|
||||||
|
"values-en-rGB",
|
||||||
|
"values-en-rIN",
|
||||||
|
"values-en-rXA",
|
||||||
|
"values-en-rXC",
|
||||||
|
"values-es",
|
||||||
|
"values-es-rUS",
|
||||||
|
"values-et",
|
||||||
|
"values-eu",
|
||||||
|
"values-fa",
|
||||||
|
"values-fi",
|
||||||
|
"values-fr",
|
||||||
|
"values-fr-rCA",
|
||||||
|
"values-gl",
|
||||||
|
"values-gu",
|
||||||
|
"values-hi",
|
||||||
|
"values-hr",
|
||||||
|
"values-hu",
|
||||||
|
"values-hy",
|
||||||
|
"values-id",
|
||||||
|
"values-in",
|
||||||
|
"values-is",
|
||||||
|
"values-it",
|
||||||
|
"values-iw",
|
||||||
|
"values-ja",
|
||||||
|
"values-ka",
|
||||||
|
"values-kk",
|
||||||
|
"values-km",
|
||||||
|
"values-kn",
|
||||||
|
"values-ko",
|
||||||
|
"values-ky",
|
||||||
|
"values-lo",
|
||||||
|
"values-lt",
|
||||||
|
"values-lv",
|
||||||
|
"values-mk",
|
||||||
|
"values-ml",
|
||||||
|
"values-mn",
|
||||||
|
"values-mr",
|
||||||
|
"values-ms",
|
||||||
|
"values-my",
|
||||||
|
"values-nb",
|
||||||
|
"values-ne",
|
||||||
|
"values-nl",
|
||||||
|
"values-no",
|
||||||
|
"values-or",
|
||||||
|
"values-pa",
|
||||||
|
"values-pl",
|
||||||
|
"values-pt",
|
||||||
|
"values-pt-rBR",
|
||||||
|
"values-pt-rPT",
|
||||||
|
"values-ro",
|
||||||
|
"values-ru",
|
||||||
|
"values-si",
|
||||||
|
"values-sk",
|
||||||
|
"values-sl",
|
||||||
|
"values-sq",
|
||||||
|
"values-sr",
|
||||||
|
"values-sv",
|
||||||
|
"values-sw",
|
||||||
|
"values-ta",
|
||||||
|
"values-te",
|
||||||
|
"values-th",
|
||||||
|
"values-tl",
|
||||||
|
"values-tr",
|
||||||
|
"values-uk",
|
||||||
|
"values-ur",
|
||||||
|
"values-uz",
|
||||||
|
"values-vi",
|
||||||
|
"values-zh",
|
||||||
|
"values-zh-rCN",
|
||||||
|
"values-zh-rHK",
|
||||||
|
"values-zh-rTW",
|
||||||
|
"values-zu"
|
||||||
|
)
|
||||||
}
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package app.revanced.patches.shared.patch.elements
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import kotlin.io.path.exists
|
||||||
|
|
||||||
|
abstract class AbstractRemoveStringsElementsPatch(
|
||||||
|
private val paths: Array<String>,
|
||||||
|
private val replacements: Array<String>
|
||||||
|
) : ResourcePatch() {
|
||||||
|
override fun execute(context: ResourceContext) {
|
||||||
|
paths.forEach { path ->
|
||||||
|
val resDirectory = context["res"]
|
||||||
|
val targetXmlPath = resDirectory.resolve(path).resolve("strings.xml").toPath()
|
||||||
|
|
||||||
|
if (targetXmlPath.exists()) {
|
||||||
|
val targetXml = context["res/$path/strings.xml"]
|
||||||
|
|
||||||
|
replacements.forEach replacementsLoop@{ replacement ->
|
||||||
|
targetXml.writeText(
|
||||||
|
targetXml.readText()
|
||||||
|
.replace(""".+"$replacement".+""".toRegex(), "")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,21 +3,50 @@ package app.revanced.patches.shared.patch.tracking
|
|||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patches.shared.fingerprints.tracking.CopyTextEndpointFingerprint
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
|
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
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
abstract class AbstractSanitizeUrlQueryPatch(
|
abstract class AbstractSanitizeUrlQueryPatch(
|
||||||
private val descriptor: String,
|
private val descriptor: String,
|
||||||
private val sharedFingerprints: List<MethodFingerprint>,
|
private val additionalFingerprints: Set<MethodFingerprint> = emptySet()
|
||||||
private val additionalFingerprints: List<MethodFingerprint>? = null
|
|
||||||
) : BytecodePatch(
|
) : BytecodePatch(
|
||||||
buildSet {
|
buildSet {
|
||||||
addAll(sharedFingerprints)
|
add(CopyTextEndpointFingerprint)
|
||||||
additionalFingerprints?.let(::addAll)
|
additionalFingerprints.let(::addAll)
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
private fun MethodFingerprint.additionalInvoke() {
|
||||||
|
result?.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}}, "
|
||||||
|
+ "$descriptor->stripQueryParameters(Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: throw exception
|
||||||
|
}
|
||||||
|
|
||||||
private fun MethodFingerprint.invoke() {
|
private fun MethodFingerprint.invoke() {
|
||||||
result?.let {
|
result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
@ -35,7 +64,12 @@ abstract class AbstractSanitizeUrlQueryPatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
for (fingerprint in sharedFingerprints)
|
CopyTextEndpointFingerprint.invoke()
|
||||||
fingerprint.invoke()
|
|
||||||
|
if (additionalFingerprints.isNotEmpty()) {
|
||||||
|
additionalFingerprints.forEach { fingerprint ->
|
||||||
|
fingerprint.additionalInvoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,20 +2,18 @@ package app.revanced.patches.youtube.layout.branding.name
|
|||||||
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patcher.patch.PatchException
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||||
|
import app.revanced.patches.shared.patch.elements.AbstractRemoveStringsElementsPatch
|
||||||
|
import app.revanced.patches.youtube.utils.integrations.Constants.LANGUAGE_LIST
|
||||||
import app.revanced.patches.youtube.utils.settings.ResourceUtils.updatePatchStatusLabel
|
import app.revanced.patches.youtube.utils.settings.ResourceUtils.updatePatchStatusLabel
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Custom branding name YouTube",
|
name = "Custom branding name YouTube",
|
||||||
description = "Rename the YouTube app to the name specified in options.json.",
|
description = "Rename the YouTube app to the name specified in options.json.",
|
||||||
dependencies = [
|
dependencies = [SettingsPatch::class],
|
||||||
RemoveElementsPatch::class,
|
|
||||||
SettingsPatch::class
|
|
||||||
],
|
|
||||||
compatiblePackages = [
|
compatiblePackages = [
|
||||||
CompatiblePackage(
|
CompatiblePackage(
|
||||||
"com.google.android.youtube",
|
"com.google.android.youtube",
|
||||||
@ -44,7 +42,10 @@ import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object CustomBrandingNamePatch : ResourcePatch() {
|
object CustomBrandingNamePatch : AbstractRemoveStringsElementsPatch(
|
||||||
|
LANGUAGE_LIST,
|
||||||
|
arrayOf("application_name")
|
||||||
|
) {
|
||||||
private const val APP_NAME = "ReVanced Extended"
|
private const val APP_NAME = "ReVanced Extended"
|
||||||
|
|
||||||
private val AppName by stringPatchOption(
|
private val AppName by stringPatchOption(
|
||||||
@ -60,6 +61,7 @@ object CustomBrandingNamePatch : ResourcePatch() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
|
super.execute(context)
|
||||||
|
|
||||||
AppName?.let {
|
AppName?.let {
|
||||||
context.xmlEditor["res/values/strings.xml"].use { editor ->
|
context.xmlEditor["res/values/strings.xml"].use { editor ->
|
||||||
|
@ -1,111 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.branding.name
|
|
||||||
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import kotlin.io.path.exists
|
|
||||||
|
|
||||||
object RemoveElementsPatch : ResourcePatch() {
|
|
||||||
override fun execute(context: ResourceContext) {
|
|
||||||
|
|
||||||
LANGUAGE_LIST.forEach { path ->
|
|
||||||
val resDirectory = context["res"]
|
|
||||||
val targetXmlPath = resDirectory.resolve(path).resolve("strings.xml").toPath()
|
|
||||||
|
|
||||||
if (targetXmlPath.exists()) {
|
|
||||||
val targetXml = context["res/$path/strings.xml"]
|
|
||||||
|
|
||||||
targetXml.writeText(
|
|
||||||
targetXml.readText()
|
|
||||||
.replace(""".+"application_name".+""".toRegex(), "")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private val LANGUAGE_LIST = arrayOf(
|
|
||||||
"values",
|
|
||||||
"values-af",
|
|
||||||
"values-am",
|
|
||||||
"values-ar",
|
|
||||||
"values-as",
|
|
||||||
"values-az",
|
|
||||||
"values-b+sr+Latn",
|
|
||||||
"values-be",
|
|
||||||
"values-bg",
|
|
||||||
"values-bn",
|
|
||||||
"values-bs",
|
|
||||||
"values-ca",
|
|
||||||
"values-cs",
|
|
||||||
"values-da",
|
|
||||||
"values-de",
|
|
||||||
"values-el",
|
|
||||||
"values-en-rGB",
|
|
||||||
"values-en-rIN",
|
|
||||||
"values-es",
|
|
||||||
"values-es-rUS",
|
|
||||||
"values-et",
|
|
||||||
"values-eu",
|
|
||||||
"values-fa",
|
|
||||||
"values-fi",
|
|
||||||
"values-fr",
|
|
||||||
"values-fr-rCA",
|
|
||||||
"values-gl",
|
|
||||||
"values-gu",
|
|
||||||
"values-hi",
|
|
||||||
"values-hr",
|
|
||||||
"values-hu",
|
|
||||||
"values-hy",
|
|
||||||
"values-in",
|
|
||||||
"values-is",
|
|
||||||
"values-it",
|
|
||||||
"values-iw",
|
|
||||||
"values-ja",
|
|
||||||
"values-ka",
|
|
||||||
"values-kk",
|
|
||||||
"values-km",
|
|
||||||
"values-kn",
|
|
||||||
"values-ko",
|
|
||||||
"values-ky",
|
|
||||||
"values-lo",
|
|
||||||
"values-lt",
|
|
||||||
"values-lv",
|
|
||||||
"values-mk",
|
|
||||||
"values-ml",
|
|
||||||
"values-mn",
|
|
||||||
"values-mr",
|
|
||||||
"values-ms",
|
|
||||||
"values-my",
|
|
||||||
"values-nb",
|
|
||||||
"values-ne",
|
|
||||||
"values-nl",
|
|
||||||
"values-or",
|
|
||||||
"values-pa",
|
|
||||||
"values-pl",
|
|
||||||
"values-pt",
|
|
||||||
"values-pt-rBR",
|
|
||||||
"values-pt-rPT",
|
|
||||||
"values-ro",
|
|
||||||
"values-ru",
|
|
||||||
"values-si",
|
|
||||||
"values-sk",
|
|
||||||
"values-sl",
|
|
||||||
"values-sq",
|
|
||||||
"values-sr",
|
|
||||||
"values-sv",
|
|
||||||
"values-sw",
|
|
||||||
"values-ta",
|
|
||||||
"values-te",
|
|
||||||
"values-th",
|
|
||||||
"values-tl",
|
|
||||||
"values-tr",
|
|
||||||
"values-uk",
|
|
||||||
"values-ur",
|
|
||||||
"values-uz",
|
|
||||||
"values-vi",
|
|
||||||
"values-zh-rCN",
|
|
||||||
"values-zh-rHK",
|
|
||||||
"values-zh-rTW",
|
|
||||||
"values-zu"
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,20 +1,13 @@
|
|||||||
package app.revanced.patches.youtube.misc.tracking
|
package app.revanced.patches.youtube.misc.tracking
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.shared.fingerprints.tracking.CopyTextEndpointFingerprint
|
|
||||||
import app.revanced.patches.shared.patch.tracking.AbstractSanitizeUrlQueryPatch
|
import app.revanced.patches.shared.patch.tracking.AbstractSanitizeUrlQueryPatch
|
||||||
import app.revanced.patches.youtube.misc.tracking.fingerprints.ShareLinkFormatterFingerprint
|
import app.revanced.patches.youtube.misc.tracking.fingerprints.ShareLinkFormatterFingerprint
|
||||||
import app.revanced.patches.youtube.misc.tracking.fingerprints.SystemShareLinkFormatterFingerprint
|
import app.revanced.patches.youtube.misc.tracking.fingerprints.SystemShareLinkFormatterFingerprint
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH
|
import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
import app.revanced.util.exception
|
|
||||||
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
|
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Sanitize sharing links",
|
name = "Sanitize sharing links",
|
||||||
@ -50,47 +43,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
|||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SanitizeUrlQueryPatch : AbstractSanitizeUrlQueryPatch(
|
object SanitizeUrlQueryPatch : AbstractSanitizeUrlQueryPatch(
|
||||||
"$MISC_PATH/SanitizeUrlQueryPatch;",
|
"$MISC_PATH/SanitizeUrlQueryPatch;",
|
||||||
listOf(CopyTextEndpointFingerprint),
|
setOf(
|
||||||
listOf(
|
|
||||||
ShareLinkFormatterFingerprint,
|
ShareLinkFormatterFingerprint,
|
||||||
SystemShareLinkFormatterFingerprint
|
SystemShareLinkFormatterFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
|
||||||
"$MISC_PATH/SanitizeUrlQueryPatch;"
|
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
super.execute(context)
|
super.execute(context)
|
||||||
|
|
||||||
arrayOf(
|
|
||||||
ShareLinkFormatterFingerprint,
|
|
||||||
SystemShareLinkFormatterFingerprint
|
|
||||||
).forEach { fingerprint ->
|
|
||||||
fingerprint.result?.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"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} ?: throw fingerprint.exception
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
|
@ -31,4 +31,90 @@ object Constants {
|
|||||||
const val PLAYER = "$PLAYER_PATH/PlayerPatch;"
|
const val PLAYER = "$PLAYER_PATH/PlayerPatch;"
|
||||||
const val SEEKBAR = "$SEEKBAR_PATH/SeekBarPatch;"
|
const val SEEKBAR = "$SEEKBAR_PATH/SeekBarPatch;"
|
||||||
const val SHORTS = "$SHORTS_PATH/ShortsPatch;"
|
const val SHORTS = "$SHORTS_PATH/ShortsPatch;"
|
||||||
|
|
||||||
|
val LANGUAGE_LIST = arrayOf(
|
||||||
|
"values",
|
||||||
|
"values-af",
|
||||||
|
"values-am",
|
||||||
|
"values-ar",
|
||||||
|
"values-as",
|
||||||
|
"values-az",
|
||||||
|
"values-b+sr+Latn",
|
||||||
|
"values-be",
|
||||||
|
"values-bg",
|
||||||
|
"values-bn",
|
||||||
|
"values-bs",
|
||||||
|
"values-ca",
|
||||||
|
"values-cs",
|
||||||
|
"values-da",
|
||||||
|
"values-de",
|
||||||
|
"values-el",
|
||||||
|
"values-en-rGB",
|
||||||
|
"values-en-rIN",
|
||||||
|
"values-es",
|
||||||
|
"values-es-rUS",
|
||||||
|
"values-et",
|
||||||
|
"values-eu",
|
||||||
|
"values-fa",
|
||||||
|
"values-fi",
|
||||||
|
"values-fr",
|
||||||
|
"values-fr-rCA",
|
||||||
|
"values-gl",
|
||||||
|
"values-gu",
|
||||||
|
"values-hi",
|
||||||
|
"values-hr",
|
||||||
|
"values-hu",
|
||||||
|
"values-hy",
|
||||||
|
"values-in",
|
||||||
|
"values-is",
|
||||||
|
"values-it",
|
||||||
|
"values-iw",
|
||||||
|
"values-ja",
|
||||||
|
"values-ka",
|
||||||
|
"values-kk",
|
||||||
|
"values-km",
|
||||||
|
"values-kn",
|
||||||
|
"values-ko",
|
||||||
|
"values-ky",
|
||||||
|
"values-lo",
|
||||||
|
"values-lt",
|
||||||
|
"values-lv",
|
||||||
|
"values-mk",
|
||||||
|
"values-ml",
|
||||||
|
"values-mn",
|
||||||
|
"values-mr",
|
||||||
|
"values-ms",
|
||||||
|
"values-my",
|
||||||
|
"values-nb",
|
||||||
|
"values-ne",
|
||||||
|
"values-nl",
|
||||||
|
"values-or",
|
||||||
|
"values-pa",
|
||||||
|
"values-pl",
|
||||||
|
"values-pt",
|
||||||
|
"values-pt-rBR",
|
||||||
|
"values-pt-rPT",
|
||||||
|
"values-ro",
|
||||||
|
"values-ru",
|
||||||
|
"values-si",
|
||||||
|
"values-sk",
|
||||||
|
"values-sl",
|
||||||
|
"values-sq",
|
||||||
|
"values-sr",
|
||||||
|
"values-sv",
|
||||||
|
"values-sw",
|
||||||
|
"values-ta",
|
||||||
|
"values-te",
|
||||||
|
"values-th",
|
||||||
|
"values-tl",
|
||||||
|
"values-tr",
|
||||||
|
"values-uk",
|
||||||
|
"values-ur",
|
||||||
|
"values-uz",
|
||||||
|
"values-vi",
|
||||||
|
"values-zh-rCN",
|
||||||
|
"values-zh-rHK",
|
||||||
|
"values-zh-rTW",
|
||||||
|
"values-zu"
|
||||||
|
)
|
||||||
}
|
}
|
@ -63,9 +63,6 @@ object SettingsPatch : AbstractSettingsResourcePatch(
|
|||||||
super.execute(context)
|
super.execute(context)
|
||||||
contexts = context
|
contexts = context
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if YouTube version is higher than v18.28.xx
|
|
||||||
*/
|
|
||||||
val resourceXmlFile = context["res/values/integers.xml"].readBytes()
|
val resourceXmlFile = context["res/values/integers.xml"].readBytes()
|
||||||
|
|
||||||
for (threadIndex in 0 until THREAD_COUNT) {
|
for (threadIndex in 0 until THREAD_COUNT) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user