fix(Spotify - Spoof client): Fix login failing by spoofing login request in addition (#5448)

This commit is contained in:
oSumAtrIX
2025-07-14 13:55:37 +02:00
committed by GitHub
parent d0d2c13d16
commit c972267cd8
2 changed files with 43 additions and 4 deletions

View File

@@ -11,6 +11,22 @@ internal val loadOrbitLibraryFingerprint = fingerprint {
strings("/liborbit-jni-spotify.so")
}
internal val setClientIdFingerprint = fingerprint {
parameters("Ljava/lang/String;")
custom { method, classDef ->
classDef.type == "Lcom/spotify/connectivity/ApplicationScopeConfiguration;"
&& method.name == "setClientId"
}
}
internal val setUserAgentFingerprint = fingerprint {
parameters("Ljava/lang/String;")
custom { method, classDef ->
classDef.type == "Lcom/spotify/connectivity/ApplicationScopeConfiguration;"
&& method.name == "setDefaultHTTPUserAgent"
}
}
internal val extensionFixConstantsFingerprint = fingerprint {
custom { _, classDef -> classDef.type == "Lapp/revanced/extension/spotify/misc/fix/Constants;" }
}

View File

@@ -1,5 +1,6 @@
package app.revanced.patches.spotify.misc.fix
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.intOption
@@ -72,7 +73,29 @@ val spoofClientPatch = bytecodePatch(
compatibleWith("com.spotify.music")
execute {
// region Spoof client.
val clientVersion = clientVersion!!
val hardwareMachine = hardwareMachine!!
val systemVersion = systemVersion!!
// region Spoof login request.
val version = clientVersion
.substringAfter('-')
.substringBeforeLast('.')
.substringBeforeLast('.')
setUserAgentFingerprint.method.addInstruction(
0,
"const-string p1, \"Spotify/$version iOS/$systemVersion ($hardwareMachine)\""
)
setClientIdFingerprint.method.addInstruction(
0, "const-string p1, \"58bd3c95768941ea9eb4350aaa033eb3\""
)
// endregion
// region Spoof client-token request.
loadOrbitLibraryFingerprint.method.addInstructions(
0,
@@ -83,9 +106,9 @@ val spoofClientPatch = bytecodePatch(
)
mapOf(
"getClientVersion" to clientVersion!!,
"getSystemVersion" to systemVersion!!,
"getHardwareMachine" to hardwareMachine!!
"getClientVersion" to clientVersion,
"getSystemVersion" to systemVersion,
"getHardwareMachine" to hardwareMachine
).forEach { (methodName, value) ->
extensionFixConstantsFingerprint.classDef.methods.single { it.name == methodName }.returnEarly(value)
}