mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-19 06:29:22 +01:00
fix(Reddit is Fun - Spoof client): Fix login by updating the authorization subdomain from "old" to "ssl"
This commit is contained in:
parent
a5172509ec
commit
b156cb1d89
@ -576,6 +576,7 @@ public final class app/revanced/patches/reddit/customclients/joeyforreddit/detec
|
|||||||
public final class app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
|
public final class app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch;
|
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch;
|
||||||
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
|
public fun patchMiscellaneous (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
public fun patchUserAgent (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
public fun patchUserAgent (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,10 @@ import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch
|
|||||||
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BasicAuthorizationFingerprint
|
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BasicAuthorizationFingerprint
|
||||||
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BuildAuthorizationStringFingerprint
|
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BuildAuthorizationStringFingerprint
|
||||||
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.GetUserAgentFingerprint
|
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.GetUserAgentFingerprint
|
||||||
|
import app.revanced.util.getReference
|
||||||
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SpoofClientPatch : BaseSpoofClientPatch(
|
object SpoofClientPatch : BaseSpoofClientPatch(
|
||||||
@ -20,8 +22,8 @@ object SpoofClientPatch : BaseSpoofClientPatch(
|
|||||||
userAgentFingerprints = setOf(GetUserAgentFingerprint),
|
userAgentFingerprints = setOf(GetUserAgentFingerprint),
|
||||||
compatiblePackages = setOf(
|
compatiblePackages = setOf(
|
||||||
CompatiblePackage("com.andrewshu.android.reddit"),
|
CompatiblePackage("com.andrewshu.android.reddit"),
|
||||||
CompatiblePackage("com.andrewshu.android.redditdonation")
|
CompatiblePackage("com.andrewshu.android.redditdonation"),
|
||||||
)
|
),
|
||||||
) {
|
) {
|
||||||
override fun Set<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
|
override fun Set<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
|
||||||
/**
|
/**
|
||||||
@ -59,7 +61,23 @@ object SpoofClientPatch : BaseSpoofClientPatch(
|
|||||||
"""
|
"""
|
||||||
const-string v0, "$userAgent"
|
const-string v0, "$userAgent"
|
||||||
return-object v0
|
return-object v0
|
||||||
"""
|
""",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun Set<MethodFingerprintResult>.patchMiscellaneous(context: BytecodeContext) {
|
||||||
|
// Reddit messed up and does not append a redirect uri to the authorization url to old.reddit.com/login.
|
||||||
|
// Replace old.reddit.com with ssl.reddit.com to fix this.
|
||||||
|
BuildAuthorizationStringFingerprint.result!!.mutableMethod.apply {
|
||||||
|
val index = indexOfFirstInstruction {
|
||||||
|
getReference<StringReference>()?.contains("old.reddit.com") == true
|
||||||
|
}
|
||||||
|
|
||||||
|
val targetRegister = getInstruction<OneRegisterInstruction>(index).registerA
|
||||||
|
replaceInstruction(
|
||||||
|
index,
|
||||||
|
"const-string v$targetRegister, \"https://ssl.reddit.com/api/v1/authorize.compact\"",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user