From fcff9a2049ff4953600559ffc767f553c8f7fea6 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 23 May 2024 22:42:15 +0200 Subject: [PATCH 1/2] fix(YouTube - Client spoof): Spoof iOS client model to fix various side effects (#638) Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> --- .../revanced/integrations/shared/Utils.java | 2 +- .../patches/spoof/SpoofClientPatch.java | 33 ++++++++++++++----- .../youtube/settings/Settings.java | 2 +- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/shared/Utils.java b/app/src/main/java/app/revanced/integrations/shared/Utils.java index 311e2a62..1e94efdb 100644 --- a/app/src/main/java/app/revanced/integrations/shared/Utils.java +++ b/app/src/main/java/app/revanced/integrations/shared/Utils.java @@ -59,7 +59,7 @@ public class Utils { } /** - * @return The version name of the app, such as "YouTube". + * @return The version name of the app, such as 19.11.43 */ public static String getAppVersionName() { if (versionName == null) { diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/SpoofClientPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/SpoofClientPatch.java index 93c90466..021f7a3a 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/SpoofClientPatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/SpoofClientPatch.java @@ -4,6 +4,7 @@ import static app.revanced.integrations.youtube.patches.spoof.requests.Storyboar import android.net.Uri; +import android.os.Build; import androidx.annotation.Nullable; import java.util.Collections; @@ -22,8 +23,8 @@ import app.revanced.integrations.youtube.settings.Settings; @SuppressWarnings("unused") public class SpoofClientPatch { private static final boolean SPOOF_CLIENT_ENABLED = Settings.SPOOF_CLIENT.get(); - private static final boolean SPOOF_CLIENT_USE_IOS = Settings.SPOOF_CLIENT_USE_IOS.get(); - private static final boolean SPOOF_CLIENT_STORYBOARD = SPOOF_CLIENT_ENABLED && !SPOOF_CLIENT_USE_IOS; + private static final boolean SPOOF_CLIENT_USE_TEST_SUITE = Settings.SPOOF_CLIENT_USE_TESTSUITE.get(); + private static final boolean SPOOF_CLIENT_STORYBOARD = SPOOF_CLIENT_ENABLED && SPOOF_CLIENT_USE_TEST_SUITE; /** * Any unreachable ip address. Used to intentionally fail requests. @@ -46,10 +47,10 @@ public class SpoofClientPatch { /** * Injection point. - * Blocks /get_watch requests by returning a localhost URI. + * Blocks /get_watch requests by returning an unreachable URI. * * @param playerRequestUri The URI of the player request. - * @return Localhost URI if the request is a /get_watch request, otherwise the original URI. + * @return An unreachable URI if the request is a /get_watch request, otherwise the original URI. */ public static Uri blockGetWatchRequest(Uri playerRequestUri) { if (SPOOF_CLIENT_ENABLED) { @@ -102,7 +103,7 @@ public class SpoofClientPatch { } private static ClientType getSpoofClientType() { - if (SPOOF_CLIENT_USE_IOS) { + if (!SPOOF_CLIENT_USE_TEST_SUITE) { return ClientType.IOS; } @@ -147,6 +148,17 @@ public class SpoofClientPatch { return originalClientVersion; } + /** + * Injection point. + */ + public static String getClientModel(String originalClientModel) { + if (SPOOF_CLIENT_ENABLED) { + return getSpoofClientType().model; + } + + return originalClientModel; + } + /** * Injection point. */ @@ -250,14 +262,19 @@ public class SpoofClientPatch { } private enum ClientType { - ANDROID_TESTSUITE(30, "1.9"), - IOS(5, Utils.getAppVersionName()); + ANDROID_TESTSUITE(30, Build.MODEL, "1.9"), + // 16,2 = iPhone 15 Pro Max. + // Version number should be a valid iOS release. + // https://www.ipa4fun.com/history/185230 + IOS(5, "iPhone16,2", "19.10.7"); final int id; + final String model; final String version; - ClientType(int id, String version) { + ClientType(int id, String model, String version) { this.id = id; + this.model = model; this.version = version; } } diff --git a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java index 04a08d41..efd05dda 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java @@ -237,7 +237,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting BYPASS_URL_REDIRECTS = new BooleanSetting("revanced_bypass_url_redirects", TRUE); public static final BooleanSetting ANNOUNCEMENTS = new BooleanSetting("revanced_announcements", TRUE); public static final BooleanSetting SPOOF_CLIENT = new BooleanSetting("revanced_spoof_client", TRUE, true, "revanced_spoof_client_user_dialog_message"); - public static final BooleanSetting SPOOF_CLIENT_USE_IOS = new BooleanSetting("revanced_spoof_client_use_ios", FALSE, true, parent(SPOOF_CLIENT)); + public static final BooleanSetting SPOOF_CLIENT_USE_TESTSUITE = new BooleanSetting("revanced_spoof_client_use_testsuite", FALSE, true, parent(SPOOF_CLIENT)); @Deprecated public static final StringSetting DEPRECATED_ANNOUNCEMENT_LAST_HASH = new StringSetting("revanced_announcement_last_hash", ""); public static final IntegerSetting ANNOUNCEMENT_LAST_ID = new IntegerSetting("revanced_announcement_last_id", -1); From d2e74aca3dc460b4eee1fd721b2825922dbe77cd Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 23 May 2024 20:45:14 +0000 Subject: [PATCH 2/2] chore(release): 1.9.1-dev.1 [skip ci] ## [1.9.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.9.0...v1.9.1-dev.1) (2024-05-23) ### Bug Fixes * **YouTube - Client spoof:** Spoof iOS client model to fix various side effects ([#638](https://github.com/ReVanced/revanced-integrations/issues/638)) ([fcff9a2](https://github.com/ReVanced/revanced-integrations/commit/fcff9a2049ff4953600559ffc767f553c8f7fea6)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f38db3bc..2e8034a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.9.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.9.0...v1.9.1-dev.1) (2024-05-23) + + +### Bug Fixes + +* **YouTube - Client spoof:** Spoof iOS client model to fix various side effects ([#638](https://github.com/ReVanced/revanced-integrations/issues/638)) ([fcff9a2](https://github.com/ReVanced/revanced-integrations/commit/fcff9a2049ff4953600559ffc767f553c8f7fea6)) + # [1.9.0](https://github.com/ReVanced/revanced-integrations/compare/v1.8.0...v1.9.0) (2024-05-21) diff --git a/gradle.properties b/gradle.properties index 3470d4ce..d79785f6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.9.0 +version = 1.9.1-dev.1