diff options
| author | Adam Soltys <[email protected]> | 2026-10-11 22:06:12 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-11 22:06:12 -0700 |
| commit | 8ff0bf21e308d4907cc2620d80f238a10341a28d (patch) | |
| tree | 4e6e6a3995fc4d469313100b69ef9768c330aadc /vmedia/Dockerfile | |
| parent | a34769e3f60aa5b6920e4e2c9e0a9ee1013cacd1 (diff) | |
| download | coinosv3-8ff0bf21e308d4907cc2620d80f238a10341a28d.tar.gz coinosv3-8ff0bf21e308d4907cc2620d80f238a10341a28d.zip | |
Feed: a picture from a host that won't hand over its bytes paints from a server-made copy. The app shrinks a post's photo to the column's size itself (an 1100px copy made once, kept on disk) — but only when the host allows CORS; one that doesn't (primal's blossom, nostrcheck, most personal sites) left the <img> painting the original, and a 9528×6328 camera file froze a wheel scroll for 400 ms on its texture upload. vmedia now has /vmedia/pic.webp?s=col|tile&u=<picture>: the picture at 1100px wide (or a 360px square of its middle for the grid), made with libvips (shrink-on-load, so the original is never decoded whole; turned the way its EXIF says; alpha kept; stripped) as WebP, cached on disk and at the CDN for everyone. The usual guards: https on public addresses only, each redirect's host checked, 60 MB cap, the bytes sniffed (a GIF is refused — its copy would be a still), a few jobs at a time, 600 new copies per address per hour, an 8 GB cache. The client asks the server for the column copy when the host is known to keep its bytes (or has just refused, or there's no worker to make one here), keeps it in the same cache as the copies it makes, and takes the server's tile for the grid the same way; a picture the server has no copy for paints as before. The container gets libvips-tools (Dockerfile). tools/pic-proxy-test.js (canned server answers). Server measured on cs: a 3072×4608 photo in 0.5 s the first time, a millisecond after; feed-stability's two pre-existing asserts still fail on 491904e.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'vmedia/Dockerfile')
| -rw-r--r-- | vmedia/Dockerfile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vmedia/Dockerfile b/vmedia/Dockerfile index 336ddff..3552f5f 100644 --- a/vmedia/Dockerfile +++ b/vmedia/Dockerfile @@ -1,8 +1,8 @@ -# vmedia: bun + ffmpeg. Built and run on cs (see vmedia/server.js): +# vmedia: bun + ffmpeg + libvips. Built and run on cs (see vmedia/server.js): # docker build -t vmedia vmedia/ # docker run -d --name vmedia --network net --restart unless-stopped --cpus 6 --memory 3g \ # -v ~/vmedia/server.js:/app/server.js:ro -v ~/vmedia/data:/data vmedia FROM oven/bun:1 -RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg ca-certificates && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg libvips-tools ca-certificates && rm -rf /var/lib/apt/lists/* WORKDIR /app CMD ["bun", "server.js"] |
