build(Needs bump): Bump dependencies (#2946)

Co-authored-by: Ushie <ushiekane@gmail.com>
Co-authored-by: aAbed <aabedhkhan@gmail.com>
Co-authored-by: CnC-Robert <CnC.Rob3rt@gmail.com>
This commit is contained in:
oSumAtrIX
2023-09-20 06:27:29 +02:00
co-authored by Ushie aAbed CnC-Robert
parent fe3a6fd4a4
commit 8c8dff9078
445 changed files with 4668 additions and 5477 deletions
@@ -6,22 +6,27 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.OptionsContainer
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchOption
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
import java.io.File
abstract class AbstractSpoofClientPatch(
private val redirectUri: String,
private val options: SpoofClientOptionsContainer,
private val clientIdFingerprints: List<MethodFingerprint>,
private val userAgentFingerprints: List<MethodFingerprint>? = null,
) : BytecodePatch(buildList {
) : BytecodePatch(buildSet {
addAll(clientIdFingerprints)
userAgentFingerprints?.let(::addAll)
}) {
var clientId by stringPatchOption(
"client-id",
null,
"OAuth client ID",
"The Reddit OAuth client ID."
)
override fun execute(context: BytecodeContext) {
if (options.clientId == null) {
if (clientId == null) {
// Ensure device runs Android.
try {
Class.forName("android.os.Environment")
@@ -42,7 +47,7 @@ abstract class AbstractSpoofClientPatch(
""".trimIndent()
throw PatchException(error)
}.let { options.clientId = it.readText().trim() }
}.let { clientId = it.readText().trim() }
}
fun List<MethodFingerprint>?.executePatch(
@@ -68,17 +73,4 @@ abstract class AbstractSpoofClientPatch(
*/
// Not every client needs to patch the user agent.
open fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext) {}
companion object Options {
open class SpoofClientOptionsContainer : OptionsContainer() {
var clientId by option(
PatchOption.StringOption(
"client-id",
null,
"OAuth client ID",
"The Reddit OAuth client ID."
)
)
}
}
}
@@ -1,9 +0,0 @@
package app.revanced.patches.reddit.customclients
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.Patch
@Target(AnnotationTarget.CLASS)
@Patch
@Name("Spoof client")
annotation class SpoofClientAnnotation
@@ -1,33 +1,31 @@
package app.revanced.patches.reddit.customclients.baconreader.api.patch
package app.revanced.patches.reddit.customclients.baconreader.api
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
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.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.baconreader.api.fingerprints.GetAuthorizationUrlFingerprint
import app.revanced.patches.reddit.customclients.baconreader.api.fingerprints.RequestTokenFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@SpoofClientAnnotation
@Description("Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"http://baconreader.com/auth\".")
@Compatibility(
[
Package("com.onelouder.baconreader"),
Package("com.onelouder.baconreader.premium")
@Patch(
name = "Spoof client",
description = "Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"http://baconreader.com/auth\".",
compatiblePackages = [
CompatiblePackage("com.onelouder.baconreader"),
CompatiblePackage("com.onelouder.baconreader.premium")
]
)
class SpoofClientPatch : AbstractSpoofClientPatch(
"http://baconreader.com/auth", Options, listOf(GetAuthorizationUrlFingerprint, RequestTokenFingerprint)
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
"http://baconreader.com/auth", listOf(GetAuthorizationUrlFingerprint, RequestTokenFingerprint)
) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
fun MethodFingerprintResult.patch(replacementString: String) {
val clientIdIndex = scanResult.stringsScanResult!!.matches.first().index
@@ -47,6 +45,4 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
// Patch client id for access token request.
last().patch(clientId!!)
}
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()
}
@@ -0,0 +1,31 @@
package app.revanced.patches.reddit.customclients.boostforreddit.api
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.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
@Patch(
name = "Spoof client",
description = "Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"http://rubenmayayo.com\".",
compatiblePackages = [CompatiblePackage("com.rubenmayayo.reddit")]
)
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
"http://rubenmayayo.com", listOf(GetClientIdFingerprint)
) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
first().mutableMethod.addInstructions(
0,
"""
const-string v0, "$clientId"
return-object v0
"""
)
}
}
@@ -1,32 +0,0 @@
package app.revanced.patches.reddit.customclients.boostforreddit.api.patch
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
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.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
@SpoofClientAnnotation
@Description("Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"http://rubenmayayo.com\".")
@Compatibility([Package("com.rubenmayayo.reddit")])
class SpoofClientPatch : AbstractSpoofClientPatch(
"http://rubenmayayo.com", Options, listOf(GetClientIdFingerprint)
) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
first().mutableMethod.addInstructions(
0,
"""
const-string v0, "$clientId"
return-object v0
"""
)
}
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()
}
@@ -1,26 +1,39 @@
package app.revanced.patches.reddit.customclients.infinityforreddit.api.patch
package app.revanced.patches.reddit.customclients.infinityforreddit.api
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
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.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints.GetHttpBasicAuthHeaderFingerprint
import app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints.LoginActivityOnCreateFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@SpoofClientAnnotation
@Description("Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"infinity://localhost\".")
@Compatibility([Package("ml.docilealligator.infinityforreddit", arrayOf("5.4.0", "5.4.1", "5.4.2", "6.0.1", "6.0.2", "6.0.4", "6.0.6", "6.1.1"))])
class SpoofClientPatch : AbstractSpoofClientPatch(
@Patch(
name = "Spoof client",
description = "Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"infinity://localhost\".",
compatiblePackages = [
CompatiblePackage(
"ml.docilealligator.infinityforreddit", [
"5.4.0",
"5.4.1",
"5.4.2",
"6.0.1",
"6.0.2",
"6.0.4",
"6.0.6",
"6.1.1"
]
)
]
)
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
"infinity://localhost",
Options,
listOf(GetHttpBasicAuthHeaderFingerprint, LoginActivityOnCreateFingerprint)
) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
@@ -37,6 +50,4 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
}
}
}
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()
}
@@ -1,22 +1,21 @@
package app.revanced.patches.reddit.customclients.joeyforreddit.ads.patch
package app.revanced.patches.reddit.customclients.joeyforreddit.ads
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.joeyforreddit.ads.fingerprints.IsAdFreeUserFingerprint
import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.patch.DisablePiracyDetectionPatch
import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.DisablePiracyDetectionPatch
@Patch
@Name("Disable ads")
@DependsOn([DisablePiracyDetectionPatch::class])
@Compatibility([Package("o.o.joey")])
class DisableAdsPatch : BytecodePatch(listOf(IsAdFreeUserFingerprint)) {
@Patch(
name = "Disable ads",
dependencies = [DisablePiracyDetectionPatch::class],
compatiblePackages = [CompatiblePackage("o.o.joey")]
)
@Suppress("unused")
object DisableAdsPatch : BytecodePatch(setOf(IsAdFreeUserFingerprint)) {
override fun execute(context: BytecodeContext) {
IsAdFreeUserFingerprint.result?.mutableMethod?.addInstructions(
0,
@@ -1,33 +1,30 @@
package app.revanced.patches.reddit.customclients.joeyforreddit.api.patch
package app.revanced.patches.reddit.customclients.joeyforreddit.api
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
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.annotations.DependsOn
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.joeyforreddit.api.fingerprints.GetClientIdFingerprint
import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.patch.DisablePiracyDetectionPatch
import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.DisablePiracyDetectionPatch
@SpoofClientAnnotation
@Description(
"Spoofs the client in order to allow logging in. " +
@Patch(
name = "Spoof client",
description = "Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"https://127.0.0.1:65023/authorize_callback\"."
)
@Compatibility(
[
Package("o.o.joey"),
Package("o.o.joey.pro"),
Package("o.o.joey.dev")
"and the redirect URI has to be set to \"https://127.0.0.1:65023/authorize_callback\".",
dependencies = [DisablePiracyDetectionPatch::class],
compatiblePackages = [
CompatiblePackage("o.o.joey"),
CompatiblePackage("o.o.joey.pro"),
CompatiblePackage("o.o.joey.dev")
]
)
@DependsOn([DisablePiracyDetectionPatch::class])
class SpoofClientPatch : AbstractSpoofClientPatch(
"https://127.0.0.1:65023/authorize_callback", Options, listOf(GetClientIdFingerprint)
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
"https://127.0.0.1:65023/authorize_callback", listOf(GetClientIdFingerprint)
) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
first().mutableMethod.addInstructions(
@@ -38,6 +35,4 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
"""
)
}
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()
}
@@ -1,4 +1,4 @@
package app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.patch
package app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
@@ -6,7 +6,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint
class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) {
object DisablePiracyDetectionPatch : BytecodePatch(setOf(PiracyDetectionFingerprint)) {
override fun execute(context: BytecodeContext) {
PiracyDetectionFingerprint.result?.mutableMethod?.addInstruction(
0,
@@ -1,29 +1,32 @@
package app.revanced.patches.reddit.customclients.redditisfun.api.patch
package app.revanced.patches.reddit.customclients.redditisfun.api
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
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
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult.StringMatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
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.GetUserAgentFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@SpoofClientAnnotation
@Description("Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"redditisfun://auth\".")
@Compatibility([Package("com.andrewshu.android.reddit"), Package("com.andrewshu.android.redditdonation")])
class SpoofClientPatch : AbstractSpoofClientPatch(
@Patch(
name = "Spoof client",
description = "Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"redditisfun://auth\".",
compatiblePackages = [
CompatiblePackage("com.andrewshu.android.reddit"),
CompatiblePackage("com.andrewshu.android.redditdonation")
]
)
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
"redditisfun://auth",
Options,
listOf(BuildAuthorizationStringFingerprint, BasicAuthorizationFingerprint),
listOf(GetUserAgentFingerprint)
) {
@@ -66,6 +69,4 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
"""
)
}
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()
}
@@ -1,28 +1,31 @@
package app.revanced.patches.reddit.customclients.relayforreddit.api.patch
package app.revanced.patches.reddit.customclients.relayforreddit.api
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
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.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.GetLoggedInBearerTokenFingerprint
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.GetLoggedOutBearerTokenFingerprint
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.GetRefreshTokenFingerprint
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.LoginActivityClientIdFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@SpoofClientAnnotation
@Description("Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"dbrady://relay\".")
@Compatibility([Package("free.reddit.news"), Package("reddit.news")])
class SpoofClientPatch : AbstractSpoofClientPatch(
@Patch(
name = "Spoof client",
description = "Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"dbrady://relay\".",
compatiblePackages = [
CompatiblePackage("free.reddit.news"),
CompatiblePackage("reddit.news")
]
)
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
"dbrady://relay",
Options,
listOf(
LoginActivityClientIdFingerprint,
GetLoggedInBearerTokenFingerprint,
@@ -43,6 +46,4 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
}
}
}
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()
}
@@ -0,0 +1,31 @@
package app.revanced.patches.reddit.customclients.slide.api
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.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
@Patch(
name = "Slide client spoof",
description = "Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"http://www.ccrama.me\".",
compatiblePackages = [CompatiblePackage("me.ccrama.redditslide")]
)
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
"http://www.ccrama.me", listOf(GetClientIdFingerprint)
) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
first().mutableMethod.addInstructions(
0,
"""
const-string v0, "$clientId"
return-object v0
"""
)
}
}
@@ -1,32 +0,0 @@
package app.revanced.patches.reddit.customclients.slide.api.patch
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
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.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
@SpoofClientAnnotation
@Description("Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"http://www.ccrama.me\".")
@Compatibility([Package("me.ccrama.redditslide")])
class SpoofClientPatch : AbstractSpoofClientPatch(
"http://www.ccrama.me", Options, listOf(GetClientIdFingerprint)
) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
first().mutableMethod.addInstructions(
0,
"""
const-string v0, "$clientId"
return-object v0
"""
)
}
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()
}
@@ -1,20 +1,21 @@
package app.revanced.patches.reddit.customclients.syncforreddit.ads.patch
package app.revanced.patches.reddit.customclients.syncforreddit.ads
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.syncforreddit.ads.fingerprints.IsAdsEnabledFingerprint
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.patch.DisablePiracyDetectionPatch
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.DisablePiracyDetectionPatch
@Patch
@Name("Disable ads")
@DependsOn([DisablePiracyDetectionPatch::class])
@Compatibility([Package("com.laurencedawson.reddit_sync")])
class DisableAdsPatch : BytecodePatch(listOf(IsAdsEnabledFingerprint)) {
@Patch(
name = "Disable ads",
dependencies = [DisablePiracyDetectionPatch::class],
compatiblePackages = [CompatiblePackage("com.laurencedawson.reddit_sync")]
)
@Suppress("unused")
object DisableAdsPatch : BytecodePatch(setOf(IsAdsEnabledFingerprint)) {
override fun execute(context: BytecodeContext) {
IsAdsEnabledFingerprint.result?.mutableMethod?.apply {
addInstructions(
@@ -26,5 +27,4 @@ class DisableAdsPatch : BytecodePatch(listOf(IsAdsEnabledFingerprint)) {
)
} ?: throw IsAdsEnabledFingerprint.exception
}
}
@@ -0,0 +1,30 @@
package app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.fingerprints.MainActivityOnCreate
@Patch(
name = "Disable Sync for Lemmy bottom sheet",
description = "Disables the bottom sheet at the startup that asks you to signup to \"Sync for Lemmy\".",
compatiblePackages = [
CompatiblePackage("com.laurencedawson.reddit_sync", ["v23.06.30-13:39"]),
CompatiblePackage("com.laurencedawson.reddit_sync.pro"), // Version unknown.
CompatiblePackage("com.laurencedawson.reddit_sync.dev") // Version unknown.
]
)
@Suppress("unused")
object DisableSyncForLemmyBottomSheetPatch : BytecodePatch(setOf(MainActivityOnCreate)) {
override fun execute(context: BytecodeContext) {
MainActivityOnCreate.result?.mutableMethod?.apply {
val showBottomSheetIndex = implementation!!.instructions.lastIndex - 1
removeInstruction(showBottomSheetIndex)
} ?: throw MainActivityOnCreate.exception
}
}
@@ -1,31 +0,0 @@
package app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.patch
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.fingerprints.MainActivityOnCreate
@Patch
@Name("Disable Sync for Lemmy bottom sheet")
@Description("Disables the bottom sheet at the startup that asks you to signup to \"Sync for Lemmy\".")
@Compatibility(
[
Package("com.laurencedawson.reddit_sync", ["v23.06.30-13:39"]),
Package("com.laurencedawson.reddit_sync.pro"), // Version unknown.
Package("com.laurencedawson.reddit_sync.dev") // Version unknown.
]
)
class DisableSyncForLemmyBottomSheetPatch : BytecodePatch(listOf(MainActivityOnCreate)) {
override fun execute(context: BytecodeContext) {
MainActivityOnCreate.result?.mutableMethod?.apply {
val showBottomSheetIndex = implementation!!.instructions.lastIndex - 1
removeInstruction(showBottomSheetIndex)
}
}
}
@@ -1,40 +1,38 @@
package app.revanced.patches.reddit.customclients.syncforreddit.api.patch
package app.revanced.patches.reddit.customclients.syncforreddit.api
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
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
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.SpoofClientAnnotation
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.detection.piracy.patch.DisablePiracyDetectionPatch
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.DisablePiracyDetectionPatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.reference.StringReference
import java.util.*
@SpoofClientAnnotation
@Description("Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"http://redditsync/auth\".")
@Compatibility(
[
Package("com.laurencedawson.reddit_sync"),
Package("com.laurencedawson.reddit_sync.pro"),
Package("com.laurencedawson.reddit_sync.dev")
@Patch(
name = "Spoof client",
description = "Spoofs the client in order to allow logging in. " +
"The OAuth application type has to be \"Installed app\" " +
"and the redirect URI has to be set to \"http://redditsync/auth\".",
dependencies = [DisablePiracyDetectionPatch::class],
compatiblePackages = [
CompatiblePackage("com.laurencedawson.reddit_sync"),
CompatiblePackage("com.laurencedawson.reddit_sync.pro"),
CompatiblePackage("com.laurencedawson.reddit_sync.dev")
]
)
@DependsOn([DisablePiracyDetectionPatch::class])
class SpoofClientPatch : AbstractSpoofClientPatch(
"http://redditsync/auth", Options, listOf(GetAuthorizationStringFingerprint)
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
"http://redditsync/auth", listOf(GetAuthorizationStringFingerprint)
) {
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
forEach { fingerprintResult ->
@@ -70,6 +68,4 @@ class SpoofClientPatch : AbstractSpoofClientPatch(
}
}
}
companion object Options : AbstractSpoofClientPatch.Options.SpoofClientOptionsContainer()
}
@@ -1,13 +1,14 @@
package app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.patch
package app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy
import app.revanced.patcher.annotation.Description
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint
@Description("Disables detection of modified versions.")
class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) {
@Patch(description = "Disables detection of modified versions.",)
object DisablePiracyDetectionPatch : BytecodePatch(setOf(PiracyDetectionFingerprint)) {
override fun execute(context: BytecodeContext) {
// Do not return an error if the fingerprint is not resolved.
// This is fine because new versions of the target app do not need this patch.
@@ -18,6 +19,6 @@ class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerpr
return-void
"""
)
}
} ?: throw PiracyDetectionFingerprint.exception
}
}