fix(share): self-host og:image so link previews stay reliable

A remote thumbnail as og:image is unreliable for the crawler — Facebook's signed
CDN URL expires (so an old shared link's image later vanishes) and cross-origin
hotlinking is flaky. Record a self-hosted poster for EVERY download (ensure_poster
returns the existing <base>.jpg thumbnail sidecar, or cuts a frame) and point
og:image at our own /api/public/watch/{token}/poster.jpg. Backfill now fills
poster_path for all existing downloads, not just thumbnail-less ones.
This commit is contained in:
npeter83 2026-07-07 22:43:18 +02:00
parent 8b02b41059
commit b63b3334d6
4 changed files with 17 additions and 11 deletions

View file

@ -78,7 +78,9 @@ def run() -> dict:
a.uploader_url = uu
filled_url += 1
log.info("asset %s uploader_url <- %s", a.id, uu)
if a.thumbnail_url is None and a.poster_path is None:
if a.poster_path is None:
# Record a self-hosted poster for every download (the reliable og:image source):
# ensure_poster returns the existing <base>.jpg thumbnail sidecar, or cuts a frame.
rel = editmod.ensure_poster(a, settings.download_root)
if rel:
a.poster_path = rel