feat(relayforreddit): add change-oauth-client-id
patch (#2491)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
b15ee60c1b
commit
fe66f4089d
|
@ -0,0 +1,11 @@
|
|||
package app.revanced.patches.reddit.customclients
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Patch
|
||||
@Name("change-oauth-client-id")
|
||||
@Description("Changes the OAuth client ID.")
|
||||
annotation class ChangeOAuthClientIdPatchAnnotation
|
|
@ -1,35 +1,29 @@
|
|||
package app.revanced.patches.reddit.customclients.boostforreddit.api.patch
|
||||
|
||||
import app.revanced.patcher.annotation.*
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.reddit.customclients.AbstractChangeOAuthClientIdPatch
|
||||
import app.revanced.patches.reddit.customclients.ChangeOAuthClientIdPatchAnnotation
|
||||
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("change-oauth-client-id")
|
||||
@Description("Changes the OAuth client ID in Boost for Reddit.")
|
||||
@ChangeOAuthClientIdPatchAnnotation
|
||||
@Compatibility([Package("com.rubenmayayo.reddit")])
|
||||
@Version("0.0.1")
|
||||
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
||||
"http://rubenmayayo.com",
|
||||
Options,
|
||||
listOf(GetClientIdFingerprint)
|
||||
"http://rubenmayayo.com", Options, listOf(GetClientIdFingerprint)
|
||||
) {
|
||||
override fun List<MethodFingerprintResult>.patch(context: BytecodeContext): PatchResult {
|
||||
forEach {
|
||||
it.mutableMethod.addInstructions(
|
||||
0,
|
||||
first().mutableMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const-string v0, "$clientId"
|
||||
return-object v0
|
||||
"""
|
||||
const-string v0, "$clientId"
|
||||
return-object v0
|
||||
"""
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
package app.revanced.patches.reddit.customclients.infinityforreddit.api.patch
|
||||
|
||||
import app.revanced.patcher.annotation.*
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.reddit.customclients.AbstractChangeOAuthClientIdPatch
|
||||
import app.revanced.patches.reddit.customclients.ChangeOAuthClientIdPatchAnnotation
|
||||
import app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints.GetHTTPBasicAuthHeaderFingerprint
|
||||
import app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints.LoginActivityOnCreateFingerprint
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("change-oauth-client-id")
|
||||
@Description("Changes the OAuth client ID.")
|
||||
@ChangeOAuthClientIdPatchAnnotation
|
||||
@Compatibility([Package("ml.docilealligator.infinityforreddit")])
|
||||
@Version("0.0.1")
|
||||
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
||||
"infinity://localhost",
|
||||
Options,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object GetClientIdFingerprint : MethodFingerprint(
|
||||
strings = listOf("AIzaSyCTQfRx9fHnDpfcfiI5pmwyGUBjDVTNvX8")
|
||||
)
|
|
@ -0,0 +1,26 @@
|
|||
package app.revanced.patches.reddit.customclients.relayforreddit.api.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.reddit.customclients.AbstractChangeOAuthClientIdPatch
|
||||
import app.revanced.patches.reddit.customclients.ChangeOAuthClientIdPatchAnnotation
|
||||
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.GetClientIdFingerprint
|
||||
|
||||
@ChangeOAuthClientIdPatchAnnotation
|
||||
@Compatibility([Package("free.reddit.news"), Package("reddit.news")])
|
||||
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
||||
"dbrady://relay", Options, listOf(GetClientIdFingerprint)
|
||||
) {
|
||||
override fun List<MethodFingerprintResult>.patch(context: BytecodeContext): PatchResult {
|
||||
first().mutableMethod.replaceInstruction(0, "const-string v0, \"$clientId\"")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object Options : AbstractChangeOAuthClientIdPatch.Options.ChangeOAuthClientIdOptionsContainer()
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
package app.revanced.patches.reddit.customclients.syncforreddit.api.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.*
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
|
@ -10,8 +11,8 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.
|
|||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.reddit.customclients.AbstractChangeOAuthClientIdPatch
|
||||
import app.revanced.patches.reddit.customclients.ChangeOAuthClientIdPatchAnnotation
|
||||
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.GetAuthorizationStringFingerprint
|
||||
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.GetBearerTokenFingerprint
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
@ -19,15 +20,10 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|||
import org.jf.dexlib2.iface.reference.StringReference
|
||||
import java.util.*
|
||||
|
||||
@Patch
|
||||
@Name("change-oauth-client-id")
|
||||
@Description("Changes the OAuth client ID.")
|
||||
@ChangeOAuthClientIdPatchAnnotation
|
||||
@Compatibility([Package("com.laurencedawson.reddit_sync"), Package("com.laurencedawson.reddit_sync.pro")])
|
||||
@Version("0.0.1")
|
||||
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
||||
"http://redditsync/auth",
|
||||
Options,
|
||||
listOf(GetAuthorizationStringFingerprint)
|
||||
"http://redditsync/auth", Options, listOf(GetAuthorizationStringFingerprint)
|
||||
) {
|
||||
override fun List<MethodFingerprintResult>.patch(context: BytecodeContext): PatchResult {
|
||||
forEach { fingerprintResult ->
|
||||
|
|
Loading…
Reference in a new issue