2023-01-13 05:40:33 +01:00
|
|
|
import config from "@/config/index.js";
|
2023-03-04 15:16:20 +01:00
|
|
|
import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js";
|
2022-12-13 00:07:38 +01:00
|
|
|
|
2023-01-13 05:40:33 +01:00
|
|
|
export const MAX_NOTE_TEXT_LENGTH =
|
2023-01-14 18:21:35 +01:00
|
|
|
config.maxNoteLength != null ? config.maxNoteLength : 3000; // <- should we increase this?
|
2023-03-04 15:16:20 +01:00
|
|
|
export const MAX_CAPTION_TEXT_LENGTH = Math.min(
|
|
|
|
config.maxCaptionLength ?? 1500,
|
|
|
|
DB_MAX_IMAGE_COMMENT_LENGTH,
|
|
|
|
);
|
2022-02-20 08:07:43 +01:00
|
|
|
|
2022-07-14 00:01:23 +02:00
|
|
|
export const SECOND = 1000;
|
2023-01-14 18:21:35 +01:00
|
|
|
export const SEC = 1000; // why do we need this duplicate here?
|
2022-07-14 00:01:23 +02:00
|
|
|
export const MINUTE = 60 * SEC;
|
2023-01-14 18:21:35 +01:00
|
|
|
export const MIN = 60 * SEC; // why do we need this duplicate here?
|
2022-07-14 00:01:23 +02:00
|
|
|
export const HOUR = 60 * MIN;
|
|
|
|
export const DAY = 24 * HOUR;
|
|
|
|
|
2023-01-14 18:21:35 +01:00
|
|
|
export const USER_ONLINE_THRESHOLD = 10 * MINUTE;
|
|
|
|
export const USER_ACTIVE_THRESHOLD = 3 * DAY;
|
2022-01-01 14:25:30 +01:00
|
|
|
|
2023-01-14 18:21:35 +01:00
|
|
|
// List of file types allowed to be viewed directly in the browser
|
|
|
|
// Anything not included here will be responded as application/octet-stream
|
|
|
|
// SVG is not allowed because it generates XSS <- we need to fix this and later allow it to be viewed directly
|
2022-01-01 14:25:30 +01:00
|
|
|
export const FILE_TYPE_BROWSERSAFE = [
|
|
|
|
// Images
|
2023-01-13 05:40:33 +01:00
|
|
|
"image/png",
|
2023-01-14 18:21:35 +01:00
|
|
|
"image/gif", // TODO: deprecated, but still used by old notes, new gifs should be converted to webp in the future
|
2023-01-13 05:40:33 +01:00
|
|
|
"image/jpeg",
|
2023-01-14 18:21:35 +01:00
|
|
|
"image/webp", // TODO: make this the default image format
|
2023-01-13 05:40:33 +01:00
|
|
|
"image/apng",
|
|
|
|
"image/bmp",
|
|
|
|
"image/tiff",
|
|
|
|
"image/x-icon",
|
2023-01-14 18:21:35 +01:00
|
|
|
"image/avif", // not as good supported now, but its good to introduce initial support for the future
|
2022-01-01 14:25:30 +01:00
|
|
|
|
|
|
|
// OggS
|
2023-01-13 05:40:33 +01:00
|
|
|
"audio/opus",
|
|
|
|
"video/ogg",
|
|
|
|
"audio/ogg",
|
|
|
|
"application/ogg",
|
2022-01-01 14:25:30 +01:00
|
|
|
|
|
|
|
// ISO/IEC base media file format
|
2023-01-13 05:40:33 +01:00
|
|
|
"video/quicktime",
|
2023-01-14 18:21:35 +01:00
|
|
|
"video/mp4", // TODO: we need to check for av1 later
|
|
|
|
"video/vnd.avi", // also av1
|
2023-01-13 05:40:33 +01:00
|
|
|
"audio/mp4",
|
|
|
|
"video/x-m4v",
|
|
|
|
"audio/x-m4a",
|
|
|
|
"video/3gpp",
|
|
|
|
"video/3gpp2",
|
2023-01-14 18:21:35 +01:00
|
|
|
"video/3gp2",
|
|
|
|
"audio/3gpp",
|
|
|
|
"audio/3gpp2",
|
|
|
|
"audio/3gp2",
|
2023-01-13 05:40:33 +01:00
|
|
|
|
|
|
|
"video/mpeg",
|
|
|
|
"audio/mpeg",
|
|
|
|
|
|
|
|
"video/webm",
|
|
|
|
"audio/webm",
|
|
|
|
|
|
|
|
"audio/aac",
|
|
|
|
"audio/x-flac",
|
2023-01-14 18:21:35 +01:00
|
|
|
"audio/flac",
|
2023-01-13 05:40:33 +01:00
|
|
|
"audio/vnd.wave",
|
2022-01-01 14:25:30 +01:00
|
|
|
];
|
|
|
|
/*
|
|
|
|
https://github.com/sindresorhus/file-type/blob/main/supported.js
|
|
|
|
https://github.com/sindresorhus/file-type/blob/main/core.js
|
|
|
|
https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers
|
|
|
|
*/
|