From 4a7be94b92debb0389037e05953d32319c7a1e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Thu, 23 Dec 2021 14:53:03 +0100 Subject: [PATCH 1/2] Fixing bug in redirect handling of rooms --- front/src/Connexion/Room.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/src/Connexion/Room.ts b/front/src/Connexion/Room.ts index 389405a0..33d8486f 100644 --- a/front/src/Connexion/Room.ts +++ b/front/src/Connexion/Room.ts @@ -104,9 +104,9 @@ export class Room { const data = result.data; - if (isRoomRedirect(data.redirectUrl)) { + if (isRoomRedirect(data)) { return { - redirectUrl: data.redirectUrl as string, + redirectUrl: data.redirectUrl, }; } else if (isMapDetailsData(data)) { console.log("Map ", this.id, " resolves to URL ", data.mapUrl); From b148a46e3cc1781fe6c0af59dd1e056d925a6b51 Mon Sep 17 00:00:00 2001 From: Alexis Faizeau Date: Thu, 30 Dec 2021 10:19:32 +0100 Subject: [PATCH 2/2] Remove unused policy type from ApiData typeguard --- front/src/Connexion/Room.ts | 4 ++++ messages/JsonMessages/AdminApiData.ts | 8 +++----- pusher/src/Services/AdminApi.ts | 15 --------------- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/front/src/Connexion/Room.ts b/front/src/Connexion/Room.ts index 33d8486f..e5e2227f 100644 --- a/front/src/Connexion/Room.ts +++ b/front/src/Connexion/Room.ts @@ -104,6 +104,10 @@ export class Room { const data = result.data; + if (data.authenticationMandatory !== undefined) { + data.authenticationMandatory = Boolean(data.authenticationMandatory); + } + if (isRoomRedirect(data)) { return { redirectUrl: data.redirectUrl, diff --git a/messages/JsonMessages/AdminApiData.ts b/messages/JsonMessages/AdminApiData.ts index 72bfe682..314963be 100644 --- a/messages/JsonMessages/AdminApiData.ts +++ b/messages/JsonMessages/AdminApiData.ts @@ -8,12 +8,10 @@ import { isCharacterTexture } from "./CharacterTexture"; export const isAdminApiData = new tg.IsInterface() .withProperties({ - roomUrl: tg.isString, - email: tg.isNullable(tg.isString), - mapUrlStart: tg.isString, - tags: tg.isArray(tg.isString), - policy_type: tg.isNumber, userUuid: tg.isString, + email: tg.isNullable(tg.isString), + roomUrl: tg.isString, + mapUrlStart: tg.isString, textures: tg.isArray(isCharacterTexture), }) .withOptionalProperties({ diff --git a/pusher/src/Services/AdminApi.ts b/pusher/src/Services/AdminApi.ts index 79177e1a..f97e144d 100644 --- a/pusher/src/Services/AdminApi.ts +++ b/pusher/src/Services/AdminApi.ts @@ -75,21 +75,6 @@ class AdminApi { return res.data; } - async fetchCheckUserByToken(organizationMemberToken: string): Promise { - if (!ADMIN_API_URL) { - return Promise.reject(new Error("No admin backoffice set!")); - } - //todo: this call can fail if the corresponding world is not activated or if the token is invalid. Handle that case. - const res = await Axios.get(ADMIN_API_URL + "/api/check-user/" + organizationMemberToken, { - headers: { Authorization: `${ADMIN_API_TOKEN}` }, - }); - if (!isAdminApiData(res.data)) { - console.error("Message received from /api/check-user is not in the expected format. Message: ", res.data); - throw new Error("Message received from /api/check-user is not in the expected format."); - } - return res.data; - } - reportPlayer( reportedUserUuid: string, reportedUserComment: string,