forked from inotia00/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'inotia00:dev' into dev
- Loading branch information
Showing
77 changed files
with
2,144 additions
and
1,264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...ions/shared/src/main/java/app/revanced/extension/music/patches/misc/SpoofClientPatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package app.revanced.extension.music.patches.misc; | ||
|
||
import app.revanced.extension.music.patches.misc.client.AppClient.ClientType; | ||
import app.revanced.extension.music.settings.Settings; | ||
|
||
@SuppressWarnings("unused") | ||
public class SpoofClientPatch { | ||
private static final boolean SPOOF_CLIENT_ENABLED = Settings.SPOOF_CLIENT.get(); | ||
private static final ClientType clientType = ClientType.IOS_MUSIC; | ||
|
||
/** | ||
* Injection point. | ||
*/ | ||
public static int getClientTypeId(int originalClientTypeId) { | ||
if (SPOOF_CLIENT_ENABLED) { | ||
return clientType.id; | ||
} | ||
|
||
return originalClientTypeId; | ||
} | ||
|
||
/** | ||
* Injection point. | ||
*/ | ||
public static String getClientVersion(String originalClientVersion) { | ||
if (SPOOF_CLIENT_ENABLED) { | ||
return clientType.clientVersion; | ||
} | ||
|
||
return originalClientVersion; | ||
} | ||
|
||
/** | ||
* Injection point. | ||
*/ | ||
public static String getClientModel(String originalClientModel) { | ||
if (SPOOF_CLIENT_ENABLED) { | ||
return clientType.deviceModel; | ||
} | ||
|
||
return originalClientModel; | ||
} | ||
|
||
/** | ||
* Injection point. | ||
*/ | ||
public static String getOsVersion(String originalOsVersion) { | ||
if (SPOOF_CLIENT_ENABLED) { | ||
return clientType.osVersion; | ||
} | ||
|
||
return originalOsVersion; | ||
} | ||
|
||
/** | ||
* Injection point. | ||
*/ | ||
public static String getUserAgent(String originalUserAgent) { | ||
if (SPOOF_CLIENT_ENABLED) { | ||
return clientType.userAgent; | ||
} | ||
|
||
return originalUserAgent; | ||
} | ||
|
||
/** | ||
* Injection point. | ||
*/ | ||
public static boolean isClientSpoofingEnabled() { | ||
return SPOOF_CLIENT_ENABLED; | ||
} | ||
|
||
/** | ||
* Injection point. | ||
* When spoofing the client to iOS, the playback speed menu is missing from the player response. | ||
* Return true to force create the playback speed menu. | ||
*/ | ||
public static boolean forceCreatePlaybackSpeedMenu(boolean original) { | ||
if (SPOOF_CLIENT_ENABLED) { | ||
return true; | ||
} | ||
return original; | ||
} | ||
} |
122 changes: 122 additions & 0 deletions
122
...ions/shared/src/main/java/app/revanced/extension/music/patches/misc/client/AppClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package app.revanced.extension.music.patches.misc.client; | ||
|
||
import android.os.Build; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
public class AppClient { | ||
|
||
/** | ||
* The hardcoded client version of the iOS app used for InnerTube requests with this client. | ||
* | ||
* <p> | ||
* It can be extracted by getting the latest release version of the app on | ||
* <a href="https://apps.apple.com/us/app/music-watch-listen-stream/id544007664/">the App | ||
* Store page of the YouTube app</a>, in the {@code What’s New} section. | ||
* </p> | ||
*/ | ||
private static final String CLIENT_VERSION_IOS = "6.21"; | ||
private static final String DEVICE_MAKE_IOS = "Apple"; | ||
/** | ||
* See <a href="https://gist.github.com/adamawolf/3048717">this GitHub Gist</a> for more | ||
* information. | ||
* </p> | ||
*/ | ||
private static final String DEVICE_MODEL_IOS = "iPhone16,2"; | ||
private static final String OS_NAME_IOS = "iOS"; | ||
private static final String OS_VERSION_IOS = "17.7.2.21H221"; | ||
private static final String USER_AGENT_VERSION_IOS = "17_7_2"; | ||
private static final String USER_AGENT_IOS = "com.google.ios.youtubemusic/" + | ||
CLIENT_VERSION_IOS + | ||
"(" + | ||
DEVICE_MODEL_IOS + | ||
"; U; CPU iOS " + | ||
USER_AGENT_VERSION_IOS + | ||
" like Mac OS X)"; | ||
|
||
private AppClient() { | ||
} | ||
|
||
public enum ClientType { | ||
IOS_MUSIC(26, | ||
DEVICE_MAKE_IOS, | ||
DEVICE_MODEL_IOS, | ||
CLIENT_VERSION_IOS, | ||
OS_NAME_IOS, | ||
OS_VERSION_IOS, | ||
null, | ||
USER_AGENT_IOS, | ||
true | ||
); | ||
|
||
/** | ||
* YouTube | ||
* <a href="https://github.com/zerodytrash/YouTube-Internal-Clients?tab=readme-ov-file#clients">client type</a> | ||
*/ | ||
public final int id; | ||
|
||
/** | ||
* Device manufacturer. | ||
*/ | ||
@Nullable | ||
public final String deviceMake; | ||
|
||
/** | ||
* Device model, equivalent to {@link Build#MODEL} (System property: ro.product.model) | ||
*/ | ||
public final String deviceModel; | ||
|
||
/** | ||
* Device OS name. | ||
*/ | ||
@Nullable | ||
public final String osName; | ||
|
||
/** | ||
* Device OS version. | ||
*/ | ||
public final String osVersion; | ||
|
||
/** | ||
* Player user-agent. | ||
*/ | ||
public final String userAgent; | ||
|
||
/** | ||
* Android SDK version, equivalent to {@link Build.VERSION#SDK} (System property: ro.build.version.sdk) | ||
* Field is null if not applicable. | ||
*/ | ||
public final Integer androidSdkVersion; | ||
|
||
/** | ||
* App version. | ||
*/ | ||
public final String clientVersion; | ||
|
||
/** | ||
* If the client can access the API logged in. | ||
*/ | ||
public final boolean canLogin; | ||
|
||
ClientType(int id, | ||
@Nullable String deviceMake, | ||
String deviceModel, | ||
String clientVersion, | ||
@Nullable String osName, | ||
String osVersion, | ||
Integer androidSdkVersion, | ||
String userAgent, | ||
boolean canLogin | ||
) { | ||
this.id = id; | ||
this.deviceMake = deviceMake; | ||
this.deviceModel = deviceModel; | ||
this.clientVersion = clientVersion; | ||
this.osName = osName; | ||
this.osVersion = osVersion; | ||
this.androidSdkVersion = androidSdkVersion; | ||
this.userAgent = userAgent; | ||
this.canLogin = canLogin; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
extensions/shared/src/main/java/app/revanced/extension/shared/patches/PatchStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package app.revanced.extension.shared.patches; | ||
|
||
@SuppressWarnings("unused") | ||
public class PatchStatus { | ||
public static boolean HideFullscreenAdsDefaultBoolean() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.