Files
gerbeur/shared/validation.ts

40 lines
1.1 KiB
TypeScript

/**
* The limits on what users submit, one set for the server that enforces them
* and the forms that check them before sending.
*
* @module
*/
/** Limits the server enforces and the forms check before sending. */
export const VALIDATION = {
/** Shortest username, in characters. */
USERNAME_MIN: 1,
/** Longest username. */
USERNAME_MAX: 32,
/** Shortest password. */
PASSWORD_MIN: 8,
/** Longest password. */
PASSWORD_MAX: 128,
/** Longest dump title. */
DUMP_TITLE_MAX: 200,
/** Longest dump description. */
DUMP_COMMENT_MAX: 5000,
/** Longest playlist title. */
PLAYLIST_TITLE_MAX: 100,
/** Longest playlist description. */
PLAYLIST_DESCRIPTION_MAX: 2000,
/** Longest comment. */
COMMENT_BODY_MAX: 5000,
/** Longest profile description. */
USER_DESCRIPTION_MAX: 2000,
/** Longest category name. */
CATEGORY_NAME_MAX: 50,
/** Longest category slug. */
CATEGORY_SLUG_MAX: 50,
/** Longest chat message. */
CHAT_MESSAGE_MAX: 2000,
} as const;
/** Largest file a file dump may hold, in bytes (50 MB). */
export const DUMP_MAX_FILE_SIZE_BYTES: number = 50 * 1024 * 1024;