fix(api): restore CORS, unify media field, add upstream tweet fields#24
Merged
guanbinrui merged 1 commit intoMay 22, 2026
Merged
Conversation
Fixes four issues introduced or exposed by the upstream zedeus merge:
1. **Media field breaking change** — replaced split `photos`/`videos`/`gifs`
fields with a unified `media` array. Each element carries a `type`
discriminator ("photo"/"video"/"gif") so consumers don't need to infer
kind from field presence. Video variants serialize `contentType` as the
MIME string (not ordinal). This matches the intent of the `main` branch
(`b4c0104`) and aligns with the upstream `MediaEntities` model.
2. **New upstream tweet fields** — added `history` (edit IDs), `note`
(community note text), `isAd`, `isAI`, and `stats.views` to
`formatTweetAsJson` so callers can act on upstream data.
3. **Unused `prefs` variable in search.nim** — removed the dead
`prefs = requestPrefs()` binding that was never referenced after the
`cookiePrefs()` → `requestPrefs()` fix in the merge.
4. **CORS support** — re-applied from `feat/cors-support` (f9c6ff8) which
was never merged into master. Added `corsOrigin()` template and CORS
response headers to all `respJson*` helpers, updated the health endpoint,
and added an `options re"/api/.*"` preflight handler in `nitter.nim`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
guanbinrui
added a commit
that referenced
this pull request
May 22, 2026
* Make maxConcurrentReqs configurable (zedeus#1341) * Fix the checkmark position (zedeus#1347) Co-authored-by: yav <796176@protonmail.com> * Add user-agent to guest_token request (zedeus#1359) * Fix /pic/ exploit * Add bulk script create_sessions_browser.py * Add preference for configuring sticky navbar Fixes zedeus#1354 * Support restoring preferences via new prefs param Fixes zedeus#1352 Fixes zedeus#553 Fixes zedeus#249 * Support preference overrides using URL params Fixes zedeus#186 * Bump css version * Support image alt text Fixes zedeus#559 * Fix invalid search link formatting * Add config options to enable subset of RSS feeds Fixes zedeus#1363 * Add dynamic-range-limit to prevent HDR jumpscares Fixes zedeus#1345 * Make "Tweet unavailable" clickable and consistent * Fix "Replying to" parsing * Bump style version * Add full support for tweet edit history Fixes zedeus#700 * Add community notes support Fixes zedeus#727 Fixes zedeus#1023 * Add community notes to RSS * Update and speed up GitHub workflows (zedeus#1368) * Update actions and switch to GitHub runners * Bump workflow Python version to 3.14 * Reuse nitter build for integration test * Add missing libpcre3 installation to workflow * Consolidate workflow runtime deps install * Make nitter binary executable * Run nimble md and scss simultaneously in workflow * Run tests with 4 workers in workflow * Rerun failing integration tests * Bump integration test workers to 5 * Improve python dep install and run less workers * Use native GitHub Actions Redis service * Lower integration test workers to 2 * Switch to poetry to cache venv * Ensure poetry is installed before setup-python * Fix poetry sync command * Switch back to 3 workers * Cache poetry install * WIP * WIP * Fix poetry/pipx caching * Speed up integration test significantly * WIP * Cleanup * Fix video thumbnails not loading Fixes zedeus#1371 * Fix incorrect multi-user search query Fixes zedeus#1373 * Fix search repeating when the end has been reached * Fix segfault * Implement mixed-media tweet support Fixes zedeus#697 zedeus#1101 * Update gif class in tests * Add workaround for broken "until" search filter Fixes zedeus#1372 * Add new media grid and gallery views Fixes zedeus#199 Fixes zedeus#1342 * Support tweet content disclosures (AI and ads) Fixes zedeus#1374 * Bump css * Add configurable retry logic Fixes zedeus#1382 * Fix mobile gallery and grid, add size preference Fixes zedeus#1379 * Fix null legacy tweet crash Fixes zedeus#1383 * Increase maxRetries in CI conf * Add support for viewing account info Fixes zedeus#1381 * Increase CI test maxRetries * Increase CI reruns * Add support for broadcasts Fixes zedeus#303 * Fix verified type enum parsing error Fixes zedeus#1387 * Fix thread test * fix(api): restore CORS, unify media field, add upstream tweet fields (#24) Fixes four issues introduced or exposed by the upstream zedeus merge: 1. **Media field breaking change** — replaced split `photos`/`videos`/`gifs` fields with a unified `media` array. Each element carries a `type` discriminator ("photo"/"video"/"gif") so consumers don't need to infer kind from field presence. Video variants serialize `contentType` as the MIME string (not ordinal). This matches the intent of the `main` branch (`b4c0104`) and aligns with the upstream `MediaEntities` model. 2. **New upstream tweet fields** — added `history` (edit IDs), `note` (community note text), `isAd`, `isAI`, and `stats.views` to `formatTweetAsJson` so callers can act on upstream data. 3. **Unused `prefs` variable in search.nim** — removed the dead `prefs = requestPrefs()` binding that was never referenced after the `cookiePrefs()` → `requestPrefs()` fix in the merge. 4. **CORS support** — re-applied from `feat/cors-support` (f9c6ff8) which was never merged into master. Added `corsOrigin()` template and CORS response headers to all `respJson*` helpers, updated the health endpoint, and added an `options re"/api/.*"` preflight handler in `nitter.nim`. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(ci): remove test workflows Delete run-tests.yml entirely and remove the tests job + needs dependency from build-docker.yml so Docker builds no longer gate on the test suite. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: jackyzy823 <jackyzy823@gmail.com> Co-authored-by: yav <150280490+796176@users.noreply.github.com> Co-authored-by: yav <796176@protonmail.com> Co-authored-by: cmj <129799+cmj@users.noreply.github.com> Co-authored-by: Zed <zedeus@pm.me> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
photos/videos/gifsfields (introduced by the upstream merge when it adapted the newMediaEntitiesmodel) with a unifiedmediaarray. Each element has an explicit"type"discriminator ("photo"/"video"/"gif"). Video variants serializecontentTypeas the MIME string. This matches themainbranch intent (b4c0104) and avoids the"video"→"videos"rename that would have broken existing consumers.history(edit history IDs),note(community note text),isAd,isAI, andstats.viewstoformatTweetAsJson. These upstream fields were being silently dropped.search.nim— removed unusedprefs = requestPrefs()that was left behind by thecookiePrefs()→requestPrefs()fix in the merge.feat/cors-support(f9c6ff8) which was never merged into master. AddscorsOrigin()template + CORS headers to allrespJson*helpers, updates the health endpoint, and adds anoptions re"/api/.*"preflight handler innitter.nim.Files changed
src/jsons/timeline.nimformatMediaAsJson, unify media field, add upstream fields, remove duplicate importssrc/jsons/search.nimprefsbindingsrc/jsons/health.nimsrc/routes/router_utils.nimcorsOrigin(), add CORS headers to allrespJson*templatessrc/nitter.nimimport re, add OPTIONS preflight handlerTest plan
nimble build)GET /api/healthreturns200withAccess-Control-Allow-OriginheaderOPTIONS /api/elonmuskreturns204with full CORS preflight headersGET /api/elonmuskreturns tweet objects withmediaarray (notphotos/videos/gifs)media[0].type == "video"andmedia[0].variantscontains MIME stringshistoryarray is populatednotefield is non-empty stringGET /api/search?q=teststill works (noprefscompile error)🤖 Generated with Claude Code