mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-23 10:41:03 +00:00
Compare commits
4 Commits
v4.14.0-de
...
v4.14.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4886a95713 | ||
|
|
58719239cf | ||
|
|
fcb68cc65e | ||
|
|
16217f012e |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
|||||||
|
# [4.14.0-dev.11](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.10...v4.14.0-dev.11) (2024-09-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **Sync for Reddit:** Rename patch to `Use /user/ endpoint` ([98ead49](https://github.com/ReVanced/revanced-patches/commit/98ead493380932cb105530f4ba992673fd364d82))
|
||||||
|
|
||||||
|
# [4.14.0-dev.10](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.9...v4.14.0-dev.10) (2024-09-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **Sync for Reddit:** Add `Fix /user/ endpoint` patch ([46d11f3](https://github.com/ReVanced/revanced-patches/commit/46d11f3530fcdae9ed08b7e93aac235638a92dff))
|
||||||
|
|
||||||
# [4.14.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.8...v4.14.0-dev.9) (2024-09-09)
|
# [4.14.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v4.14.0-dev.8...v4.14.0-dev.9) (2024-09-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -828,6 +828,12 @@ public final class app/revanced/patches/reddit/customclients/syncforreddit/fix/s
|
|||||||
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforreddit/fix/slink/FixSLinksPatch;
|
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforreddit/fix/slink/FixSLinksPatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/reddit/customclients/syncforreddit/fix/user/UseUserEndpointPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforreddit/fix/user/UseUserEndpointPatch;
|
||||||
|
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/reddit/customclients/syncforreddit/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch {
|
public final class app/revanced/patches/reddit/customclients/syncforreddit/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforreddit/misc/integrations/IntegrationsPatch;
|
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforreddit/misc/integrations/IntegrationsPatch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 4.14.0-dev.9
|
version = 4.14.0-dev.11
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package app.revanced.patches.reddit.customclients.syncforreddit.fix.user
|
||||||
|
|
||||||
|
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.MethodFingerprint
|
||||||
|
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.fix.user.fingerprints.*
|
||||||
|
import app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints.OAuthFriendRequestFingerprint
|
||||||
|
import app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints.OAuthSubredditInfoRequestHelperFingerprint
|
||||||
|
import app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints.OAuthUnfriendRequestFingerprint
|
||||||
|
import app.revanced.util.getReference
|
||||||
|
import app.revanced.util.resultOrThrow
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Use /user/ endpoint",
|
||||||
|
description = "Replaces the deprecated endpoint for viewing user profiles /u with /user, that used to fix a bug.",
|
||||||
|
compatiblePackages = [
|
||||||
|
CompatiblePackage("com.laurencedawson.reddit_sync"),
|
||||||
|
CompatiblePackage("com.laurencedawson.reddit_sync.pro"),
|
||||||
|
CompatiblePackage("com.laurencedawson.reddit_sync.dev"),
|
||||||
|
],
|
||||||
|
use = false,
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object UseUserEndpointPatch : BytecodePatch(
|
||||||
|
fingerprints = setOf(
|
||||||
|
OAuthFriendRequestFingerprint,
|
||||||
|
OAuthSubredditInfoRequestConstructorFingerprint,
|
||||||
|
OAuthSubredditInfoRequestHelperFingerprint,
|
||||||
|
OAuthUnfriendRequestFingerprint,
|
||||||
|
OAuthUserIdRequestFingerprint,
|
||||||
|
OAuthUserInfoRequestFingerprint,
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
arrayOf(
|
||||||
|
OAuthFriendRequestFingerprint,
|
||||||
|
OAuthSubredditInfoRequestConstructorFingerprint,
|
||||||
|
OAuthSubredditInfoRequestHelperFingerprint,
|
||||||
|
OAuthUnfriendRequestFingerprint,
|
||||||
|
OAuthUserIdRequestFingerprint,
|
||||||
|
OAuthUserInfoRequestFingerprint,
|
||||||
|
).map(MethodFingerprint::resultOrThrow).map {
|
||||||
|
it.scanResult.stringsScanResult!!.matches.first().index to it.mutableMethod
|
||||||
|
}.forEach { (userPathStringIndex, method) ->
|
||||||
|
val userPathStringInstruction = method.getInstruction<OneRegisterInstruction>(userPathStringIndex)
|
||||||
|
val userPathStringRegister = userPathStringInstruction.registerA
|
||||||
|
val fixedUserPathString = userPathStringInstruction.getReference<StringReference>()!!.string.replace("u/", "user/")
|
||||||
|
|
||||||
|
method.replaceInstruction(
|
||||||
|
userPathStringIndex,
|
||||||
|
"const-string v$userPathStringRegister, \"${fixedUserPathString}\"",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal abstract class BaseUserEndpointFingerprint(source: String, accessFlags: Int? = null) :
|
||||||
|
MethodFingerprint(
|
||||||
|
accessFlags = accessFlags,
|
||||||
|
strings = listOf("u/"),
|
||||||
|
customFingerprint = { _, classDef -> classDef.sourceFile == source },
|
||||||
|
)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints
|
||||||
|
|
||||||
|
internal object OAuthFriendRequestFingerprint : BaseUserEndpointFingerprint("OAuthFriendRequest.java")
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
internal object OAuthSubredditInfoRequestConstructorFingerprint :
|
||||||
|
BaseUserEndpointFingerprint(
|
||||||
|
"OAuthSubredditInfoRequest.java",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
internal object OAuthSubredditInfoRequestHelperFingerprint :
|
||||||
|
BaseUserEndpointFingerprint(
|
||||||
|
"OAuthSubredditInfoRequest.java",
|
||||||
|
AccessFlags.PRIVATE or AccessFlags.STATIC,
|
||||||
|
)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints
|
||||||
|
|
||||||
|
internal object OAuthUnfriendRequestFingerprint : BaseUserEndpointFingerprint("OAuthUnfriendRequest.java")
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints
|
||||||
|
|
||||||
|
internal object OAuthUserIdRequestFingerprint : BaseUserEndpointFingerprint("OAuthUserIdRequest.java")
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package app.revanced.patches.reddit.customclients.syncforreddit.fix.user.fingerprints
|
||||||
|
|
||||||
|
internal object OAuthUserInfoRequestFingerprint : BaseUserEndpointFingerprint("OAuthUserInfoRequest.java")
|
||||||
Reference in New Issue
Block a user