mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-10 22:39:38 +01:00
fix(Infinity for Reddit - Spoof client): Support latest version
This commit is contained in:
parent
cae754d66c
commit
8a5311b1e6
@ -1,12 +1,17 @@
|
|||||||
package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints
|
package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
|
|
||||||
abstract class AbstractClientIdFingerprint(classTypeSuffix: String, methodName: String) : MethodFingerprint(
|
/**
|
||||||
strings = listOf("NOe2iKrPPzwscA"),
|
* Fingerprint for a method that has the client id hardcoded in it.
|
||||||
customFingerprint = custom@{ methodDef, classDef ->
|
* The first string in the fingerprint is the client id.
|
||||||
if (!classDef.type.endsWith(classTypeSuffix)) return@custom false
|
*
|
||||||
|
* @param customFingerprint A custom fingerprint.
|
||||||
methodDef.name == methodName
|
* @param additionalStrings Additional strings to add to the fingerprint.
|
||||||
}
|
*/
|
||||||
)
|
abstract class AbstractClientIdFingerprint(
|
||||||
|
customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null,
|
||||||
|
vararg additionalStrings: String
|
||||||
|
) : MethodFingerprint(strings = listOf("NOe2iKrPPzwscA", *additionalStrings), customFingerprint = customFingerprint)
|
@ -1,6 +1,3 @@
|
|||||||
package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints
|
package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints
|
||||||
|
|
||||||
object GetHttpBasicAuthHeaderFingerprint : AbstractClientIdFingerprint(
|
object GetHttpBasicAuthHeaderFingerprint : AbstractClientIdFingerprint(additionalStrings = arrayOf("Authorization"))
|
||||||
"APIUtils;",
|
|
||||||
"getHttpBasicAuthHeader"
|
|
||||||
)
|
|
@ -1,6 +1,5 @@
|
|||||||
package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints
|
package app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints
|
||||||
|
|
||||||
object LoginActivityOnCreateFingerprint : AbstractClientIdFingerprint(
|
object LoginActivityOnCreateFingerprint : AbstractClientIdFingerprint(custom@{ methodDef, classDef ->
|
||||||
"LoginActivity;",
|
methodDef.name == "onCreate" && classDef.type.endsWith("LoginActivity;")
|
||||||
"onCreate"
|
})
|
||||||
)
|
|
@ -25,6 +25,7 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
|
|||||||
) {
|
) {
|
||||||
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
|
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
|
||||||
forEach {
|
forEach {
|
||||||
|
// First is index of the clientId string.
|
||||||
val clientIdIndex = it.scanResult.stringsScanResult!!.matches.first().index
|
val clientIdIndex = it.scanResult.stringsScanResult!!.matches.first().index
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val oAuthClientIdRegister = getInstruction<OneRegisterInstruction>(clientIdIndex).registerA
|
val oAuthClientIdRegister = getInstruction<OneRegisterInstruction>(clientIdIndex).registerA
|
||||||
|
Loading…
Reference in New Issue
Block a user