fix(YouTube - Spoof app version): Remove broken spoof targets that YouTube no longer supports (#145)

* Drop support for `v18.xx.xx`

* fix: Apply code review suggestions

* fix: Apply code review suggestions

* fix: Apply code review suggestions

---------

Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
This commit is contained in:
Hoàng Gia Bảo
2025-03-22 08:32:46 +07:00
committed by GitHub
parent fd118211a5
commit fec13ad15b
7 changed files with 58 additions and 34 deletions

View File

@ -16,7 +16,7 @@ import app.revanced.patches.youtube.utils.patch.PatchList.SPOOF_APP_VERSION
import app.revanced.patches.youtube.utils.playservice.is_18_34_or_greater
import app.revanced.patches.youtube.utils.playservice.is_18_39_or_greater
import app.revanced.patches.youtube.utils.playservice.is_18_49_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_17_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_01_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_23_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_28_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_34_or_greater
@ -45,6 +45,15 @@ private val spoofAppVersionBytecodePatch = bytecodePatch(
dependsOn(versionCheckPatch)
execute {
if (is_19_01_or_greater) {
findMethodOrThrow(PATCH_STATUS_CLASS_DESCRIPTOR) {
name == "SpoofAppVersionDefaultString"
}.replaceInstruction(
0,
"const-string v0, \"19.01.34\""
)
}
if (!is_19_23_or_greater) {
return@execute
}
@ -72,13 +81,6 @@ private val spoofAppVersionBytecodePatch = bytecodePatch(
""", ExternalLabel("ignore", getInstruction(jumpIndex))
)
}
findMethodOrThrow(PATCH_STATUS_CLASS_DESCRIPTOR) {
name == "SpoofAppVersionDefaultString"
}.replaceInstruction(
0,
"const-string v0, \"18.38.45\""
)
}
}
@ -108,35 +110,43 @@ val spoofAppVersionPatch = resourcePatch(
SPOOF_APP_VERSION
)
if (!is_19_17_or_greater) {
// TODO: Remove this when the legacy code for YouTube 18.xx is cleaned up.
if (!is_19_01_or_greater) {
appendAppVersion("17.41.37")
appendAppVersion("18.05.40")
appendAppVersion("18.17.43")
if (!is_18_34_or_greater) {
if (is_18_34_or_greater) {
appendAppVersion("18.33.40")
} else {
return@execute
}
appendAppVersion("18.33.40")
}
if (!is_18_39_or_greater) {
if (is_18_39_or_greater) {
appendAppVersion("18.38.45")
} else {
return@execute
}
if (is_18_49_or_greater) {
appendAppVersion("18.48.39")
}
return@execute
}
appendAppVersion("18.38.45")
if (!is_18_49_or_greater) {
appendAppVersion("19.01.34")
if (is_19_28_or_greater) {
appendAppVersion("19.26.42")
} else {
return@execute
}
appendAppVersion("18.48.39")
if (!is_19_28_or_greater) {
if (is_19_34_or_greater) {
appendAppVersion("19.33.37")
} else {
return@execute
}
appendAppVersion("19.26.42")
if (!is_19_34_or_greater) {
return@execute
}
appendAppVersion("19.33.37")
}
}

View File

@ -15,7 +15,7 @@ import app.revanced.patches.youtube.utils.extension.Constants.PLAYER_CLASS_DESCR
import app.revanced.patches.youtube.utils.patch.PatchList.DESCRIPTION_COMPONENTS
import app.revanced.patches.youtube.utils.playertype.playerTypeHookPatch
import app.revanced.patches.youtube.utils.playservice.is_18_49_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_02_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_05_or_greater
import app.revanced.patches.youtube.utils.playservice.versionCheckPatch
import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverHook
import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverPatch
@ -93,8 +93,7 @@ val descriptionComponentsPatch = bytecodePatch(
// region patch for disable video description interaction and expand video description
// since these patches are still A/B tested, they are classified as 'Experimental flags'.
if (is_19_02_or_greater) {
if (is_19_05_or_greater) {
textViewComponentFingerprint.methodOrThrow().apply {
val insertIndex = indexOfTextIsSelectableInstruction(this)
val insertInstruction = getInstruction<FiveRegisterInstruction>(insertIndex)

View File

@ -9,7 +9,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
/**
* This fingerprint is compatible with YouTube v18.35.xx~
* Nonetheless, the patch works in YouTube v19.02.xx~
* Nonetheless, the patch works in YouTube v19.05.xx~
*/
internal val textViewComponentFingerprint = legacyFingerprint(
name = "textViewComponentFingerprint",

View File

@ -9,10 +9,6 @@ internal object Constants {
val COMPATIBLE_PACKAGE: Pair<PackageName, Set<VersionName>?> = Pair(
YOUTUBE_PACKAGE_NAME,
setOf(
"18.29.38", // This is the last version where the 'Zoomed to fill' setting works.
"18.33.40", // This is the last version that do not use litho components in Shorts.
"18.38.44", // This is the last version with no delay in applying video quality on the server side.
"18.48.39", // This is the last version that do not use Rolling Number.
"19.05.36", // This is the last version with the least YouTube experimental flag.
"19.16.39", // This is the last version where the 'Restore old seekbar thumbnails' setting works.
"19.44.39", // This is the latest version supported by the RVX patch.

View File

@ -15,10 +15,14 @@ var is_18_42_or_greater = false
private set
var is_18_49_or_greater = false
private set
var is_19_01_or_greater = false
private set
var is_19_02_or_greater = false
private set
var is_19_04_or_greater = false
private set
var is_19_05_or_greater = false
private set
var is_19_09_or_greater = false
private set
var is_19_15_or_greater = false
@ -83,8 +87,10 @@ val versionCheckPatch = resourcePatch(
is_18_39_or_greater = 234000000 <= playStoreServicesVersion
is_18_42_or_greater = 234302000 <= playStoreServicesVersion
is_18_49_or_greater = 235000000 <= playStoreServicesVersion
is_19_02_or_greater = 240204000 < playStoreServicesVersion
is_19_01_or_greater = 240204000 < playStoreServicesVersion
is_19_02_or_greater = 240299000 < playStoreServicesVersion
is_19_04_or_greater = 240502000 <= playStoreServicesVersion
is_19_05_or_greater = 240602000 <= playStoreServicesVersion
is_19_09_or_greater = 241002000 <= playStoreServicesVersion
is_19_15_or_greater = 241602000 <= playStoreServicesVersion
is_19_16_or_greater = 241702000 <= playStoreServicesVersion