feat(Sync for Reddit - Client spoof): Restore upload functionality
This commit is contained in:
parent
ef644e4801
commit
9344c8a067
|
@ -29,7 +29,7 @@ abstract class AbstractSpoofClientPatch(
|
||||||
"The Reddit OAuth client ID. " +
|
"The Reddit OAuth client ID. " +
|
||||||
"You can get your client ID from https://www.reddit.com/prefs/apps. " +
|
"You can get your client ID from https://www.reddit.com/prefs/apps. " +
|
||||||
"The application type has to be \"Installed app\" " +
|
"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
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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.fingerprint.method.impl.MethodFingerprintResult
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
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.AbstractSpoofClientPatch
|
||||||
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.GetAuthorizationStringFingerprint
|
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.GetBearerTokenFingerprint
|
||||||
|
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.ImgurImageAPIFingerprint
|
||||||
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.DisablePiracyDetectionPatch
|
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.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
@ -31,7 +31,9 @@ import java.util.*
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SpoofClientPatch : AbstractSpoofClientPatch(
|
object SpoofClientPatch : AbstractSpoofClientPatch(
|
||||||
"http://redditsync/auth", listOf(GetAuthorizationStringFingerprint)
|
"http://redditsync/auth",
|
||||||
|
clientIdFingerprints = listOf(GetAuthorizationStringFingerprint),
|
||||||
|
miscellaneousFingerprints = listOf(ImgurImageAPIFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
|
override fun List<MethodFingerprintResult>.patchClientId(context: BytecodeContext) {
|
||||||
forEach { fingerprintResult ->
|
forEach { fingerprintResult ->
|
||||||
|
@ -67,4 +69,14 @@ object SpoofClientPatch : AbstractSpoofClientPatch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use the non-commercial Imgur API endpoint.
|
||||||
|
override fun List<MethodFingerprintResult>.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\""
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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",
|
||||||
|
)
|
||||||
|
)
|
Loading…
Reference in a new issue