mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-17 08:13:56 +00:00
Compare commits
6 Commits
v2.179.0-d
...
v2.179.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15a53dab2b | ||
|
|
d29352418c | ||
|
|
e9ed39cd62 | ||
|
|
e06f7863b0 | ||
|
|
969f37f60e | ||
|
|
183f25d17c |
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -4,5 +4,5 @@
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="azul-17" project-jdk-type="JavaSDK" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="azul-17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,3 +1,24 @@
|
||||
# [2.179.0-dev.10](https://github.com/revanced/revanced-patches/compare/v2.179.0-dev.9...v2.179.0-dev.10) (2023-06-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **redditisfun/change-oauth-client-id:** add compatibility for paid versions ([#2536](https://github.com/revanced/revanced-patches/issues/2536)) ([e739d2f](https://github.com/revanced/revanced-patches/commit/e739d2fa16bbd0125db82c0758928addbd9950c9))
|
||||
|
||||
# [2.179.0-dev.9](https://github.com/revanced/revanced-patches/compare/v2.179.0-dev.8...v2.179.0-dev.9) (2023-06-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **redditisfun:** add `change-oauth-client-id` patch ([14809cd](https://github.com/revanced/revanced-patches/commit/14809cd4510ad9514b4a4820187a81681669374c))
|
||||
|
||||
# [2.179.0-dev.8](https://github.com/revanced/revanced-patches/compare/v2.179.0-dev.7...v2.179.0-dev.8) (2023-06-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **reddit:** add `disable-screenshot-popup` patch ([#2387](https://github.com/revanced/revanced-patches/issues/2387)) ([473e051](https://github.com/revanced/revanced-patches/commit/473e0512314dfa9790cf83b4cfcc7505058d3a51))
|
||||
|
||||
# [2.179.0-dev.7](https://github.com/revanced/revanced-patches/compare/v2.179.0-dev.6...v2.179.0-dev.7) (2023-06-28)
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 2.179.0-dev.7
|
||||
version = 2.179.0-dev.10
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
abstract class AbstractClientIdFingerprint(string: String) : MethodFingerprint(
|
||||
strings = listOfNotNull("yyOCBp.RHJhDKd", string),
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
package app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints
|
||||
|
||||
object BasicAuthorizationFingerprint : AbstractClientIdFingerprint(
|
||||
string = "fJOxVwBUyo*=f:<OoejWs:AqmIJ", // Encrypted basic authorization string.
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
package app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints
|
||||
|
||||
object BuildAuthorizationStringFingerprint : AbstractClientIdFingerprint(
|
||||
string = "client_id"
|
||||
)
|
||||
@@ -0,0 +1,57 @@
|
||||
package app.revanced.patches.reddit.customclients.redditisfun.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.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.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.redditisfun.api.fingerprints.BasicAuthorizationFingerprint
|
||||
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BuildAuthorizationStringFingerprint
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@ChangeOAuthClientIdPatchAnnotation
|
||||
@Compatibility([Package("com.andrewshu.android.reddit"), Package("com.andrewshu.android.redditdonation")])
|
||||
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch(
|
||||
"redditisfun://auth",
|
||||
Options,
|
||||
listOf(
|
||||
BuildAuthorizationStringFingerprint,
|
||||
BasicAuthorizationFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun List<MethodFingerprintResult>.patch(context: BytecodeContext): PatchResult {
|
||||
/**
|
||||
* Replaces a one register instruction with a const-string instruction
|
||||
* at the index returned by [getReplacementIndex].
|
||||
*
|
||||
* @param string The string to replace the instruction with.
|
||||
* @param getReplacementIndex A function that returns the index of the instruction to replace
|
||||
* using the [StringMatch] list from the [MethodFingerprintResult].
|
||||
*/
|
||||
fun MethodFingerprintResult.replaceWith(
|
||||
string: String,
|
||||
getReplacementIndex: List<StringMatch>.() -> Int,
|
||||
) = mutableMethod.apply {
|
||||
val replacementIndex = scanResult.stringsScanResult!!.matches.getReplacementIndex()
|
||||
val clientIdRegister = getInstruction<OneRegisterInstruction>(replacementIndex).registerA
|
||||
|
||||
replaceInstruction(replacementIndex, "const-string v$clientIdRegister, \"$string\"")
|
||||
}
|
||||
|
||||
// Patch OAuth authorization.
|
||||
first().replaceWith(clientId!!) { first().index + 4 }
|
||||
|
||||
// Path basic authorization.
|
||||
last().replaceWith("$clientId:") { last().index + 7 }
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object Options : AbstractChangeOAuthClientIdPatch.Options.ChangeOAuthClientIdOptionsContainer()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package app.revanced.patches.reddit.layout.disablescreenshotpopup.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.reddit.frontpage")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class DisableScreenshotPopupCompatibility
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.reddit.layout.disablescreenshotpopup.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object DisableScreenshotPopupFingerprint : MethodFingerprint(
|
||||
"V",
|
||||
parameters = listOf("Landroidx/compose/runtime/", "I"),
|
||||
customFingerprint = custom@{ methodDef, classDef ->
|
||||
if (!classDef.type.endsWith("\$ScreenshotTakenBannerKt\$lambda-1\$1;"))
|
||||
return@custom false
|
||||
|
||||
methodDef.name == "invoke"
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,30 @@
|
||||
package app.revanced.patches.reddit.layout.disablescreenshotpopup.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.reddit.layout.disablescreenshotpopup.annotations.DisableScreenshotPopupCompatibility
|
||||
import app.revanced.patches.reddit.layout.disablescreenshotpopup.fingerprints.DisableScreenshotPopupFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("disable-screenshot-popup")
|
||||
@Description("Disables the popup that shows up when taking a screenshot.")
|
||||
@DisableScreenshotPopupCompatibility
|
||||
@Version("0.0.1")
|
||||
class DisableScreenshotPopupPatch : BytecodePatch(
|
||||
listOf(DisableScreenshotPopupFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
DisableScreenshotPopupFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
|
||||
?: return DisableScreenshotPopupFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user