refactor(reddit): block patch naming
This commit is contained in:
parent
60861a8506
commit
f4f43660da
13 changed files with 29 additions and 30 deletions
|
|
@ -2,15 +2,15 @@ package app.revanced.patches.reddit.customclients
|
||||||
|
|
||||||
import app.revanced.patcher.patch.BytecodePatchBuilder
|
import app.revanced.patcher.patch.BytecodePatchBuilder
|
||||||
import app.revanced.patcher.patch.Patch
|
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 INSTALL_NEW_CLIENT_METHOD = "install(Lokhttp3/OkHttpClient${'$'}Builder;)Lokhttp3/OkHttpClient;"
|
||||||
const val CREATE_NEW_CLIENT_METHOD = "createClient()Lokhttp3/OkHttpClient;"
|
const val CREATE_NEW_CLIENT_METHOD = "createClient()Lokhttp3/OkHttpClient;"
|
||||||
|
|
||||||
fun fixRedgifsApiPatch(
|
fun `Fix Redgifs API`(
|
||||||
extensionPatch: Patch,
|
extensionPatch: Patch,
|
||||||
block: BytecodePatchBuilder.() -> Unit = {},
|
block: BytecodePatchBuilder.() -> Unit = {},
|
||||||
) = bytecodePatch(name = "Fix Redgifs API") {
|
) = creatingBytecodePatch {
|
||||||
dependsOn(extensionPatch)
|
dependsOn(extensionPatch)
|
||||||
|
|
||||||
block()
|
block()
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,15 @@ package app.revanced.patches.reddit.customclients
|
||||||
|
|
||||||
import app.revanced.patcher.patch.BytecodePatchBuilder
|
import app.revanced.patcher.patch.BytecodePatchBuilder
|
||||||
import app.revanced.patcher.patch.Patch
|
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 RESOLVE_S_LINK_METHOD = "patchResolveSLink(Ljava/lang/String;)Z"
|
||||||
const val SET_ACCESS_TOKEN_METHOD = "patchSetAccessToken(Ljava/lang/String;)V"
|
const val SET_ACCESS_TOKEN_METHOD = "patchSetAccessToken(Ljava/lang/String;)V"
|
||||||
|
|
||||||
fun fixSLinksPatch(
|
fun `Fix s links`(
|
||||||
extensionPatch: Patch,
|
extensionPatch: Patch,
|
||||||
block: BytecodePatchBuilder.() -> Unit = {},
|
block: BytecodePatchBuilder.() -> Unit = {},
|
||||||
) = bytecodePatch(name = "Fix /s/ links") {
|
) = creatingBytecodePatch {
|
||||||
dependsOn(extensionPatch)
|
dependsOn(extensionPatch)
|
||||||
|
|
||||||
block()
|
block()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients
|
||||||
|
|
||||||
import app.revanced.patcher.patch.BytecodePatchBuilder
|
import app.revanced.patcher.patch.BytecodePatchBuilder
|
||||||
import app.revanced.patcher.patch.Option
|
import app.revanced.patcher.patch.Option
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||||
import app.revanced.patcher.patch.stringOption
|
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 redirectUri The redirect URI of the Reddit OAuth client.
|
||||||
* @param block The patch block. It is called with the client ID option.
|
* @param block The patch block. It is called with the client ID option.
|
||||||
*/
|
*/
|
||||||
fun spoofClientPatch(
|
fun `Spoof client`(
|
||||||
redirectUri: String,
|
redirectUri: String,
|
||||||
block: BytecodePatchBuilder.(Option<String>) -> Unit = {},
|
block: BytecodePatchBuilder.(Option<String>) -> Unit = {},
|
||||||
) = bytecodePatch(
|
) = creatingBytecodePatch(
|
||||||
name = "Spoof client",
|
|
||||||
description = "Restores functionality of the app by using custom client ID.",
|
description = "Restores functionality of the app by using custom client ID.",
|
||||||
) {
|
) {
|
||||||
block(
|
block(
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.baconreader.api
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
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.patches.shared.misc.string.replaceStringPatch
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
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.iface.reference.StringReference
|
||||||
import com.android.tools.smali.dexlib2.mutable.MutableMethod
|
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(
|
dependsOn(
|
||||||
// Redirects from SSL to WWW domain are bugged causing auth problems.
|
// Redirects from SSL to WWW domain are bugged causing auth problems.
|
||||||
// Manually rewrite the URLs to fix this.
|
// 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.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
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.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.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
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;"
|
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/baconreader/FixRedgifsApiPatch;"
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val fixRedgifsApi = fixRedgifsApiPatch(
|
val fixRedgifsApi = `Fix Redgifs API`(
|
||||||
extensionPatch = sharedExtensionPatch
|
extensionPatch = sharedExtensionPatch
|
||||||
) {
|
) {
|
||||||
compatibleWith(
|
compatibleWith(
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.boostforreddit.api
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
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.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.returnEarly
|
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
|
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val spoofClientPatch = spoofClientPatch(redirectUri = "http://rubenmayayo.com") { clientIdOption ->
|
val spoofClientPatch = `Spoof client`(redirectUri = "http://rubenmayayo.com") { clientIdOption ->
|
||||||
compatibleWith("com.rubenmayayo.reddit")
|
compatibleWith("com.rubenmayayo.reddit")
|
||||||
|
|
||||||
val clientId by clientIdOption
|
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.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patches.reddit.customclients.CREATE_NEW_CLIENT_METHOD
|
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.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.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
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;"
|
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/boostforreddit/FixRedgifsApiPatch;"
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val fixRedgifsApi = fixRedgifsApiPatch(
|
val fixRedgifsApi = `Fix Redgifs API`(
|
||||||
extensionPatch = sharedExtensionPatch
|
extensionPatch = sharedExtensionPatch
|
||||||
) {
|
) {
|
||||||
compatibleWith("com.rubenmayayo.reddit")
|
compatibleWith("com.rubenmayayo.reddit")
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
package app.revanced.patches.reddit.customclients.infinityforreddit.api
|
package app.revanced.patches.reddit.customclients.infinityforreddit.api
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.toInstructions
|
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.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodImplementation
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodImplementation
|
||||||
import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable
|
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(
|
compatibleWith(
|
||||||
"ml.docilealligator.infinityforreddit",
|
"ml.docilealligator.infinityforreddit",
|
||||||
"ml.docilealligator.infinityforreddit.plus",
|
"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.authUtilityUserAgentMethod
|
||||||
import app.revanced.patches.reddit.customclients.infinity.api.getClientIdMethod
|
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.patches.reddit.customclients.sync.detection.piracy.disablePiracyDetectionPatch
|
||||||
import app.revanced.util.returnEarly
|
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)
|
dependsOn(disablePiracyDetectionPatch)
|
||||||
|
|
||||||
compatibleWith(
|
compatibleWith(
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.redditisfun.api
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
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.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.returnEarly
|
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
|
import com.android.tools.smali.dexlib2.mutable.MutableMethod
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val spoofClientPatch = spoofClientPatch(redirectUri = "redditisfun://auth") { clientIdOption ->
|
val spoofClientPatch = `Spoof client`(redirectUri = "redditisfun://auth") { clientIdOption ->
|
||||||
compatibleWith(
|
compatibleWith(
|
||||||
"com.andrewshu.android.reddit",
|
"com.andrewshu.android.reddit",
|
||||||
"com.andrewshu.android.redditdonation",
|
"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.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
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.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
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
|
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val spoofClientPatch = spoofClientPatch(redirectUri = "dbrady://relay") { clientIdOption ->
|
val spoofClientPatch = `Spoof client`(redirectUri = "dbrady://relay") { clientIdOption ->
|
||||||
compatibleWith(
|
compatibleWith(
|
||||||
"free.reddit.news",
|
"free.reddit.news",
|
||||||
"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.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
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.reddit.customclients.sync.detection.piracy.disablePiracyDetectionPatch
|
||||||
import app.revanced.patches.shared.misc.string.replaceStringPatch
|
import app.revanced.patches.shared.misc.string.replaceStringPatch
|
||||||
import app.revanced.util.returnEarly
|
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 com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||||
import java.util.Base64
|
import java.util.Base64
|
||||||
|
|
||||||
val spoofClientPatch = spoofClientPatch(
|
val spoofClientPatch = `Spoof client`(
|
||||||
redirectUri = "http://redditsync/auth",
|
redirectUri = "http://redditsync/auth",
|
||||||
) { clientIdOption ->
|
) { clientIdOption ->
|
||||||
dependsOn(
|
dependsOn(
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.getInstruction
|
import app.revanced.patcher.extensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD
|
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.patches.reddit.customclients.sync.syncforreddit.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
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;"
|
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/syncforreddit/FixRedgifsApiPatch;"
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val fixRedgifsApi = fixRedgifsApiPatch(
|
val fixRedgifsApi = `Fix Redgifs API`(
|
||||||
extensionPatch = sharedExtensionPatch
|
extensionPatch = sharedExtensionPatch
|
||||||
) {
|
) {
|
||||||
compatibleWith(
|
compatibleWith(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue