mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-24 11:11:03 +00:00
fix(Spotify - Spoof client): Fix login failing by spoofing login request in addition (#5448)
This commit is contained in:
@@ -11,6 +11,22 @@ internal val loadOrbitLibraryFingerprint = fingerprint {
|
|||||||
strings("/liborbit-jni-spotify.so")
|
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 {
|
internal val extensionFixConstantsFingerprint = fingerprint {
|
||||||
custom { _, classDef -> classDef.type == "Lapp/revanced/extension/spotify/misc/fix/Constants;" }
|
custom { _, classDef -> classDef.type == "Lapp/revanced/extension/spotify/misc/fix/Constants;" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.spotify.misc.fix
|
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.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patcher.patch.intOption
|
import app.revanced.patcher.patch.intOption
|
||||||
@@ -72,7 +73,29 @@ val spoofClientPatch = bytecodePatch(
|
|||||||
compatibleWith("com.spotify.music")
|
compatibleWith("com.spotify.music")
|
||||||
|
|
||||||
execute {
|
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(
|
loadOrbitLibraryFingerprint.method.addInstructions(
|
||||||
0,
|
0,
|
||||||
@@ -83,9 +106,9 @@ val spoofClientPatch = bytecodePatch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
mapOf(
|
mapOf(
|
||||||
"getClientVersion" to clientVersion!!,
|
"getClientVersion" to clientVersion,
|
||||||
"getSystemVersion" to systemVersion!!,
|
"getSystemVersion" to systemVersion,
|
||||||
"getHardwareMachine" to hardwareMachine!!
|
"getHardwareMachine" to hardwareMachine
|
||||||
).forEach { (methodName, value) ->
|
).forEach { (methodName, value) ->
|
||||||
extensionFixConstantsFingerprint.classDef.methods.single { it.name == methodName }.returnEarly(value)
|
extensionFixConstantsFingerprint.classDef.methods.single { it.name == methodName }.returnEarly(value)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user