🚚(collaboration) change the websocket url name

We will have 2 urls targeting the server, better
to improve the naming to avoid confusion.
This commit is contained in:
Anthony LC
2024-12-03 15:07:21 +01:00
committed by Anthony LC
parent 57ed08994b
commit aff036d9fb
8 changed files with 14 additions and 11 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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",

View File

@@ -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",

View File

@@ -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

View File

@@ -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',

View File

@@ -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;

View File

@@ -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}`;
};