refactor(slide): SpoofClientPatch

This commit is contained in:
Pun Butrach
2026-01-12 16:33:23 +07:00
parent decd7cb23c
commit 60861a8506
2 changed files with 10 additions and 10 deletions

View File

@@ -1,11 +1,11 @@
package app.revanced.patches.reddit.customclients.slide.api
import app.revanced.patcher.fingerprint
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.definingClass
import app.revanced.patcher.name
import app.revanced.patcher.patch.BytecodePatchContext
internal val getClientIdFingerprint = fingerprint {
custom { method, classDef ->
if (!classDef.endsWith("Credentials;")) return@custom false
method.name == "getClientId"
}
internal val BytecodePatchContext.getClientIdMethod by gettingFirstMutableMethodDeclaratively {
name("getClientId")
definingClass { endsWith("Credentials;") }
}

View File

@@ -1,14 +1,14 @@
package app.revanced.patches.reddit.customclients.slide.api
import app.revanced.patches.reddit.customclients.spoofClientPatch
import app.revanced.patches.reddit.customclients.`Spoof client`
import app.revanced.util.returnEarly
val spoofClientPatch = spoofClientPatch(redirectUri = "http://www.ccrama.me") { clientIdOption ->
val spoofClientPatch = `Spoof client`(redirectUri = "http://www.ccrama.me") { clientIdOption ->
compatibleWith("me.ccrama.redditslide")
val clientId by clientIdOption
apply {
getClientIdFingerprint.method.returnEarly(clientId!!)
getClientIdMethod.returnEarly(clientId!!)
}
}