Skip to content

fix RedGifs API for rif is fun - #96

Open
ricardoV94 wants to merge 1 commit into
wchill:devfrom
ricardoV94:feat/rif-redgifs
Open

fix RedGifs API for rif is fun#96
ricardoV94 wants to merge 1 commit into
wchill:devfrom
ricardoV94:feat/rif-redgifs

Conversation

@ricardoV94

@ricardoV94 ricardoV94 commented Jul 15, 2026

Copy link
Copy Markdown

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 (OkHttpClient is okhttp3.a0, etc.), so the shared BaseOkHttpRequestHook/interceptor path can't be linked against it. Instead, this hooks RIF's token-fetch method (located via the dead /v2/oauth/client string) and returns a valid RedGifs temporary token from the existing shared RedgifsTokenManager, which uses HttpURLConnection and has no OkHttp dependency. RIF's own Authorization: Bearer logic 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

  • Verified end-to-end on the v1.4.0 release 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/client path is bypassed, and confirmed RedGifs plays on-device.
  • Verified the RedGifs token flow live: temporary token → Bearer/v2/gifs/<id>200 + media URLs.
  • Ported to dev's current conventions (AppCompatibility.RedditIsFun, ExtensionPatches.RIF, object … : Fingerprint); the redditisfun extension module compiles against dev. I couldn't run a full dev build locally because dev's ExtensionPatches.kt requires a newer app.morphe.patches plugin than the published 1.3.2 (unrelated to this change) — the CI build will be authoritative.

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.
@ricardoV94 ricardoV94 changed the title feat: fix RedGifs API for rif is fun fix RedGifs API for rif is fun Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant