Stores and serves the images pasted or dropped into the text editor, which puts each one in the body as a link to its GET URL.

  • POST /api/attachments — signed in. Stores an image (multipart file, at most 5 MB) and answers its id.
  • GET /api/attachments/:attachmentId?w=&token= — public, but an image in a private dump or playlist, or in a comment on a private dump, needs its owner's media token. Serves the image, scaled down to w (shared/image.ts) when it names one.

Variables

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/attachments.ts";