11package app.revanced.patches.spotify.misc.fix
22
3+ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
34import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
45import app.revanced.patcher.patch.bytecodePatch
56import app.revanced.patcher.patch.intOption
@@ -72,7 +73,29 @@ val spoofClientPatch = bytecodePatch(
7273 compatibleWith(" com.spotify.music" )
7374
7475 execute {
75- // region Spoof client.
76+ val clientVersion = clientVersion!!
77+ val hardwareMachine = hardwareMachine!!
78+ val systemVersion = systemVersion!!
79+
80+ // region Spoof login request.
81+
82+ val version = clientVersion
83+ .substringAfter(' -' )
84+ .substringBeforeLast(' .' )
85+ .substringBeforeLast(' .' )
86+
87+ setUserAgentFingerprint.method.addInstruction(
88+ 0 ,
89+ " const-string p1, \" Spotify/$version iOS/$systemVersion ($hardwareMachine )\" "
90+ )
91+
92+ setClientIdFingerprint.method.addInstruction(
93+ 0 , " const-string p1, \" 58bd3c95768941ea9eb4350aaa033eb3\" "
94+ )
95+
96+ // endregion
97+
98+ // region Spoof client-token request.
7699
77100 loadOrbitLibraryFingerprint.method.addInstructions(
78101 0 ,
@@ -83,9 +106,9 @@ val spoofClientPatch = bytecodePatch(
83106 )
84107
85108 mapOf (
86- " getClientVersion" to clientVersion!! ,
87- " getSystemVersion" to systemVersion!! ,
88- " getHardwareMachine" to hardwareMachine!!
109+ " getClientVersion" to clientVersion,
110+ " getSystemVersion" to systemVersion,
111+ " getHardwareMachine" to hardwareMachine
89112 ).forEach { (methodName, value) ->
90113 extensionFixConstantsFingerprint.classDef.methods.single { it.name == methodName }.returnEarly(value)
91114 }
0 commit comments