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 <noreply@anthropic.com>
This commit is contained in:
1 parent
03a1c8fcea
commit
952ca300c0
9 files changed
+193
-19
No files matched your search
@@ -268,12 +268,13 @@ def avatar(name: str):
|
||||
def preview(name: str):
|
||||
"""A saved copy of a replied-to post's image (v2.19.0)"""
|
||||
from pathlib import Path
|
||||
from starpunk.avatars import NAME_RE, preview_folder
|
||||
from starpunk.avatars import NAME_RE, VIDEO_NAME_RE, preview_folder
|
||||
|
||||
if not NAME_RE.match(name):
|
||||
if not (NAME_RE.match(name) or VIDEO_NAME_RE.match(name)):
|
||||
abort(404)
|
||||
response = send_from_directory(
|
||||
preview_folder(Path(current_app.config.get('DATA_PATH', 'data'))), name)
|
||||
preview_folder(Path(current_app.config.get('DATA_PATH', 'data'))), name,
|
||||
mimetype='video/mp4' if name.endswith('.mp4') else None)
|
||||
response.headers['Cache-Control'] = 'public, max-age=604800'
|
||||
return response
|
||||
|
||||
|
||||
Reference in new issue
Block a user