Captions for uploaded videos (migration 066)
Video blocks get a Captions field and the hero a Video captions field, each a WebVTT upload drawn as <track kind="captions" default> on a video file. The media library takes .vtt (sniffed by its WEBVTT header, kept as is, always in /uploads/captions/) with its own tab. Newsletter parts leave the field out. nginx needs text/vtt in mime.types: docs/media-uploads.md, step 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
aaab1a945c
commit
33be618331
18 changed files with 123 additions and 43 deletions
|
|
@ -15,8 +15,10 @@ in the `media` table (`server/src/migrations/028_media.sql`).
|
|||
- **Keep original** stores the file exactly as uploaded (up to 10 MB),
|
||||
metadata and all.
|
||||
- SVGs are always kept as they are.
|
||||
- Accepted types: JPEG, PNG, GIF, WebP, SVG. The type is read from the
|
||||
file's contents, not its name.
|
||||
- Accepted types: JPEG, PNG, GIF, WebP, SVG, and WebVTT captions
|
||||
(`.vtt`, kept as they are, always in `captions/`). The type is read
|
||||
from the file's contents, not its name: a captions file has to start
|
||||
with `WEBVTT`.
|
||||
- Editors and up can upload. Admins and up can delete. The Media page
|
||||
shows which tables still use a file before deleting it, because
|
||||
nothing stops a file a record uses from being deleted.
|
||||
|
|
@ -33,6 +35,7 @@ Images are kept in folders by what they're for (`FOLDERS` in
|
|||
| `logos/` | Uploads from logo and icon fields (organization, team, award and event logos, the favicon and home-screen icon): the fields with `folder: "logos"` in `src/lib/adminSchema/` |
|
||||
| `images/` | Every other upload: photos, backgrounds, covers, block images |
|
||||
| `thumbnails/` | Pictures the site saves by itself: link previews (Fetch preview) and Drive files' first pages |
|
||||
| `captions/` | WebVTT files for uploaded videos: the Captions field of video blocks and the hero's Video captions (migration 066). YouTube, Vimeo and Facebook videos show their own |
|
||||
|
||||
Each image's `-640.webp` small copy sits beside it. Video and audio
|
||||
clips (Tools → Video clips) stay in the root. The Media page and every
|
||||
|
|
@ -100,3 +103,15 @@ which git ignores). The API serves `/uploads/` itself, and Vite proxies
|
|||
4. `sharp` is a server dependency now: run `pnpm install` in
|
||||
`/srv/ngu-api` after the deploy. It ships prebuilt Linux binaries,
|
||||
so no build tools are needed.
|
||||
|
||||
5. Captions need nginx to send `.vtt` files as `text/vtt` (Firefox
|
||||
won't show them otherwise, and `nosniff` stops guessing). Check:
|
||||
|
||||
```sh
|
||||
grep vtt /etc/nginx/mime.types
|
||||
```
|
||||
|
||||
If nothing comes back, add `text/vtt vtt;` inside the `types { }`
|
||||
block of `/etc/nginx/mime.types`, then
|
||||
`sudo nginx -t && sudo systemctl reload nginx`. Not in the site's
|
||||
own file: a `types` block there replaces the whole list.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue