fix RedGifs API for rif is fun - #96
Open
ricardoV94 wants to merge 1 commit into
Open
Conversation
RIF authenticates to RedGifs via the removed /v2/oauth/client endpoint, so it never gets a token and RedGifs media fails to load. RIF's OkHttp is R8-minified, so the shared interceptor hook can't be linked; instead hook RIF's token-fetch method and return a valid temporary token from the shared RedgifsTokenManager (HttpURLConnection-based, no OkHttp dependency). RIF's existing Bearer logic then works unchanged.
4 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disclaimer: bot generated. I didn't open an issue because I had the fix already on my end. Take it or leave it :)
Adds a Fix Redgifs API patch for rif is fun (
com.andrewshu.android.reddit/redditdonation), which currently has no RedGifs support in patcheddit.Problem
RIF authenticates to RedGifs by requesting
https://api.redgifs.com/v2/oauth/client, which RedGifs removed. RIF never obtains a token, so all RedGifs media fails to load.Approach
Unlike Boost/BaconReader/Sync, RIF ships a fully R8-minified OkHttp (
OkHttpClientisokhttp3.a0, etc.), so the sharedBaseOkHttpRequestHook/interceptor path can't be linked against it. Instead, this hooks RIF's token-fetch method (located via the dead/v2/oauth/clientstring) and returns a valid RedGifs temporary token from the existing sharedRedgifsTokenManager, which usesHttpURLConnectionand has no OkHttp dependency. RIF's ownAuthorization: Bearerlogic then works unchanged.The RedGifs user agent is RIF's hardcoded default (
org.quantumbadger.redreader/1.25.1), which RedGifs binds the token to.Testing
v1.4.0release base: built the bundle, patched a clean RIF 5.6.22 with the full patch set, confirmed the injected bytecode returns the extension token and the dead/v2/oauth/clientpath is bypassed, and confirmed RedGifs plays on-device.Bearer→/v2/gifs/<id>→200+ media URLs.dev's current conventions (AppCompatibility.RedditIsFun,ExtensionPatches.RIF,object … : Fingerprint); theredditisfunextension module compiles againstdev. I couldn't run a fulldevbuild locally becausedev'sExtensionPatches.ktrequires a newerapp.morphe.patchesplugin than the published1.3.2(unrelated to this change) — the CI build will be authoritative.