diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5491f9..981e3b80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to - 🔨(frontend) encapsulated title to its own component #474 - 🐛(frontend) Fix hidden menu on Firefox #468 - ⚡️(backend) optimize number of queries on document list view #411 +- 🚚(collaboration) change the websocket key name #480 ## [1.8.2] - 2024-11-28 diff --git a/env.d/development/common.dist b/env.d/development/common.dist index a52e45ad..6833f09b 100644 --- a/env.d/development/common.dist +++ b/env.d/development/common.dist @@ -53,7 +53,7 @@ AI_API_KEY=password AI_MODEL=llama # Collaboration -COLLABORATION_SERVER_URL=ws://localhost:4444 +COLLABORATION_WS_URL=ws://localhost:4444 # Frontend FRONTEND_THEME=dsfr diff --git a/src/backend/core/api/viewsets.py b/src/backend/core/api/viewsets.py index 75c0f5c4..7b63a7f3 100644 --- a/src/backend/core/api/viewsets.py +++ b/src/backend/core/api/viewsets.py @@ -1002,7 +1002,7 @@ class ConfigView(views.APIView): Return a dictionary of public settings. """ array_settings = [ - "COLLABORATION_SERVER_URL", + "COLLABORATION_WS_URL", "CRISP_WEBSITE_ID", "ENVIRONMENT", "FRONTEND_THEME", diff --git a/src/backend/core/tests/test_api_config.py b/src/backend/core/tests/test_api_config.py index 96888be5..a5eb151f 100644 --- a/src/backend/core/tests/test_api_config.py +++ b/src/backend/core/tests/test_api_config.py @@ -16,7 +16,7 @@ pytestmark = pytest.mark.django_db @override_settings( - COLLABORATION_SERVER_URL="http://testcollab/", + COLLABORATION_WS_URL="http://testcollab/", CRISP_WEBSITE_ID="123", FRONTEND_THEME="test-theme", MEDIA_BASE_URL="http://testserver/", @@ -34,7 +34,7 @@ def test_api_config(is_authenticated): response = client.get("/api/v1.0/config/") assert response.status_code == HTTP_200_OK assert response.json() == { - "COLLABORATION_SERVER_URL": "http://testcollab/", + "COLLABORATION_WS_URL": "http://testcollab/", "CRISP_WEBSITE_ID": "123", "ENVIRONMENT": "test", "FRONTEND_THEME": "test-theme", diff --git a/src/backend/impress/settings.py b/src/backend/impress/settings.py index 3bb1d830..50140620 100755 --- a/src/backend/impress/settings.py +++ b/src/backend/impress/settings.py @@ -372,8 +372,8 @@ class Base(Configuration): SENTRY_DSN = values.Value(None, environ_name="SENTRY_DSN", environ_prefix=None) # Collaboration - COLLABORATION_SERVER_URL = values.Value( - None, environ_name="COLLABORATION_SERVER_URL", environ_prefix=None + COLLABORATION_WS_URL = values.Value( + None, environ_name="COLLABORATION_WS_URL", environ_prefix=None ) # Frontend diff --git a/src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts index e005ca3a..1d8604df 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts @@ -6,7 +6,7 @@ import { createDoc } from './common'; const config = { CRISP_WEBSITE_ID: null, - COLLABORATION_SERVER_URL: 'ws://localhost:4444', + COLLABORATION_WS_URL: 'ws://localhost:4444', ENVIRONMENT: 'development', FRONTEND_THEME: 'dsfr', MEDIA_BASE_URL: 'http://localhost:8083', diff --git a/src/frontend/apps/impress/src/core/config/api/useConfig.tsx b/src/frontend/apps/impress/src/core/config/api/useConfig.tsx index 04bb06c6..5cb6d3a9 100644 --- a/src/frontend/apps/impress/src/core/config/api/useConfig.tsx +++ b/src/frontend/apps/impress/src/core/config/api/useConfig.tsx @@ -7,7 +7,7 @@ interface ConfigResponse { LANGUAGES: [string, string][]; LANGUAGE_CODE: string; ENVIRONMENT: string; - COLLABORATION_SERVER_URL?: string; + COLLABORATION_WS_URL?: string; CRISP_WEBSITE_ID?: string; FRONTEND_THEME?: Theme; MEDIA_BASE_URL?: string; diff --git a/src/frontend/apps/impress/src/core/config/hooks/useCollaborationUrl.tsx b/src/frontend/apps/impress/src/core/config/hooks/useCollaborationUrl.tsx index d945cb23..b0668372 100644 --- a/src/frontend/apps/impress/src/core/config/hooks/useCollaborationUrl.tsx +++ b/src/frontend/apps/impress/src/core/config/hooks/useCollaborationUrl.tsx @@ -8,8 +8,10 @@ export const useCollaborationUrl = (room?: string) => { } const base = - conf?.COLLABORATION_SERVER_URL || - (typeof window !== 'undefined' ? `wss://${window.location.host}/ws` : ''); + conf?.COLLABORATION_WS_URL || + (typeof window !== 'undefined' + ? `wss://${window.location.host}/collaboration/ws/` + : ''); - return `${base}/${room}`; + return `${base}?room=${room}`; };