diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch.kt index ca00ee71f..1f7ead84e 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch.kt @@ -29,7 +29,7 @@ abstract class AbstractSpoofClientPatch( "The Reddit OAuth client ID. " + "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\"", + "and the redirect URI has to be set to \"$redirectUri\".", true ) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch.kt index 074323e88..9e91dcc6c 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch.kt @@ -9,10 +9,10 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion. 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.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch 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.api.fingerprints.ImgurImageAPIFingerprint 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 @@ -31,7 +31,9 @@ import java.util.* ) @Suppress("unused") object SpoofClientPatch : AbstractSpoofClientPatch( - "http://redditsync/auth", listOf(GetAuthorizationStringFingerprint) + "http://redditsync/auth", + clientIdFingerprints = listOf(GetAuthorizationStringFingerprint), + miscellaneousFingerprints = listOf(ImgurImageAPIFingerprint) ) { override fun List.patchClientId(context: BytecodeContext) { forEach { fingerprintResult -> @@ -67,4 +69,14 @@ object SpoofClientPatch : AbstractSpoofClientPatch( } } } + + // Use the non-commercial Imgur API endpoint. + override fun List.patchMiscellaneous(context: BytecodeContext) = first().let { + val apiUrlIndex = it.scanResult.stringsScanResult!!.matches.first().index + + it.mutableMethod.replaceInstruction( + apiUrlIndex, + "const-string v1, \"https://api.imgur.com/3/image\"" + ) + } } diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/ImgurImageAPIFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/ImgurImageAPIFingerprint.kt new file mode 100644 index 000000000..5dc5b5ed8 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/api/fingerprints/ImgurImageAPIFingerprint.kt @@ -0,0 +1,9 @@ +package app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints + +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint + +object ImgurImageAPIFingerprint : MethodFingerprint( + strings = listOf( + "https://imgur-apiv3.p.rapidapi.com/3/image", + ) +) \ No newline at end of file