Shows the thumbnails a browser can't load from their own site: those on plain
http, which an https page would block, and those behind hotlink protection.
It fetches and caches the images GET /api/remote/image serves, which the
frontend routes a thumbnail through when it is on http or when loading it
directly failed, and scales them down as the site's own are.
Empties the cache, for the tests' reset between cases.
Returns the image at url, from the cache or else from its host; null when
the host answers with an error, or with anything but a raster image of 5 MB
at most. With width, it comes as a WebP copy scaled down to it, or as it
is when no copy can be made (scalableImage, and ffmpeg). The route checks
url with isValidHttpUrl first.
Returned to GET /api/remote/image by fetchProxiedImage, which sends
it back under contentType.
- bytes: Uint8Array
-
contentType: string
One of the raster types, without parameters.
Usage
import * as mod from "api/remote/image-proxy.ts";