Add image transform support for post cover thumbnails (#309)
* Use Supabase image transform for publication homepage cover thumbnails
Publication homepage post lists displayed full-resolution cover image
blobs (proxied from the PDS via /api/atproto_images) at small thumbnail
sizes. Now, when a cover image is present, request a downscaled version:
the proxy caches the blob in the url-previews bucket and redirects to a
Supabase image-transform URL sized for the variant, avoiding shipping the
full-size image just to render a thumbnail.
* Apply Supabase thumbnail transform to feed and standard-site post covers
Extend the cover-image thumbnail transform to the reader feed
(PostListing) and the standard-site post block (StandardSitePostItem),
which also rendered full-resolution cover blobs at thumbnail sizes.
* Stream transformed cover thumbnails instead of redirecting
Replace the 307 redirect to Supabase's public transform URL with
streaming the transformed bytes directly through the proxy. This keeps
thumbnails to a single round trip served with our own immutable cache
headers, avoiding the extra redirect hop on cold browser loads. The blob
is still cached in the url-previews bucket and downscaled via Supabase's
image transform on first request.
* Cache transformed cover thumbnails at the edge for a year
These thumbnails are derived from content-addressed (immutable) CIDs at a
fixed width, so they never change. Bump the thumbnail edge cache
(CDN-Cache-Control) from one day to a year to match the browser TTL and
avoid needless re-pulls of immutable content.
* Cache full-resolution PDS blobs at the edge for a year too
Full images are addressed by the same content-addressed (immutable) CIDs
as thumbnails, so bump their edge cache (CDN-Cache-Control) from one day
to a year as well. Generalize the shared constant now that both paths use
it.
* Simplify CDN cache comment
* Simplify thumbnail transform changes
- Reuse the shared supabaseServerClient instead of re-creating the
service-role client inline in the atproto_images route.
- Centralize the duplicated 800/360 thumbnail widths into a single
COVER_THUMBNAIL_WIDTH constant used by all three cover-image call sites.
---------
Co-authored-by: Claude <noreply@anthropic.com>
authored by