mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-19 09:03:58 +00:00
refactor(reddit): block patch naming
This commit is contained in:
@@ -2,15 +2,15 @@ package app.revanced.patches.reddit.customclients
|
||||
|
||||
import app.revanced.patcher.patch.BytecodePatchBuilder
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
|
||||
const val INSTALL_NEW_CLIENT_METHOD = "install(Lokhttp3/OkHttpClient${'$'}Builder;)Lokhttp3/OkHttpClient;"
|
||||
const val CREATE_NEW_CLIENT_METHOD = "createClient()Lokhttp3/OkHttpClient;"
|
||||
|
||||
fun fixRedgifsApiPatch(
|
||||
fun `Fix Redgifs API`(
|
||||
extensionPatch: Patch,
|
||||
block: BytecodePatchBuilder.() -> Unit = {},
|
||||
) = bytecodePatch(name = "Fix Redgifs API") {
|
||||
) = creatingBytecodePatch {
|
||||
dependsOn(extensionPatch)
|
||||
|
||||
block()
|
||||
|
||||
@@ -2,15 +2,15 @@ package app.revanced.patches.reddit.customclients
|
||||
|
||||
import app.revanced.patcher.patch.BytecodePatchBuilder
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
|
||||
const val RESOLVE_S_LINK_METHOD = "patchResolveSLink(Ljava/lang/String;)Z"
|
||||
const val SET_ACCESS_TOKEN_METHOD = "patchSetAccessToken(Ljava/lang/String;)V"
|
||||
|
||||
fun fixSLinksPatch(
|
||||
fun `Fix s links`(
|
||||
extensionPatch: Patch,
|
||||
block: BytecodePatchBuilder.() -> Unit = {},
|
||||
) = bytecodePatch(name = "Fix /s/ links") {
|
||||
) = creatingBytecodePatch {
|
||||
dependsOn(extensionPatch)
|
||||
|
||||
block()
|
||||
|
||||
@@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients
|
||||
|
||||
import app.revanced.patcher.patch.BytecodePatchBuilder
|
||||
import app.revanced.patcher.patch.Option
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patcher.patch.stringOption
|
||||
|
||||
/**
|
||||
@@ -11,11 +11,10 @@ import app.revanced.patcher.patch.stringOption
|
||||
* @param redirectUri The redirect URI of the Reddit OAuth client.
|
||||
* @param block The patch block. It is called with the client ID option.
|
||||
*/
|
||||
fun spoofClientPatch(
|
||||
fun `Spoof client`(
|
||||
redirectUri: String,
|
||||
block: BytecodePatchBuilder.(Option<String>) -> Unit = {},
|
||||
) = bytecodePatch(
|
||||
name = "Spoof client",
|
||||
) = creatingBytecodePatch(
|
||||
description = "Restores functionality of the app by using custom client ID.",
|
||||
) {
|
||||
block(
|
||||
|
||||
@@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.baconreader.api
|
||||
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
||||
import app.revanced.patches.reddit.customclients.`Spoof client`
|
||||
import app.revanced.patches.shared.misc.string.replaceStringPatch
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
@@ -11,7 +11,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
import com.android.tools.smali.dexlib2.mutable.MutableMethod
|
||||
|
||||
val spoofClientPatch = spoofClientPatch(redirectUri = "http://baconreader.com/auth") { clientIdOption ->
|
||||
val spoofClientPatch = `Spoof client`(redirectUri = "http://baconreader.com/auth") { clientIdOption ->
|
||||
dependsOn(
|
||||
// Redirects from SSL to WWW domain are bugged causing auth problems.
|
||||
// Manually rewrite the URLs to fix this.
|
||||
|
||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.extensions.removeInstructions
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
||||
import app.revanced.patches.reddit.customclients.baconreader.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch
|
||||
import app.revanced.patches.reddit.customclients.`Fix Redgifs API`
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -16,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.reference.TypeReference
|
||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/baconreader/FixRedgifsApiPatch;"
|
||||
|
||||
@Suppress("unused")
|
||||
val fixRedgifsApi = fixRedgifsApiPatch(
|
||||
val fixRedgifsApi = `Fix Redgifs API`(
|
||||
extensionPatch = sharedExtensionPatch
|
||||
) {
|
||||
compatibleWith(
|
||||
|
||||
@@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.boostforreddit.api
|
||||
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
||||
import app.revanced.patches.reddit.customclients.`Spoof client`
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import app.revanced.util.returnEarly
|
||||
@@ -11,7 +11,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
|
||||
@Suppress("unused")
|
||||
val spoofClientPatch = spoofClientPatch(redirectUri = "http://rubenmayayo.com") { clientIdOption ->
|
||||
val spoofClientPatch = `Spoof client`(redirectUri = "http://rubenmayayo.com") { clientIdOption ->
|
||||
compatibleWith("com.rubenmayayo.reddit")
|
||||
|
||||
val clientId by clientIdOption
|
||||
|
||||
@@ -3,7 +3,7 @@ package app.revanced.patches.reddit.customclients.boostforreddit.fix.redgifs
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patches.reddit.customclients.CREATE_NEW_CLIENT_METHOD
|
||||
import app.revanced.patches.reddit.customclients.boostforreddit.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch
|
||||
import app.revanced.patches.reddit.customclients.`Fix Redgifs API`
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
@@ -11,7 +11,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/boostforreddit/FixRedgifsApiPatch;"
|
||||
|
||||
@Suppress("unused")
|
||||
val fixRedgifsApi = fixRedgifsApiPatch(
|
||||
val fixRedgifsApi = `Fix Redgifs API`(
|
||||
extensionPatch = sharedExtensionPatch
|
||||
) {
|
||||
compatibleWith("com.rubenmayayo.reddit")
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package app.revanced.patches.reddit.customclients.infinityforreddit.api
|
||||
|
||||
import app.revanced.patcher.extensions.toInstructions
|
||||
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
||||
import app.revanced.patches.reddit.customclients.`Spoof client`
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodImplementation
|
||||
import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable
|
||||
|
||||
val spoofClientPatch = spoofClientPatch(redirectUri = "infinity://localhost") { clientIdOption ->
|
||||
val spoofClientPatch = `Spoof client`(redirectUri = "infinity://localhost") { clientIdOption ->
|
||||
compatibleWith(
|
||||
"ml.docilealligator.infinityforreddit",
|
||||
"ml.docilealligator.infinityforreddit.plus",
|
||||
|
||||
@@ -2,11 +2,11 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.api
|
||||
|
||||
import app.revanced.patches.reddit.customclients.infinity.api.authUtilityUserAgentMethod
|
||||
import app.revanced.patches.reddit.customclients.infinity.api.getClientIdMethod
|
||||
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
||||
import app.revanced.patches.reddit.customclients.`Spoof client`
|
||||
import app.revanced.patches.reddit.customclients.sync.detection.piracy.disablePiracyDetectionPatch
|
||||
import app.revanced.util.returnEarly
|
||||
|
||||
val spoofClientPatch = spoofClientPatch(redirectUri = "https://127.0.0.1:65023/authorize_callback") { clientIdOption ->
|
||||
val spoofClientPatch = `Spoof client`(redirectUri = "https://127.0.0.1:65023/authorize_callback") { clientIdOption ->
|
||||
dependsOn(disablePiracyDetectionPatch)
|
||||
|
||||
compatibleWith(
|
||||
|
||||
@@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.redditisfun.api
|
||||
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
||||
import app.revanced.patches.reddit.customclients.`Spoof client`
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import app.revanced.util.returnEarly
|
||||
@@ -12,7 +12,7 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
import com.android.tools.smali.dexlib2.mutable.MutableMethod
|
||||
|
||||
@Suppress("unused")
|
||||
val spoofClientPatch = spoofClientPatch(redirectUri = "redditisfun://auth") { clientIdOption ->
|
||||
val spoofClientPatch = `Spoof client`(redirectUri = "redditisfun://auth") { clientIdOption ->
|
||||
compatibleWith(
|
||||
"com.andrewshu.android.reddit",
|
||||
"com.andrewshu.android.redditdonation",
|
||||
|
||||
@@ -3,7 +3,7 @@ package app.revanced.patches.reddit.customclients.relayforreddit.api
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
||||
import app.revanced.patches.reddit.customclients.`Spoof client`
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -13,7 +13,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
|
||||
@Suppress("unused")
|
||||
val spoofClientPatch = spoofClientPatch(redirectUri = "dbrady://relay") { clientIdOption ->
|
||||
val spoofClientPatch = `Spoof client`(redirectUri = "dbrady://relay") { clientIdOption ->
|
||||
compatibleWith(
|
||||
"free.reddit.news",
|
||||
"reddit.news",
|
||||
|
||||
@@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.sync.syncforreddit.api
|
||||
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patches.reddit.customclients.spoofClientPatch
|
||||
import app.revanced.patches.reddit.customclients.`Spoof client`
|
||||
import app.revanced.patches.reddit.customclients.sync.detection.piracy.disablePiracyDetectionPatch
|
||||
import app.revanced.patches.shared.misc.string.replaceStringPatch
|
||||
import app.revanced.util.returnEarly
|
||||
@@ -11,7 +11,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
import java.util.Base64
|
||||
|
||||
val spoofClientPatch = spoofClientPatch(
|
||||
val spoofClientPatch = `Spoof client`(
|
||||
redirectUri = "http://redditsync/auth",
|
||||
) { clientIdOption ->
|
||||
dependsOn(
|
||||
|
||||
@@ -4,7 +4,7 @@ import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
||||
import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch
|
||||
import app.revanced.patches.reddit.customclients.`Fix Redgifs API`
|
||||
import app.revanced.patches.reddit.customclients.sync.syncforreddit.extension.sharedExtensionPatch
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
@@ -14,7 +14,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/syncforreddit/FixRedgifsApiPatch;"
|
||||
|
||||
@Suppress("unused")
|
||||
val fixRedgifsApi = fixRedgifsApiPatch(
|
||||
val fixRedgifsApi = `Fix Redgifs API`(
|
||||
extensionPatch = sharedExtensionPatch
|
||||
) {
|
||||
compatibleWith(
|
||||
|
||||
Reference in New Issue
Block a user