From 06483fd5863194846786782c84ffca650645849c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 30 Nov 2021 14:23:39 +0100 Subject: [PATCH 1/3] Fixing "Query string parameters prevent WA from loading" Due to a regression, query string parameters added to the URL (like: http://play.workadventure.localhost/_/global/maps.workadventure.localhost/starter/map.json?utm_source=sendinblue&utm_campaign=WA+-+2021+Christmap+map+launch&utm_medium=email#foo ) were causing a crash in WA. This commit fixes the issue (and adds a E2E test) --- front/src/Connexion/ConnectionManager.ts | 3 ++- tests/tests/test.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index 22289895..b75c6bc6 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -163,12 +163,13 @@ class ConnectionManager { console.error(err); } } else { + const query = urlParams.toString(); roomPath = window.location.protocol + "//" + window.location.host + window.location.pathname + - urlParams.toString() + //use urlParams because the token param must be deleted + (query ? "?" + query : "") + //use urlParams because the token param must be deleted window.location.hash; } diff --git a/tests/tests/test.ts b/tests/tests/test.ts index c7747578..94659ad7 100644 --- a/tests/tests/test.ts +++ b/tests/tests/test.ts @@ -4,8 +4,9 @@ const fs = require('fs') import { Selector } from 'testcafe'; import {userAlice} from "./utils/roles"; +// Note: we are also testing that we can connect if the URL contains a random query string fixture `Variables` - .page `http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/Variables/Cache/variables_tmp.json`; + .page `http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/Variables/Cache/variables_tmp.json?somerandomparam=1`; test("Test that variables cache in the back don't prevent setting a variable in case the map changes", async (t: TestController) => { // Let's start by visiting a map that DOES not have the variable. From d81ecb31996290aad7f5975ae360b035150f0227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 30 Nov 2021 14:58:37 +0100 Subject: [PATCH 2/3] Making the ADMIN_URL parameter optionnal in front This parameter is only used in the SAAS version (and ideally, should disappear completely). The warning message that uses the ADMIN_URL should originate from the admin itself. --- docker-compose.single-domain.yaml | 2 +- docker-compose.yaml | 2 +- front/webpack.config.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.single-domain.yaml b/docker-compose.single-domain.yaml index 52875ce8..59752cb9 100644 --- a/docker-compose.single-domain.yaml +++ b/docker-compose.single-domain.yaml @@ -28,7 +28,7 @@ services: NODE_ENV: development PUSHER_URL: /pusher UPLOADER_URL: /uploader - ADMIN_URL: /admin + #ADMIN_URL: /admin MAPS_URL: /maps ICON_URL: /icon STARTUP_COMMAND_1: ./templater.sh diff --git a/docker-compose.yaml b/docker-compose.yaml index ed5389c0..b8fa15ab 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -34,7 +34,7 @@ services: NODE_ENV: development PUSHER_URL: //pusher.workadventure.localhost UPLOADER_URL: //uploader.workadventure.localhost - ADMIN_URL: //workadventure.localhost + #ADMIN_URL: //workadventure.localhost ICON_URL: //icon.workadventure.localhost STARTUP_COMMAND_1: ./templater.sh STARTUP_COMMAND_2: yarn install diff --git a/front/webpack.config.ts b/front/webpack.config.ts index 9d18d51f..7a189911 100644 --- a/front/webpack.config.ts +++ b/front/webpack.config.ts @@ -189,7 +189,7 @@ module.exports = { DISABLE_NOTIFICATIONS: false, PUSHER_URL: undefined, UPLOADER_URL: null, - ADMIN_URL: undefined, + ADMIN_URL: null, CONTACT_URL: null, PROFILE_URL: null, ICON_URL: null, From 8205775dc97fee69a2bb47b4f344edf2af0d2f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 30 Nov 2021 15:02:52 +0100 Subject: [PATCH 3/3] Adding missing environment variable in docker-compose.prod.yml In the new version, a new FRONT_URL environment variable is now compulsory in the Pusher. This is done to setup CORS security in the pusher. This commit adds this environment variable in the sample docker-compose.prod.yml file. --- contrib/docker/docker-compose.prod.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/docker/docker-compose.prod.yaml b/contrib/docker/docker-compose.prod.yaml index e5a7fb79..62be6749 100644 --- a/contrib/docker/docker-compose.prod.yaml +++ b/contrib/docker/docker-compose.prod.yaml @@ -66,6 +66,7 @@ services: API_URL: back:50051 JITSI_URL: $JITSI_URL JITSI_ISS: $JITSI_ISS + FRONT_URL: https://play.${DOMAIN} labels: - "traefik.http.routers.pusher.rule=Host(`pusher.${DOMAIN}`)" - "traefik.http.routers.pusher.entryPoints=web,traefik"