fix(YouTube Music - Spoof client): Skip response encryption in OnesiePlayerRequest has also been applied to YouTube Music (Closes https://github.com/inotia00/ReVanced_Extended/issues/2819)

This commit is contained in:
inotia00 2025-03-07 09:48:09 +09:00
parent 1fca6d67b1
commit 7d834f253f
6 changed files with 38 additions and 39 deletions

View File

@ -106,18 +106,4 @@ public class BlockRequestPatch {
return initPlaybackRequestUri; return initPlaybackRequestUri;
} }
/**
* Injection point.
* Skip response encryption in OnesiePlayerRequest.
*/
public static boolean skipResponseEncryption(boolean original) {
Logger.printDebug(() -> "response Encryption: " + original);
if (BLOCK_REQUEST) {
return false;
}
return original;
}
} }

View File

@ -62,6 +62,18 @@ public class SpoofStreamingDataPatch extends BlockRequestPatch {
return false; return false;
} }
/**
* Injection point.
* Skip response encryption in OnesiePlayerRequest.
*/
public static boolean skipResponseEncryption(boolean original) {
if (!SPOOF_STREAMING_DATA) {
return original;
}
return false;
}
/** /**
* Injection point. * Injection point.
*/ */

View File

@ -4,12 +4,10 @@ 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.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.shared.extension.Constants.SPOOF_PATH import app.revanced.patches.shared.extension.Constants.SPOOF_PATH
import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
import app.revanced.util.fingerprint.methodOrThrow import app.revanced.util.fingerprint.methodOrThrow
import app.revanced.util.fingerprint.resolvable
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
const val EXTENSION_CLASS_DESCRIPTOR = private const val EXTENSION_CLASS_DESCRIPTOR =
"$SPOOF_PATH/BlockRequestPatch;" "$SPOOF_PATH/BlockRequestPatch;"
val blockRequestPatch = bytecodePatch( val blockRequestPatch = bytecodePatch(
@ -51,16 +49,5 @@ val blockRequestPatch = bytecodePatch(
} }
// endregion // endregion
// region Skip response encryption in OnesiePlayerRequest
if (onesieEncryptionFeatureFlagFingerprint.resolvable()) {
onesieEncryptionFeatureFlagFingerprint.injectLiteralInstructionBooleanCall(
ONESIE_ENCRYPTION_FEATURE_FLAG,
"$EXTENSION_CLASS_DESCRIPTOR->skipResponseEncryption(Z)Z"
)
}
// endregion
} }
} }

View File

@ -40,14 +40,3 @@ internal fun indexOfUriToStringInstruction(method: Method) =
opcode == Opcode.INVOKE_VIRTUAL && opcode == Opcode.INVOKE_VIRTUAL &&
getReference<MethodReference>().toString() == "Landroid/net/Uri;->toString()Ljava/lang/String;" getReference<MethodReference>().toString() == "Landroid/net/Uri;->toString()Ljava/lang/String;"
} }
// Feature flag that turns on Platypus programming language code compiled to native C++.
// This code appears to replace the player config after the streams are loaded.
// Flag is present in YouTube 19.34, but is missing Platypus stream replacement code until 19.43.
// Flag and Platypus code is also present in newer versions of YouTube Music.
internal const val ONESIE_ENCRYPTION_FEATURE_FLAG = 45645570L
internal val onesieEncryptionFeatureFlagFingerprint = legacyFingerprint(
name = "onesieEncryptionFeatureFlagFingerprint",
literals = listOf(ONESIE_ENCRYPTION_FEATURE_FLAG),
)

View File

@ -135,4 +135,15 @@ internal val hlsCurrentTimeFingerprint = legacyFingerprint(
literals = listOf(HLS_CURRENT_TIME_FEATURE_FLAG), literals = listOf(HLS_CURRENT_TIME_FEATURE_FLAG),
) )
// Feature flag that turns on Platypus programming language code compiled to native C++.
// This code appears to replace the player config after the streams are loaded.
// Flag is present in YouTube 19.34, but is missing Platypus stream replacement code until 19.43.
// Flag and Platypus code is also present in newer versions of YouTube Music.
internal const val ONESIE_ENCRYPTION_FEATURE_FLAG = 45645570L
internal val onesieEncryptionFeatureFlagFingerprint = legacyFingerprint(
name = "onesieEncryptionFeatureFlagFingerprint",
literals = listOf(ONESIE_ENCRYPTION_FEATURE_FLAG),
)

View File

@ -18,6 +18,8 @@ import app.revanced.patches.shared.spoof.useragent.baseSpoofUserAgentPatch
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.compatibility.Constants.YOUTUBE_PACKAGE_NAME import app.revanced.patches.youtube.utils.compatibility.Constants.YOUTUBE_PACKAGE_NAME
import app.revanced.patches.youtube.utils.patch.PatchList.SPOOF_STREAMING_DATA import app.revanced.patches.youtube.utils.patch.PatchList.SPOOF_STREAMING_DATA
import app.revanced.patches.youtube.utils.playservice.is_19_34_or_greater
import app.revanced.patches.youtube.utils.playservice.versionCheckPatch
import app.revanced.patches.youtube.utils.request.buildRequestPatch import app.revanced.patches.youtube.utils.request.buildRequestPatch
import app.revanced.patches.youtube.utils.request.hookBuildRequest import app.revanced.patches.youtube.utils.request.hookBuildRequest
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference
@ -54,6 +56,7 @@ val spoofStreamingDataPatch = bytecodePatch(
baseSpoofUserAgentPatch(YOUTUBE_PACKAGE_NAME), baseSpoofUserAgentPatch(YOUTUBE_PACKAGE_NAME),
blockRequestPatch, blockRequestPatch,
buildRequestPatch, buildRequestPatch,
versionCheckPatch,
) )
execute { execute {
@ -317,6 +320,17 @@ val spoofStreamingDataPatch = bytecodePatch(
// endregion // endregion
// region Skip response encryption in OnesiePlayerRequest
if (is_19_34_or_greater) {
onesieEncryptionFeatureFlagFingerprint.injectLiteralInstructionBooleanCall(
ONESIE_ENCRYPTION_FEATURE_FLAG,
"$EXTENSION_CLASS_DESCRIPTOR->skipResponseEncryption(Z)Z"
)
}
// endregion
findMethodOrThrow("$PATCHES_PATH/PatchStatus;") { findMethodOrThrow("$PATCHES_PATH/PatchStatus;") {
name == "SpoofStreamingData" name == "SpoofStreamingData"
}.replaceInstruction( }.replaceInstruction(