feat(downloads): a clip or an edit can be a GIF, shared as a picture

A clip and an editor range can come out as a silent GIF (long side
320/480/640, 12 fps, at most 30 s, one palette per GIF); one over 30 MB
is not kept. A shared picture is served inline under the preview's
sandbox, and a GIF's link card is the GIF itself up to 15 MB, the still
for Facebook's crawler.
This commit is contained in:
2026-11-11 01:50:55 +01:00
parent fe38c07e7e
commit c221452a00
24 changed files with 885 additions and 58 deletions
+6
View File
@@ -68,6 +68,10 @@ CONVERTED_TOO_BIG_MESSAGE = (
"free up space, then try again."
)
UPLOAD_MISSING_MESSAGE = "The uploaded file is missing."
# A GIF over `gif.MAX_BYTES`: not the storage left, a cap of the GIF's own (its own category).
GIF_TOO_BIG_MESSAGE = (
"The GIF came out larger than a GIF may be — mark a shorter range or choose a smaller size."
)
NETWORK_REDACTED_MESSAGE = "The server could not reach that address."
# (marker, category) — first match wins, so order most-specific → most-general. Matching is
@@ -77,6 +81,8 @@ _RULES: tuple[tuple[str, str], ...] = (
# first — it is our wording, so it can never be a false match on an upstream message.
("download storage is full", "quota_exceeded"),
("larger than the download storage you have left", "quota_exceeded"),
# Our own refusal of a GIF over its size cap — the range or the size, not the storage left.
("larger than a gif may be", "gif_too_big"),
# Our own redaction of a transport failure (see NETWORK_REDACTED_MESSAGE) — our wording too.
(NETWORK_REDACTED_MESSAGE.lower(), "network"),
# Our own verdicts on a post link (adapters.py) — our wording too: its page holds no single video,