fix(Reddit is Fun - Spoof client): Use a more convincing user agent

This commit is contained in:
oSumAtrIX 2023-08-03 16:22:57 +02:00
parent 6bc51cd906
commit 236a18f935
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4

View file

@ -58,15 +58,16 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
} }
override fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext): PatchResult { override fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext): PatchResult {
// Use a random number as the user agent string. // Use a random user agent.
val randomUserAgent = (0..100000).random() val randomName = (0..100000).random()
val userAgent = "android:app.revanced.$randomName:v1.0.0 (by /u/revanced)\n"
first().mutableMethod.addInstructions( first().mutableMethod.addInstructions(
0, 0,
""" """
const-string v0, "$randomUserAgent" const-string v0, "$userAgent"
return-object v0 return-object v0
""" """
) )
return PatchResultSuccess() return PatchResultSuccess()