app_constants.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // time constants (ms)
  2. export const SAVE_TO_LOCAL_STORAGE_TIMEOUT = 300;
  3. export const INITIAL_SCENE_UPDATE_TIMEOUT = 5000;
  4. export const FILE_UPLOAD_TIMEOUT = 300;
  5. export const LOAD_IMAGES_TIMEOUT = 500;
  6. export const SYNC_FULL_SCENE_INTERVAL_MS = 20000;
  7. export const SYNC_BROWSER_TABS_TIMEOUT = 50;
  8. export const CURSOR_SYNC_TIMEOUT = 33; // ~30fps
  9. export const DELETED_ELEMENT_TIMEOUT = 24 * 60 * 60 * 1000; // 1 day
  10. export const FILE_UPLOAD_MAX_BYTES = 3 * 1024 * 1024; // 3 MiB
  11. // 1 year (https://stackoverflow.com/a/25201898/927631)
  12. export const FILE_CACHE_MAX_AGE_SEC = 31536000;
  13. export const WS_EVENTS = {
  14. SERVER_VOLATILE: "server-volatile-broadcast",
  15. SERVER: "server-broadcast",
  16. };
  17. export enum WS_SCENE_EVENT_TYPES {
  18. INIT = "SCENE_INIT",
  19. UPDATE = "SCENE_UPDATE",
  20. }
  21. export const FIREBASE_STORAGE_PREFIXES = {
  22. shareLinkFiles: `/files/shareLinks`,
  23. collabFiles: `/files/rooms`,
  24. };
  25. export const ROOM_ID_BYTES = 10;
  26. export const STORAGE_KEYS = {
  27. LOCAL_STORAGE_ELEMENTS: "excalidraw",
  28. LOCAL_STORAGE_APP_STATE: "excalidraw-state",
  29. LOCAL_STORAGE_COLLAB: "excalidraw-collab",
  30. LOCAL_STORAGE_LIBRARY: "excalidraw-library",
  31. LOCAL_STORAGE_THEME: "excalidraw-theme",
  32. VERSION_DATA_STATE: "version-dataState",
  33. VERSION_FILES: "version-files",
  34. } as const;
  35. export const COOKIES = {
  36. AUTH_STATE_COOKIE: "excplus-auth",
  37. } as const;
  38. export const isExcalidrawPlusSignedUser = document.cookie.includes(
  39. COOKIES.AUTH_STATE_COOKIE,
  40. );