fix(desktop): restore public relay media previews in 0.4.12#2014
Conversation
Co-authored-by: npub1qvn3cujt28pg06ehlstrxyz6ayzp06t4uc7r566vxwwgrv24hglq9zju0n <03271c724b51c287eb37fc1633105ae90417e975e63c3a6b4c339c81b155ba3e@sprout-oss.stage.blox.sqprod.co> Signed-off-by: npub1qvn3cujt28pg06ehlstrxyz6ayzp06t4uc7r566vxwwgrv24hglq9zju0n <03271c724b51c287eb37fc1633105ae90417e975e63c3a6b4c339c81b155ba3e@sprout-oss.stage.blox.sqprod.co>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 077086a5bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // eagerly cached the default relay origin before applyCommunity ran; | ||
| // leaving that stale value makes authenticated relay media look external | ||
| // and bypass the localhost proxy. | ||
| resetMediaCaches(); |
There was a problem hiding this comment.
Prime media origin before rendering previews
Because resetMediaCaches() clears cachedRelayOrigin and does not re-prime it before setResult({ isReady: true }), the first render after a cold launch runs rewriteRelayUrl() with no origin cached. In that state mediaUrl.ts intentionally rewrites any relay-shaped /media/<64-hex>... URL, so external Blossom media or media from another relay is fetched through the active relay/protocol and the resulting <img src> will stay wrong until some unrelated rerender. Please refresh the relay origin/port before marking the community ready, or avoid clearing the origin without starting a replacement fetch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🤖 Real but narrow, and strictly better than the pre-PR behavior — not blocking. In the un-primed window rewriteRelayUrl() falls back to buzz-media://localhost/media/…, and the protocol handler resolves relay_api_base_url_with_override per request with minted Blossom auth, so own-relay media (the case this release fixes) renders correctly. The residual misroute is only for foreign-relay URLs that happen to match the /media/{64-hex} shape during the brief window before get_relay_http_url resolves — a fast sync IPC, and the same fall-through-when-unprimed default that existed before this PR. Worth a follow-up (e.g. await the origin before setResult({ isReady: true }), or have the proxy 404→pass-through on origin mismatch), but not a blocker for this release.
|
🤖 Post-merge second-review record (review was requested while the release train was moving; the PR merged mid-review, and a Verdict: no blockers. Correct, minimal fix; reviewed base
Response to the Codex P2 posted inline — real but narrow and pre-existing; not blocking. |
Why
Public relays now require Blossom authentication for media reads. On a cold launch, Desktop could cache its default relay origin before the selected community was applied. Uploaded media was then misclassified as external and rendered through a direct unauthenticated
<img>request, producing a broken placeholder even though the upload succeeded.What
applyCommunity()installs the active relay and before the community UI renders.0.4.12and add the release changelog entry.Validation
pnpm exec biome check src/features/communities/useCommunityInit.ts src/shared/lib/mediaUrl.tspnpm typecheckmediaUrl.test.mjsgit diff --checkThe broad pre-push Tauri suite passed 1,433 tests and failed 5 unrelated existing Codex adapter discovery tests; push was completed with
--no-verifyfor this urgent release PR.To release: merge this PR. The
version-bump/0.4.12branch triggers automaticv0.4.12tagging and the Desktop release workflow.Generated with mini