diff --git a/ansible/roles/schulcloud-server-core/templates/admin-api-server-configmap.yml.j2 b/ansible/roles/schulcloud-server-core/templates/admin-api-server-configmap.yml.j2 index 8b06a2a96ca..70645a1c4a5 100644 --- a/ansible/roles/schulcloud-server-core/templates/admin-api-server-configmap.yml.j2 +++ b/ansible/roles/schulcloud-server-core/templates/admin-api-server-configmap.yml.j2 @@ -21,3 +21,4 @@ data: IDENTITY_MANAGEMENT__EXTERNAL_URI: "{{ IDENTITY_MANAGEMENT__EXTERNAL_URI }}" IDENTITY_MANAGEMENT__TENANT: "{{ IDENTITY_MANAGEMENT__TENANT }}" IDENTITY_MANAGEMENT__CLIENTID: "{{ IDENTITY_MANAGEMENT__CLIENTID }}" + TLDRAW__WEBSOCKET_URL: "wss://{{ DOMAIN }}/tldraw-server" diff --git a/ansible/roles/schulcloud-server-core/templates/configmap.yml.j2 b/ansible/roles/schulcloud-server-core/templates/configmap.yml.j2 index 001b88a27ab..7b5b163d649 100644 --- a/ansible/roles/schulcloud-server-core/templates/configmap.yml.j2 +++ b/ansible/roles/schulcloud-server-core/templates/configmap.yml.j2 @@ -14,6 +14,7 @@ data: SC_THEME: "{{ SC_THEME }}" SC_SHORTNAME: "{{ SC_SHORTNAME }}" SC_DOMAIN: "{{ DOMAIN }}" + TLDRAW__WEBSOCKET_URL: "wss://{{ DOMAIN }}/tldraw-server" SHLVL: "1" # Prints slow requests above 4 s in log # LEAD_TIME: "4000" diff --git a/apps/server/src/modules/server/api/dto/config.response.ts b/apps/server/src/modules/server/api/dto/config.response.ts index d92b29aed4d..e0a40450526 100644 --- a/apps/server/src/modules/server/api/dto/config.response.ts +++ b/apps/server/src/modules/server/api/dto/config.response.ts @@ -47,11 +47,14 @@ export class ConfigResponse { @ApiProperty() FEATURE_TLDRAW_ENABLED: boolean; + @ApiProperty() + TLDRAW__WEBSOCKET_URL: string; + @ApiProperty() TLDRAW__ASSETS_ENABLED: boolean; @ApiProperty() - TLDRAW__ASSETS_MAX_SIZE: number; + TLDRAW__ASSETS_MAX_SIZE_BYTES: number; @ApiProperty() TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST: string[]; @@ -292,7 +295,8 @@ export class ConfigResponse { this.MIGRATION_WIZARD_DOCUMENTATION_LINK = config.MIGRATION_WIZARD_DOCUMENTATION_LINK; this.FEATURE_TLDRAW_ENABLED = config.FEATURE_TLDRAW_ENABLED; this.TLDRAW__ASSETS_ENABLED = config.TLDRAW__ASSETS_ENABLED; - this.TLDRAW__ASSETS_MAX_SIZE = config.TLDRAW__ASSETS_MAX_SIZE; + this.TLDRAW__WEBSOCKET_URL = config.TLDRAW__WEBSOCKET_URL; + this.TLDRAW__ASSETS_MAX_SIZE_BYTES = config.TLDRAW__ASSETS_MAX_SIZE_BYTES; this.TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST = config.TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST; this.FEATURE_VIDEOCONFERENCE_ENABLED = config.FEATURE_VIDEOCONFERENCE_ENABLED; this.FEATURE_SCHULCONNEX_COURSE_SYNC_ENABLED = config.FEATURE_SCHULCONNEX_COURSE_SYNC_ENABLED; diff --git a/apps/server/src/modules/server/api/test/server.api.spec.ts b/apps/server/src/modules/server/api/test/server.api.spec.ts index 5627d34e17e..03f32116317 100644 --- a/apps/server/src/modules/server/api/test/server.api.spec.ts +++ b/apps/server/src/modules/server/api/test/server.api.spec.ts @@ -95,8 +95,9 @@ describe('Server Controller (API)', () => { 'TEACHER_STUDENT_VISIBILITY__IS_ENABLED_BY_DEFAULT', 'TEACHER_STUDENT_VISIBILITY__IS_VISIBLE', 'TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST', + 'TLDRAW__WEBSOCKET_URL', 'TLDRAW__ASSETS_ENABLED', - 'TLDRAW__ASSETS_MAX_SIZE', + 'TLDRAW__ASSETS_MAX_SIZE_BYTES', 'FEATURE_SCHULCONNEX_COURSE_SYNC_ENABLED', 'FEATURE_MEDIA_SHELF_ENABLED', 'BOARD_COLLABORATION_URI', diff --git a/apps/server/src/modules/server/server.config.ts b/apps/server/src/modules/server/server.config.ts index c8fc95d5a7f..cdda04bf236 100644 --- a/apps/server/src/modules/server/server.config.ts +++ b/apps/server/src/modules/server/server.config.ts @@ -119,8 +119,9 @@ export interface ServerConfig MIGRATION_WIZARD_DOCUMENTATION_LINK?: string; FEATURE_OTHER_GROUPUSERS_PROVISIONING_ENABLED: boolean; FEATURE_TLDRAW_ENABLED: boolean; + TLDRAW__WEBSOCKET_URL: string; TLDRAW__ASSETS_ENABLED: boolean; - TLDRAW__ASSETS_MAX_SIZE: number; + TLDRAW__ASSETS_MAX_SIZE_BYTES: number; TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST: string[]; I18N__AVAILABLE_LANGUAGES: LanguageType[]; I18N__DEFAULT_LANGUAGE: LanguageType; @@ -230,8 +231,9 @@ const config: ServerConfig = { BLOCKLIST_OF_EMAIL_DOMAINS: (Configuration.get('BLOCKLIST_OF_EMAIL_DOMAINS') as string) .split(',') .map((domain) => domain.trim()), + TLDRAW__WEBSOCKET_URL: Configuration.get('TLDRAW__WEBSOCKET_URL') as string, TLDRAW__ASSETS_ENABLED: Configuration.get('TLDRAW__ASSETS_ENABLED') as boolean, - TLDRAW__ASSETS_MAX_SIZE: Configuration.get('TLDRAW__ASSETS_MAX_SIZE') as number, + TLDRAW__ASSETS_MAX_SIZE_BYTES: Configuration.get('TLDRAW__ASSETS_MAX_SIZE_BYTES') as number, TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST: (Configuration.get('TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST') as string).split( ',' ), diff --git a/apps/server/src/modules/tldraw/config.ts b/apps/server/src/modules/tldraw/config.ts index a691d758292..bef12dde3c2 100644 --- a/apps/server/src/modules/tldraw/config.ts +++ b/apps/server/src/modules/tldraw/config.ts @@ -13,7 +13,7 @@ export interface TldrawConfig { REDIS_URI: string; TLDRAW_ASSETS_ENABLED: boolean; TLDRAW_ASSETS_SYNC_ENABLED: boolean; - TLDRAW_ASSETS_MAX_SIZE: number; + TLDRAW_ASSETS_MAX_SIZE_BYTES: number; ASSETS_ALLOWED_MIME_TYPES_LIST: string; API_HOST: number; TLDRAW_MAX_DOCUMENT_SIZE: number; @@ -50,7 +50,7 @@ const tldrawConfig = { REDIS_URI: Configuration.has('REDIS_URI') ? (Configuration.get('REDIS_URI') as string) : null, TLDRAW_ASSETS_ENABLED: Configuration.get('TLDRAW__ASSETS_ENABLED') as boolean, TLDRAW_ASSETS_SYNC_ENABLED: Configuration.get('TLDRAW__ASSETS_SYNC_ENABLED') as boolean, - TLDRAW_ASSETS_MAX_SIZE: Configuration.get('TLDRAW__ASSETS_MAX_SIZE') as number, + TLDRAW_ASSETS_MAX_SIZE_BYTES: Configuration.get('TLDRAW__ASSETS_MAX_SIZE_BYTES') as number, ASSETS_ALLOWED_MIME_TYPES_LIST: Configuration.get('TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST') as string, API_HOST: Configuration.get('API_HOST') as string, TLDRAW_MAX_DOCUMENT_SIZE: Configuration.get('TLDRAW__MAX_DOCUMENT_SIZE') as number, diff --git a/config/default.schema.json b/config/default.schema.json index d13131bf0e9..572afde4e44 100644 --- a/config/default.schema.json +++ b/config/default.schema.json @@ -1525,53 +1525,69 @@ "PING_TIMEOUT", "FINALIZE_DELAY", "SOCKET_PORT", + "WEBSOCKET_URL", "GC_ENABLED", "DB_COMPRESS_THRESHOLD", "MAX_DOCUMENT_SIZE", "ASSETS_ENABLED", "ASSETS_SYNC_ENABLED", - "ASSETS_MAX_SIZE", + "ASSETS_MAX_SIZE_BYTES", "ASSETS_ALLOWED_MIME_TYPES_LIST" ], "properties": { "SOCKET_PORT": { "type": "number", + "default": 3345, "description": "Web socket port for tldraw" }, + "WEBSOCKET_URL": { + "type": "string", + "default": "ws://localhost:3345", + "description": "Web socket url for tldraw" + }, "PING_TIMEOUT": { "type": "number", + "default": 30000, "description": "Websocket ping timeout in ms" }, "FINALIZE_DELAY": { "type": "number", + "default": 5000, "description": "Delay in milliseconds before checking if can finalize a tldraw board" }, "GC_ENABLED": { "type": "boolean", + "default": true, "description": "If tldraw garbage collector should be enabled" }, "DB_COMPRESS_THRESHOLD": { "type": "integer", + "default": 400, "description": "Mongo documents with same docName compress threshold size" }, "MAX_DOCUMENT_SIZE": { "type": "number", + "default": 15000000, "description": "Maximum size of a single tldraw document in mongo" }, "ASSETS_ENABLED": { "type": "boolean", + "default": true, "description": "Enables uploading assets to tldraw board" }, "ASSETS_SYNC_ENABLED": { "type": "boolean", + "default": false, "description": "Enables synchronization of tldraw board assets with file storage" }, - "ASSETS_MAX_SIZE": { + "ASSETS_MAX_SIZE_BYTES": { "type": "integer", + "default": 10485760, "description": "Maximum asset size in bytes" }, "ASSETS_ALLOWED_MIME_TYPES_LIST": { "type": "string", + "default": "image/png,image/jpeg,image/gif,image/svg+xml", "description": "List with allowed assets MIME types, comma separated, empty if all MIME types supported by tldraw should be allowed", "examples": ["image/gif,image/jpeg,video/webm"] }, @@ -1586,18 +1602,6 @@ "description": "Define log level for tldraw.", "enum": ["emerg", "alert", "crit", "error", "warning", "notice", "info", "debug"] } - }, - "default": { - "SOCKET_PORT": 3345, - "PING_TIMEOUT": 30000, - "FINALIZE_DELAY": 5000, - "GC_ENABLED": true, - "DB_COMPRESS_THRESHOLD": 400, - "MAX_DOCUMENT_SIZE": 15000000, - "ASSETS_ENABLED": true, - "ASSETS_SYNC_ENABLED": false, - "ASSETS_MAX_SIZE": 10485760, - "ASSETS_ALLOWED_MIME_TYPES_LIST": "image/png,image/jpeg,image/gif,image/svg+xml" } }, "TLDRAW_DB_URL": { diff --git a/config/development.json b/config/development.json index e3d6d3d5602..14c1d4beac3 100644 --- a/config/development.json +++ b/config/development.json @@ -92,5 +92,18 @@ "ALLOWED_API_KEYS": "thisisasupersecureapikeythatisabsolutelysave" }, "TRAINING_URL": "https://lernen.dbildungscloud.de", - "FEATURE_ROOMS_ENABLED": true + "FEATURE_ROOMS_ENABLED": true, + "TLDRAW": { + "WEBSOCKET_URL": "ws://localhost:3345", + "SOCKET_PORT": 3346, + "PING_TIMEOUT": 1, + "FINALIZE_DELAY": 1, + "GC_ENABLED": true, + "DB_COMPRESS_THRESHOLD": 400, + "MAX_DOCUMENT_SIZE": 15000000, + "ASSETS_ENABLED": true, + "ASSETS_SYNC_ENABLED": true, + "ASSETS_MAX_SIZE_BYTES": 25000000, + "ASSETS_ALLOWED_MIME_TYPES_LIST": "" + } } diff --git a/config/test.json b/config/test.json index bea4d3869d3..70b8ff33e06 100644 --- a/config/test.json +++ b/config/test.json @@ -69,6 +69,7 @@ "VIDEOCONFERENCE_HOST": "https://bigbluebutton.schul-cloud.org/bigbluebutton", "VIDEOCONFERENCE_SALT": "ThisIsNOTaRealSaltThisIsNOTaRealSaltThisIsNOTaRealSalt1234567890", "TLDRAW": { + "WEBSOCKET_URL": "ws://localhost:3345", "SOCKET_PORT": 3346, "PING_TIMEOUT": 1, "FINALIZE_DELAY": 1, @@ -77,7 +78,7 @@ "MAX_DOCUMENT_SIZE": 15000000, "ASSETS_ENABLED": true, "ASSETS_SYNC_ENABLED": true, - "ASSETS_MAX_SIZE": 25000000, + "ASSETS_MAX_SIZE_BYTES": 25000000, "ASSETS_ALLOWED_MIME_TYPES_LIST": "" }, "SCHULCONNEX_CLIENT": {