From 952ca300c033bb3a211097cb5c4ead9aad53543b Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 13 Nov 2026 20:28:20 -0700 Subject: [PATCH 1/2] fix: keep GIFs moving in reply contexts (v2.20.1) Mastodon turns GIFs into silent looping MP4s (gifv); only the first-frame preview was kept. The MP4 is now saved locally and played muted and looping with the still as poster. Animated GIFs from other sites are saved as animated WebP. Migration 025 adds reply_contexts.video and has fediverse contexts with an image fetched again once. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 11 +++ .../v2.20.1/2026-11-13-gifv-reply-context.md | 27 +++++++ migrations/025_reply_context_video.sql | 6 ++ starpunk/__init__.py | 12 ++- starpunk/avatars.py | 78 ++++++++++++++++--- starpunk/reply_context.py | 9 ++- starpunk/routes/public.py | 7 +- templates/partials/reply_context.html | 6 +- tests/test_reply_context_sources.py | 56 +++++++++++++ 9 files changed, 193 insertions(+), 19 deletions(-) create mode 100644 docs/design/v2.20.1/2026-11-13-gifv-reply-context.md create mode 100644 migrations/025_reply_context_video.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 74596bf..badfd25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.20.1] - 2026-11-13 + +### Fixed + +- A reply to a Mastodon post with a GIF showed a still image. Mastodon turns GIFs into short silent looping MP4s ("gifv"), and only their first frame was kept. The MP4 is now saved on this site and plays muted and looping, as on Mastodon, with the still image as its poster +- Animated GIFs (and animated WebP/PNG) from other sites stay animated in reply contexts instead of being cut to their first frame + +### Changed + +- Migration 025 adds `video` to `reply_contexts`, and has fediverse contexts with an image fetched again once, so existing replies pick up their gifv + ## [2.20.0] - 2026-11-13 ### Added diff --git a/docs/design/v2.20.1/2026-11-13-gifv-reply-context.md b/docs/design/v2.20.1/2026-11-13-gifv-reply-context.md new file mode 100644 index 0000000..d0a247f --- /dev/null +++ b/docs/design/v2.20.1/2026-11-13-gifv-reply-context.md @@ -0,0 +1,27 @@ +# v2.20.1: Moving pictures in reply contexts + +## Why + +The reply https://starpunk.thesatelliteoflove.com/note/20261114032356 answers +an infosec.exchange post with a GIF, but the card showed a still. Mastodon +converts uploaded GIFs to a silent looping MP4 (`media_attachments[].type == +"gifv"`, here 320×240, 5.3 s, ~140 KB). Its `preview_url` is a PNG of the +first frame, which is all v2.19.0 kept. + +## Changes + +| Area | Change | +|---|---| +| `reply_context._from_status` | A `gifv` attachment's `url` goes into the new `video` field (the preview stays in `photo`, used as the poster) | +| Migration 025 | `reply_contexts.video`; fediverse rows with a photo get `source = NULL`, so the worker's `refresh_stale` fetches them once more | +| `avatars.fetch_video` | Saves the MP4 as `DATA_PATH/previews/.mp4` (8 MB cap, must have an `ftyp` box); `fill_missing`/`remove_unused` cover it | +| `avatars._save` | Animated GIF/WebP/PNG previews are saved as animated WebP (frames narrowed to 640 px, at most 300 frames) instead of their first frame | +| `/previews/` | Also serves `.mp4` as `video/mp4` | +| Template | `