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:
@@ -45,6 +45,16 @@ TEXT_EXTS: frozenset[str] = frozenset(
|
||||
|
||||
TEXT_TYPE = "text/plain; charset=utf-8"
|
||||
|
||||
# Every preview served inline — the library's viewer and a share link's picture — goes with these.
|
||||
# `sandbox` leaves the answer no script and an opaque origin, whatever the file turns out to hold (a
|
||||
# "gif" that is really a page); `frame-ancestors 'self'` lets the app's viewer frame a PDF (every
|
||||
# other answer keeps the app-wide 'none', main.py), with X-Frame-Options saying the same for old
|
||||
# engines.
|
||||
SANDBOX_HEADERS: dict[str, str] = {
|
||||
"Content-Security-Policy": "sandbox; frame-ancestors 'self'",
|
||||
"X-Frame-Options": "SAMEORIGIN",
|
||||
}
|
||||
|
||||
# A text preview is the file's head: enough to read, never a whole log loaded into a tab.
|
||||
TEXT_PREVIEW_BYTES = 1 << 20
|
||||
# A NUL byte in the first this-many bytes means the "text" is not text.
|
||||
|
||||
Reference in New Issue
Block a user