2020-12-05 15:30:53 +01:00
|
|
|
// time constants (ms)
|
|
|
|
export const SAVE_TO_LOCAL_STORAGE_TIMEOUT = 300;
|
|
|
|
export const INITIAL_SCENE_UPDATE_TIMEOUT = 5000;
|
2021-10-21 22:05:48 +02:00
|
|
|
export const FILE_UPLOAD_TIMEOUT = 300;
|
|
|
|
export const LOAD_IMAGES_TIMEOUT = 500;
|
2020-12-05 15:30:53 +01:00
|
|
|
export const SYNC_FULL_SCENE_INTERVAL_MS = 20000;
|
2022-01-27 13:21:55 +01:00
|
|
|
export const SYNC_BROWSER_TABS_TIMEOUT = 50;
|
2022-03-06 23:11:14 +01:00
|
|
|
export const CURSOR_SYNC_TIMEOUT = 33; // ~30fps
|
2022-05-09 15:38:44 +02:00
|
|
|
export const DELETED_ELEMENT_TIMEOUT = 24 * 60 * 60 * 1000; // 1 day
|
2020-12-05 15:30:53 +01:00
|
|
|
|
2021-10-21 22:05:48 +02:00
|
|
|
export const FILE_UPLOAD_MAX_BYTES = 3 * 1024 * 1024; // 3 MiB
|
|
|
|
// 1 year (https://stackoverflow.com/a/25201898/927631)
|
|
|
|
export const FILE_CACHE_MAX_AGE_SEC = 31536000;
|
|
|
|
|
2022-04-17 22:40:39 +02:00
|
|
|
export const WS_EVENTS = {
|
2020-12-05 15:30:53 +01:00
|
|
|
SERVER_VOLATILE: "server-volatile-broadcast",
|
|
|
|
SERVER: "server-broadcast",
|
2023-12-15 00:07:11 +01:00
|
|
|
USER_FOLLOW_CHANGE: "user-follow",
|
|
|
|
USER_FOLLOW_ROOM_CHANGE: "user-follow-room-change",
|
|
|
|
} as const;
|
2020-12-05 15:30:53 +01:00
|
|
|
|
2023-12-15 00:07:11 +01:00
|
|
|
export enum WS_SUBTYPES {
|
2023-12-16 17:32:54 +01:00
|
|
|
INVALID_RESPONSE = "INVALID_RESPONSE",
|
2020-12-05 15:30:53 +01:00
|
|
|
INIT = "SCENE_INIT",
|
|
|
|
UPDATE = "SCENE_UPDATE",
|
2023-12-16 17:32:54 +01:00
|
|
|
MOUSE_LOCATION = "MOUSE_LOCATION",
|
|
|
|
IDLE_STATUS = "IDLE_STATUS",
|
|
|
|
USER_VISIBLE_SCENE_BOUNDS = "USER_VISIBLE_SCENE_BOUNDS",
|
2020-12-05 15:30:53 +01:00
|
|
|
}
|
2021-10-21 22:05:48 +02:00
|
|
|
|
|
|
|
export const FIREBASE_STORAGE_PREFIXES = {
|
|
|
|
shareLinkFiles: `/files/shareLinks`,
|
|
|
|
collabFiles: `/files/rooms`,
|
|
|
|
};
|
2021-11-07 14:33:21 +01:00
|
|
|
|
|
|
|
export const ROOM_ID_BYTES = 10;
|
2022-01-27 13:21:55 +01:00
|
|
|
|
|
|
|
export const STORAGE_KEYS = {
|
|
|
|
LOCAL_STORAGE_ELEMENTS: "excalidraw",
|
|
|
|
LOCAL_STORAGE_APP_STATE: "excalidraw-state",
|
|
|
|
LOCAL_STORAGE_COLLAB: "excalidraw-collab",
|
2022-09-16 15:59:03 +02:00
|
|
|
LOCAL_STORAGE_THEME: "excalidraw-theme",
|
2022-01-27 13:21:55 +01:00
|
|
|
VERSION_DATA_STATE: "version-dataState",
|
|
|
|
VERSION_FILES: "version-files",
|
2024-03-08 22:29:19 +01:00
|
|
|
|
|
|
|
IDB_LIBRARY: "excalidraw-library",
|
|
|
|
|
|
|
|
// do not use apart from migrations
|
|
|
|
__LEGACY_LOCAL_STORAGE_LIBRARY: "excalidraw-library",
|
2022-01-27 13:21:55 +01:00
|
|
|
} as const;
|
2023-01-12 15:49:28 +01:00
|
|
|
|
|
|
|
export const COOKIES = {
|
|
|
|
AUTH_STATE_COOKIE: "excplus-auth",
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export const isExcalidrawPlusSignedUser = document.cookie.includes(
|
|
|
|
COOKIES.AUTH_STATE_COOKIE,
|
|
|
|
);
|