mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-31 06:31:02 +00:00
refactor(slide): SpoofClientPatch
This commit is contained in:
@@ -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;") }
|
||||
}
|
||||
|
||||
@@ -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!!)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user