Compare commits

..

2 Commits

Author SHA1 Message Date
semantic-release-bot
36e08dbe46 chore(release): 2.178.0-dev.8 [skip ci]
# [2.178.0-dev.8](https://github.com/revanced/revanced-patches/compare/v2.178.0-dev.7...v2.178.0-dev.8) (2023-06-20)

### Bug Fixes

* **boostforreddit:** use correct options ([8233c30](8233c30fc9))
2023-06-20 02:08:00 +00:00
oSumAtrIX
8233c30fc9 fix(boostforreddit): use correct options 2023-06-20 04:04:04 +02:00
5 changed files with 17 additions and 10 deletions

View File

@@ -1,3 +1,10 @@
# [2.178.0-dev.8](https://github.com/revanced/revanced-patches/compare/v2.178.0-dev.7...v2.178.0-dev.8) (2023-06-20)
### Bug Fixes
* **boostforreddit:** use correct options ([ec39732](https://github.com/revanced/revanced-patches/commit/ec39732a05f7c4c3360b8ba42fe50fd60952e6ac))
# [2.178.0-dev.7](https://github.com/revanced/revanced-patches/compare/v2.178.0-dev.6...v2.178.0-dev.7) (2023-06-19)

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.178.0-dev.7
version = 2.178.0-dev.8

View File

@@ -4,16 +4,15 @@ import android.os.Environment
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.*
import app.revanced.patches.reddit.customclients.boostforreddit.api.patch.ChangeOAuthClientIdPatch
import app.revanced.patches.reddit.customclients.syncforreddit.api.patch.ChangeOAuthClientIdPatch.Companion.clientId
import java.io.File
abstract class AbstractChangeOAuthClientIdPatch(
private val redirectUri: String,
private val options: ChangeOAuthClientIdOptionsContainer,
private val fingerprint: MethodFingerprint,
) : BytecodePatch(listOf(fingerprint)) {
override fun execute(context: BytecodeContext): PatchResult {
if (ChangeOAuthClientIdPatch.clientId == null) {
if (options.clientId == null) {
// Test if on Android
try {
Class.forName("android.os.Environment")
@@ -30,11 +29,11 @@ abstract class AbstractChangeOAuthClientIdPatch(
Alternatively, you can provide the client ID using patch options.
You can get your client ID from https://www.reddit.com/prefs/apps.
The application type has to be "installed app" and the redirect URI has to be set to "$redirectUri"
The application type has to be "Installed app" and the redirect URI has to be set to "$redirectUri".
""".trimIndent()
return PatchResultError(error)
}.let { clientId = it.readText().trim() }
}.let { options.clientId = it.readText().trim() }
}
return fingerprint.patch(context)

View File

@@ -18,6 +18,7 @@ import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints
@Version("0.0.1")
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
"http://rubenmayayo.com",
Options,
GetClientIdFingerprint
) {
override fun MethodFingerprint.patch(context: BytecodeContext): PatchResult {
@@ -32,5 +33,5 @@ class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
return PatchResultSuccess()
}
companion object : Options.ChangeOAuthClientIdOptionsContainer()
companion object Options : AbstractChangeOAuthClientIdPatch.Options.ChangeOAuthClientIdOptionsContainer()
}

View File

@@ -19,7 +19,6 @@ 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.")
@@ -27,6 +26,7 @@ import java.util.*
@Version("0.0.1")
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
"http://redditsync/auth",
Options,
GetAuthorizationStringFingerprint,
) {
override fun MethodFingerprint.patch(context: BytecodeContext): PatchResult {
@@ -51,7 +51,7 @@ class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
val newAuthorizationUrl = reference.string.replace(
"client_id=.*?&".toRegex(),
"client_id=${clientId!!}&"
"client_id=$clientId&"
)
replaceInstruction(
@@ -64,5 +64,5 @@ class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
return PatchResultSuccess()
}
companion object : Options.ChangeOAuthClientIdOptionsContainer()
companion object Options : AbstractChangeOAuthClientIdPatch.Options.ChangeOAuthClientIdOptionsContainer()
}