Repository navigation
fix: load post comments via Reddit GraphQL (v2.3.8) - #27
Merged
Merged
Conversation
Reddit rejects anonymous comments JSON requests with an HTML 403, including encoded-slash paths. Fetch post metadata through by_id and transform the Android PostComments forest into the Listing shape used by the renderer. Keep sorting, focused comment context, nested replies, and cursor pagination. Escape rich text and reject unsafe URL schemes; report upstream HTTP/API failures without treating them as JSON syntax errors. Cache successful thread responses for 30 seconds and keep existing OAuth and post access checks. Adapt the converter and RTJSON renderer from polak14's a63460b implementation, without the unrelated dependency updates or Shreddit scraper fallback. Validation: nine GraphQL converter/request tests, cargo fmt and strict clippy; live anonymous GraphQL requests from the affected container validate sorts, focused comments, and cursor pagination. Co-authored-by: polak14 <76823966+polak14@users.noreply.github.com>
Reddit returns DEPENDENCY_FAILURE when PostComments combines an after cursor with focusedCommentContext. A cursor already identifies its subtree, so only send focused context for the initial permalink request. Cover this with request-variable tests and verify the failing nested cursor against the live API.
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.
v2.3.7's encoded-slash workaround no longer works: Reddit now 403s
/comments/JSON routes including%2F(upstream issue redlib-org#591).Ports open upstream PR redlib-org#603 (2 commits, authorship kept):
/by_id/t3_{id}.jsonPostCommentspersisted GraphQL op ongql-fed.reddit.com, converted to the existing two-Listing shape (sorts, focused comment context, cursor pagination)Fork adaptations: kept fork's
post.htmltitle block;CLIENT.load()(fork's client isArcSwap). Version → 2.3.8.Verified live from the cluster egress IP (curl_cffi, same Android OAuth flow): comments JSON → 403 (plain and
%2F),/by_id→ 200, GraphQL PostComments → 200 with 141 comment trees for /r/comfyui 1x8tsgo.