Reads other sites for the client, as api/remote/ does for the server: the
previews of links on the create form, the images its thumbnails can't load
directly, and the tracks the players list. On any failure of the last two,
the player falls back to the embed.
GET /api/remote/preview?url=— signed in. Answers the preview of a link, and whether its page could be reached.GET /api/remote/image?url=&w=— public. Serves a remote raster image through this site, scaled down tow(shared/image.ts) when it names one; 400 when it isn't an image, 502 when its host can't be reached.GET /api/remote/bandcamp?url=&force=— public. Answers a Bandcamp page's tracks and their stream URLs, for the native player;force=1skips the server's cache.GET /api/remote/youtube?list=— public. Answers a YouTube playlist's tracklist, which the global player lists beside the embed.
v
default: Router
Mounted by api/main.ts behind the error, Open Graph and CORS middleware.
An APIException thrown by a handler becomes the JSON error response there.
Usage
import * as mod from "api/routes/remote.ts";