Fix: generate poster thumbnails for tenant-page video uploads - #13
Merged
Conversation
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>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/upload→config.videos→Tenant.tsx— which generated no thumbnail and rendered<video>with noposter.Fix
/api/uploadnow extracts a poster frame (<name>_thumb.png) next to the mp4 and stores it on the video entry; DELETE removes it too.Tenant.tsxrenders<video poster={v.poster}>./api/media/[...path]serves by extension (png → image/png) instead of alwaysvideo/mp4.lib/media.tsextracts a reusableffmpegPoster(input, output)(shared by both stores).videos {name,url,poster}, so a page save /provisionTenantno longer drops uploads or posters.Verified (local, end-to-end)
?dn=moshcode.sh→ response includesposter: /api/media/moshcode.sh/…_thumb.png;<name>_thumb.png(267 KB) written next to the mp4<video … poster="…_thumb.png">200 image/png; the mp4 still serves206 video/mp4with rangeNote: videos uploaded before this fix need a re-upload to get a poster.
🤖 Generated with Claude Code