mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-04 19:42:59 +01:00
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
|
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.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
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.AbstractChangeOAuthClientIdPatch
|
||||||
|
import app.revanced.patches.reddit.customclients.ChangeOAuthClientIdPatchAnnotation
|
||||||
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
|
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
|
||||||
|
|
||||||
@Patch
|
@ChangeOAuthClientIdPatchAnnotation
|
||||||
@Name("change-oauth-client-id")
|
|
||||||
@Description("Changes the OAuth client ID in Boost for Reddit.")
|
|
||||||
@Compatibility([Package("com.rubenmayayo.reddit")])
|
@Compatibility([Package("com.rubenmayayo.reddit")])
|
||||||
@Version("0.0.1")
|
|
||||||
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
||||||
"http://rubenmayayo.com",
|
"http://rubenmayayo.com", Options, listOf(GetClientIdFingerprint)
|
||||||
Options,
|
|
||||||
listOf(GetClientIdFingerprint)
|
|
||||||
) {
|
) {
|
||||||
override fun List<MethodFingerprintResult>.patch(context: BytecodeContext): PatchResult {
|
override fun List<MethodFingerprintResult>.patch(context: BytecodeContext): PatchResult {
|
||||||
forEach {
|
first().mutableMethod.addInstructions(
|
||||||
it.mutableMethod.addInstructions(
|
0,
|
||||||
0,
|
"""
|
||||||
|
const-string v0, "$clientId"
|
||||||
|
return-object v0
|
||||||
"""
|
"""
|
||||||
const-string v0, "$clientId"
|
)
|
||||||
return-object v0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
package app.revanced.patches.reddit.customclients.infinityforreddit.api.patch
|
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.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
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.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.GetHTTPBasicAuthHeaderFingerprint
|
||||||
import app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints.LoginActivityOnCreateFingerprint
|
import app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints.LoginActivityOnCreateFingerprint
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Patch
|
@ChangeOAuthClientIdPatchAnnotation
|
||||||
@Name("change-oauth-client-id")
|
|
||||||
@Description("Changes the OAuth client ID.")
|
|
||||||
@Compatibility([Package("ml.docilealligator.infinityforreddit")])
|
@Compatibility([Package("ml.docilealligator.infinityforreddit")])
|
||||||
@Version("0.0.1")
|
|
||||||
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
||||||
"infinity://localhost",
|
"infinity://localhost",
|
||||||
Options,
|
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
|
package app.revanced.patches.reddit.customclients.syncforreddit.api.patch
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
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.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
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.fingerprint.method.impl.MethodFingerprintResult
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
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.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.GetAuthorizationStringFingerprint
|
||||||
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.GetBearerTokenFingerprint
|
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.GetBearerTokenFingerprint
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
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 org.jf.dexlib2.iface.reference.StringReference
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@Patch
|
@ChangeOAuthClientIdPatchAnnotation
|
||||||
@Name("change-oauth-client-id")
|
|
||||||
@Description("Changes the OAuth client ID.")
|
|
||||||
@Compatibility([Package("com.laurencedawson.reddit_sync"), Package("com.laurencedawson.reddit_sync.pro")])
|
@Compatibility([Package("com.laurencedawson.reddit_sync"), Package("com.laurencedawson.reddit_sync.pro")])
|
||||||
@Version("0.0.1")
|
|
||||||
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
||||||
"http://redditsync/auth",
|
"http://redditsync/auth", Options, listOf(GetAuthorizationStringFingerprint)
|
||||||
Options,
|
|
||||||
listOf(GetAuthorizationStringFingerprint)
|
|
||||||
) {
|
) {
|
||||||
override fun List<MethodFingerprintResult>.patch(context: BytecodeContext): PatchResult {
|
override fun List<MethodFingerprintResult>.patch(context: BytecodeContext): PatchResult {
|
||||||
forEach { fingerprintResult ->
|
forEach { fingerprintResult ->
|
||||||
|
Loading…
Reference in New Issue
Block a user