mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 09:07:46 +01:00
fix(Relay for Reddit - Spoof client): Prevent OAuth login being disabled remotely
This commit is contained in:
parent
a4145d20ff
commit
a0aa2be86d
2 changed files with 35 additions and 3 deletions
|
@ -9,6 +9,9 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
|
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
|
||||||
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.*
|
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.*
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction10t
|
||||||
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21t
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
|
@ -28,7 +31,10 @@ object SpoofClientPatch : AbstractSpoofClientPatch(
|
||||||
GetLoggedOutBearerTokenFingerprint,
|
GetLoggedOutBearerTokenFingerprint,
|
||||||
GetRefreshTokenFingerprint
|
GetRefreshTokenFingerprint
|
||||||
),
|
),
|
||||||
miscellaneousFingerprints = listOf(SetRemoteConfigFingerprint)
|
miscellaneousFingerprints = listOf(
|
||||||
|
SetRemoteConfigFingerprint,
|
||||||
|
RedditCheckDisableAPIFingerprint
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
|
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
|
||||||
forEach {
|
forEach {
|
||||||
|
@ -44,7 +50,24 @@ object SpoofClientPatch : AbstractSpoofClientPatch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun List<MethodFingerprintResult>.patchMiscellaneous(context: BytecodeContext) =
|
override fun List<MethodFingerprintResult>.patchMiscellaneous(context: BytecodeContext) {
|
||||||
// Do not load remote config which disables OAuth login remotely
|
// Do not load remote config which disables OAuth login remotely.
|
||||||
first().mutableMethod.addInstructions(0, "return-void")
|
first().mutableMethod.addInstructions(0, "return-void")
|
||||||
|
|
||||||
|
// Prevent OAuth login being disabled remotely.
|
||||||
|
last().let {
|
||||||
|
val checkIsOAuthRequestIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
|
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val returnNextChain = getInstruction<BuilderInstruction21t>(checkIsOAuthRequestIndex).target
|
||||||
|
replaceInstruction(
|
||||||
|
checkIsOAuthRequestIndex,
|
||||||
|
BuilderInstruction10t(
|
||||||
|
Opcode.GOTO,
|
||||||
|
returnNextChain
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
object RedditCheckDisableAPIFingerprint : MethodFingerprint(
|
||||||
|
strings = listOf("Reddit Disabled"),
|
||||||
|
opcodes = listOf(Opcode.IF_EQZ)
|
||||||
|
)
|
Loading…
Reference in a new issue