36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
/**
|
|
* Holds the limits on what users submit, shared so that the forms check the
|
|
* same limits the server enforces.
|
|
*
|
|
* @module
|
|
*/
|
|
|
|
/**
|
|
* Read by the validators and services, which refuse what breaks a limit, and
|
|
* by the forms, which say so before sending. Lengths are JavaScript string
|
|
* lengths, so an emoji may count for two. The category limits are checked on
|
|
* the server only.
|
|
*/
|
|
export const VALIDATION = {
|
|
USERNAME_MIN: 1,
|
|
USERNAME_MAX: 32,
|
|
PASSWORD_MIN: 8,
|
|
PASSWORD_MAX: 128,
|
|
DUMP_TITLE_MAX: 200,
|
|
/** Applies to a dump's note, which the API calls its comment. */
|
|
DUMP_COMMENT_MAX: 5000,
|
|
PLAYLIST_TITLE_MAX: 100,
|
|
PLAYLIST_DESCRIPTION_MAX: 2000,
|
|
COMMENT_BODY_MAX: 5000,
|
|
USER_DESCRIPTION_MAX: 2000,
|
|
CATEGORY_NAME_MAX: 50,
|
|
CATEGORY_SLUG_MAX: 50,
|
|
CHAT_MESSAGE_MAX: 2000,
|
|
} as const;
|
|
|
|
/**
|
|
* The largest file a file dump may hold, in bytes. dump-service refuses a
|
|
* bigger one, and the create form before uploading it.
|
|
*/
|
|
export const DUMP_MAX_FILE_SIZE_BYTES: number = 50 * 1024 * 1024;
|