forked from inotia00/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(relayforreddit): add
change-oauth-client-id
patch (ReVanced#2491)
Co-authored-by: oSumAtrIX <[email protected]>
- Loading branch information
1 parent
b15ee60
commit fe66f40
Showing
6 changed files
with
64 additions
and
32 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...in/kotlin/app/revanced/patches/reddit/customclients/ChangeOAuthClientIdPatchAnnotation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package app.revanced.patches.reddit.customclients | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.patch.annotations.Patch | ||
|
||
@Target(AnnotationTarget.CLASS) | ||
@Patch | ||
@Name("change-oauth-client-id") | ||
@Description("Changes the OAuth client ID.") | ||
annotation class ChangeOAuthClientIdPatchAnnotation |
28 changes: 11 additions & 17 deletions
28
...evanced/patches/reddit/customclients/boostforreddit/api/patch/ChangeOAuthClientIdPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
...nced/patches/reddit/customclients/infinityforreddit/api/patch/ChangeOAuthClientIdPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ed/patches/reddit/customclients/relayforreddit/api/fingerprints/GetClientIdFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
|
||
object GetClientIdFingerprint : MethodFingerprint( | ||
strings = listOf("AIzaSyCTQfRx9fHnDpfcfiI5pmwyGUBjDVTNvX8") | ||
) |
26 changes: 26 additions & 0 deletions
26
...evanced/patches/reddit/customclients/relayforreddit/api/patch/ChangeOAuthClientIdPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package app.revanced.patches.reddit.customclients.relayforreddit.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.replaceInstruction | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult | ||
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.relayforreddit.api.fingerprints.GetClientIdFingerprint | ||
|
||
@ChangeOAuthClientIdPatchAnnotation | ||
@Compatibility([Package("free.reddit.news"), Package("reddit.news")]) | ||
class ChangeOAuthClientIdPatch : AbstractChangeOAuthClientIdPatch( | ||
"dbrady://relay", Options, listOf(GetClientIdFingerprint) | ||
) { | ||
override fun List<MethodFingerprintResult>.patch(context: BytecodeContext): PatchResult { | ||
first().mutableMethod.replaceInstruction(0, "const-string v0, \"$clientId\"") | ||
|
||
return PatchResultSuccess() | ||
} | ||
|
||
companion object Options : AbstractChangeOAuthClientIdPatch.Options.ChangeOAuthClientIdOptionsContainer() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters