//! Every text and size limit in iz, as named constants. Length limits count characters (Unicode //! scalar values) and are enforced on the server, never only in the HTML form. /// Longest task title, in characters. Reason: a title is a card heading; longer text is a description. pub const TITLE_MAX: usize = 200; /// Longest task description, in characters. Reason: keeps one row and one page render bounded. pub const DESCRIPTION_MAX: usize = 20_000; /// Longest comment body, in characters. Reason: comments are conversation, not documents. pub const COMMENT_MAX: usize = 10_000; /// Longest tag (project) name, in characters. Reason: tags are shown as chips on every card. pub const TAG_NAME_MAX: usize = 60; /// Longest column name, in characters. Reason: column headings must fit the board width. pub const COLUMN_NAME_MAX: usize = 60; /// Longest mail rule name or subject template, in characters. Reason: mail subjects stay short. pub const RULE_SUBJECT_MAX: usize = 120; /// Longest mail subject for notices and reminders, in characters. Reason: the mail client truncates later. pub const MESSAGE_SUBJECT_MAX: usize = 200; /// Longest mail body for notices, in characters. Reason: bounds the outbox row size. pub const MESSAGE_BODY_MAX: usize = 20_000; /// Longest display name, in characters. Reason: names are shown in assignee lists and mail greetings. pub const DISPLAY_NAME_MAX: usize = 100; /// Longest attachment file name, in bytes. Reason: matches the common filesystem limit. pub const FILE_NAME_MAX: usize = 255; /// Smallest per-file attachment limit an admin may set, in MiB. Reason: zero would refuse every upload. pub const ATTACHMENT_LIMIT_MIB_MIN: u32 = 1; /// Largest per-file attachment limit an admin may set, in MiB. Reason: bounds disk use per upload. pub const ATTACHMENT_LIMIT_MIB_MAX: u32 = 500; /// Largest reminder lead time, in minutes (one day). Reason: a reminder further ahead is not a reminder. pub const REMINDER_MINUTES_MAX: u32 = 1440; /// Largest mail batching window, in minutes. Reason: longer quiet windows delay mail past usefulness. pub const BATCH_MINUTES_MAX: u32 = 120; /// Default per-file attachment limit, in MiB. Reason: the starting value of the setting; an admin raises it. pub const ATTACHMENT_DEFAULT_MIB: u32 = 100; /// Total size of the attachments of one board when the setting was never saved, in bytes. Reason: the /// disk is shared with the database and the backups; an admin raises it deliberately. pub const ATTACHMENT_TOTAL_DEFAULT_BYTES: u64 = 20 * 1024 * 1024 * 1024; /// Most file parts one upload request may carry. Reason: bounds the work one form can cause. pub const UPLOAD_FILES_MAX: usize = 10; /// Leading bytes of an upload that the sniffer reads. Reason: enough for every signature it knows. pub const SNIFF_BYTES: usize = 8192; /// Bytes of a text file the text viewer shows. Reason: a preview, not a reader; the rest is one download away. pub const TEXT_PREVIEW_BYTES: u64 = 256 * 1024; /// Largest compressed spreadsheet or CSV the viewer parses, in bytes. Reason: bounds the work of one preview. pub const SHEET_INPUT_MAX_BYTES: u64 = 5 * 1024 * 1024; /// Most cells one `.xlsx` sheet preview visits, kept or not. Reason: bounds the work on a sheet with a huge /// used range, whatever the caps keep. pub const SHEET_VISITS_MAX: usize = 200_000; /// Largest compressed slide deck the viewer parses, in bytes. Reason: decks carry pictures, so the cap is higher. pub const SLIDES_INPUT_MAX_BYTES: u64 = 20 * 1024 * 1024; /// Largest total uncompressed size of a zip container the viewers read, in bytes. Reason: a zip bomb is /// refused before parsing; real workbooks and decks are far below this. pub const ARCHIVE_UNCOMPRESSED_MAX_BYTES: u64 = 50 * 1024 * 1024; /// Largest uncompressed-to-compressed ratio of a zip container. Reason: zip bombs compress to almost nothing. pub const ARCHIVE_RATIO_MAX: u64 = 100; /// Uncompressed size below which the ratio is not judged, in bytes. Reason: small parts compress badly /// without being hostile, and the total size limit still applies to them. pub const ARCHIVE_RATIO_FLOOR_BYTES: u64 = 1024 * 1024; /// Most sheets a workbook preview shows. Reason: a preview of every tab of a large workbook is a document dump. pub const SHEETS_MAX: usize = 20; /// Most rows a sheet preview shows. Reason: keeps one page render bounded. pub const SHEET_ROWS_MAX: usize = 1000; /// Most columns a sheet preview shows. Reason: wider tables do not fit the viewer width anyway. pub const SHEET_COLS_MAX: usize = 100; /// Longest cell text a sheet preview shows, in characters. Reason: one cell must not fill the page. pub const CELL_TEXT_MAX: usize = 1000; /// Most slides a deck preview lists. Reason: bounds the XML parsed from one request. pub const SLIDES_MAX: usize = 200; /// Longest text of one slide shown, in characters. Reason: a slide's text is a summary, not a transcript. pub const SLIDE_TEXT_MAX: usize = 4000; /// Largest XML part of a deck that is read, in bytes. Reason: a single slide is far below this. pub const DECK_PART_MAX_BYTES: u64 = 4 * 1024 * 1024; /// Longest mail subject after rendering, in characters. Reason: header lines stay short and readable. pub const MAIL_SUBJECT_MAX: usize = 200; /// Longest sender display name, in characters. Reason: a mail client shows only the start of it. pub const SENDER_NAME_MAX: usize = 100; /// Longest host name of the mail server, in characters (DNS limit). pub const SENDER_HOST_MAX: usize = 253; /// Longest SMTP user name, in characters. Reason: long enough for an address, short enough to store. pub const SMTP_USERNAME_MAX: usize = 254; /// Longest SMTP password, in characters. Reason: a generous bound for a stored secret. pub const SMTP_PASSWORD_MAX: usize = 512; /// Highest reminder cap a member can be given, in mails per hour. Reason: above this the cap is no guard. pub const REMINDER_CAP_MAX: u32 = 500;