diff --git a/front/src/Connexion/Room.ts b/front/src/Connexion/Room.ts index a76e3f31..a3be5f53 100644 --- a/front/src/Connexion/Room.ts +++ b/front/src/Connexion/Room.ts @@ -130,6 +130,7 @@ export class Room { this._canReport = data.canReport ?? false; this._loadingLogo = data.loadingLogo ?? undefined; this._loginSceneLogo = data.loginSceneLogo ?? undefined; + this.instance = data.instance; return new MapDetail(data.mapUrl); } else { console.log(data); diff --git a/messages/JsonMessages/MapDetailsData.ts b/messages/JsonMessages/MapDetailsData.ts index 5ee5432c..503ddbf1 100644 --- a/messages/JsonMessages/MapDetailsData.ts +++ b/messages/JsonMessages/MapDetailsData.ts @@ -13,6 +13,7 @@ export const isMapDetailsData = z.object({ roomSlug: z.nullable(z.string()), // deprecated contactPage: z.nullable(z.string()), group: z.nullable(z.string()), + instance: z.string(), iframeAuthentication: z.optional(z.nullable(z.string())), // The date (in ISO 8601 format) at which the room will expire diff --git a/pusher/src/Controller/MapController.ts b/pusher/src/Controller/MapController.ts index 19131a24..be910c09 100644 --- a/pusher/src/Controller/MapController.ts +++ b/pusher/src/Controller/MapController.ts @@ -76,6 +76,10 @@ export class MapController extends BaseHttpController { * type: string|null * description: The group this room is part of (maps the notion of "world" in WorkAdventure SAAS) * example: myorg/myworld + * instance: + * type: string + * description: The instance of this map. In a public URL: the second part of the URL (_/[instance]/map.json) + * example: global * iframeAuthentication: * type: string|null * description: The URL of the authentication Iframe @@ -111,14 +115,15 @@ export class MapController extends BaseHttpController { if (!ADMIN_API_URL) { const roomUrl = new URL(query.playUri); - const match = /\/_\/[^/]+\/(.+)/.exec(roomUrl.pathname); + const match = /\/_\/([^/]+)\/(.+)/.exec(roomUrl.pathname); if (!match) { res.status(404); res.json({}); return; } - const mapUrl = roomUrl.protocol + "//" + match[1]; + const instance = match[1]; + const mapUrl = roomUrl.protocol + "//" + match[2]; res.json({ mapUrl, @@ -128,6 +133,7 @@ export class MapController extends BaseHttpController { tags: [], contactPage: null, authenticationMandatory: DISABLE_ANONYMOUS, + instance, } as MapDetailsData); return;