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:
parent
8b02b41059
commit
b63b3334d6
4 changed files with 17 additions and 11 deletions
|
|
@ -428,10 +428,11 @@ def _download(job_id: int, asset_id: int, source_kind: str, source_ref: str, spe
|
|||
asset.uploader_url = _uploader_url(info)
|
||||
asset.upload_date = meta.upload_date
|
||||
asset.thumbnail_url = meta.thumbnail_url
|
||||
# No thumbnail from the source (e.g. a direct media URL) → cut a poster frame from
|
||||
# the file so the card / watch page / link preview still shows an image.
|
||||
if not meta.thumbnail_url:
|
||||
asset.poster_path = editmod.ensure_poster(asset, settings.download_root)
|
||||
# Record a self-hosted poster for every download: it's the reliable link-preview
|
||||
# (og:image) source — a remote thumbnail, esp. Facebook's signed CDN URL, expires
|
||||
# and can't be relied on cross-origin. write_sidecars already wrote <base>.jpg from
|
||||
# the thumbnail; ensure_poster returns that, or cuts a frame if there was none.
|
||||
asset.poster_path = editmod.ensure_poster(asset, settings.download_root)
|
||||
asset.source_webpage_url = info.get("webpage_url")
|
||||
asset.nfo_written = nfo_ok
|
||||
asset.error = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue