Skip to content

Fix: generate poster thumbnails for tenant-page video uploads - #13

Merged
ralyodio merged 1 commit into
masterfrom
fix/tenant-video-thumbnails
Jul 10, 2026
Merged

Fix: generate poster thumbnails for tenant-page video uploads#13
ralyodio merged 1 commit into
masterfrom
fix/tenant-video-thumbnails

Conversation

@ralyodio

Copy link
Copy Markdown
Collaborator

The bug

On a tenant page (/?dn=moshcode.sh) uploaded videos showed a black box — no poster. The earlier thumbnail feature only covered the media-table video system (/api/media, /videos, dashboard Videos tab). Tenant pages use a separate store — /api/uploadconfig.videosTenant.tsx — which generated no thumbnail and rendered <video> with no poster.

Fix

  • /api/upload now extracts a poster frame (<name>_thumb.png) next to the mp4 and stores it on the video entry; DELETE removes it too.
  • Tenant.tsx renders <video poster={v.poster}>.
  • /api/media/[...path] serves by extension (png → image/png) instead of always video/mp4.
  • lib/media.ts extracts a reusable ffmpegPoster(input, output) (shared by both stores).
  • Both config sanitizers (account + tenant) now preserve videos {name,url,poster}, so a page save / provisionTenant no longer drops uploads or posters.

Verified (local, end-to-end)

  • upload to ?dn=moshcode.sh → response includes poster: /api/media/moshcode.sh/…_thumb.png; <name>_thumb.png (267 KB) written next to the mp4
  • tenant page HTML renders <video … poster="…_thumb.png">
  • poster serves 200 image/png; the mp4 still serves 206 video/mp4 with range
  • poster survives a config save (provision) via the new video passthrough

Note: videos uploaded before this fix need a re-upload to get a poster.

🤖 Generated with Claude Code

The tenant page (/?dn=<domain>) uses a separate video store — /api/upload →
config.videos → Tenant.tsx — that the earlier thumbnail work never touched, so
uploads there rendered <video> with no poster (black box). Now /api/upload
extracts a poster frame (<name>_thumb.png) next to the mp4 on the volume and
stores it on the video entry; Tenant.tsx renders it as the <video poster>.

- lib/media.ts: extract reusable ffmpegPoster(input, output)
- /api/upload: generate + store poster; DELETE removes it too
- /api/media/[...path]: content-type by extension (png → image/png), not always mp4
- lib/config.ts: TenantConfig.videos carries poster; configFor maps it through
- Tenant.tsx: <video poster={v.poster}>
- account + tenant config sanitizers preserve videos {name,url,poster} so a page
  save / provision no longer drops uploads or their posters

Note: pre-existing videos need a re-upload to get a poster.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio merged commit 6f0b79a into master Jul 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant