Resolves the dump whose media a route under /api/dumps/:dumpId/ serves:
its file (routes/files.ts), its thumbnail (routes/thumbnails.ts) or its
waveform (routes/waveforms.ts). Media elements and <img>s can't send an
Authorization header, so these routes take the viewer's media token from
the query string, and are cached by the file's version.
f
resolveMediaDump(): Promise<{ dump: Dump; cacheControl: string; }>
ctx: Context,
dumpId: string
Returns dump dumpId as the viewer of ctx's ?token= may see it, and the
Cache-Control its media get: kept for good under a URL naming the file's
current version (?v=, as dumpFileVersion gives), revalidated under any
other, and never in a shared cache for a private dump. It also keeps the
token out of the Referer of whatever the response links to.
Usage
import * as mod from "api/lib/dump-media.ts";