Compute instance in back getMapDetails

This commit is contained in:
Alban Bruder 2022-04-12 12:28:36 -04:00 committed by David Négrier
parent 0f08e3d1b5
commit 82be015fc5

View File

@ -562,13 +562,14 @@ export class GameRoom {
if (!ADMIN_API_URL) { if (!ADMIN_API_URL) {
const roomUrlObj = new URL(roomUrl); const roomUrlObj = new URL(roomUrl);
const match = /\/_\/[^/]+\/(.+)/.exec(roomUrlObj.pathname); const match = /\/_\/([^/]+)\/(.+)/.exec(roomUrlObj.pathname);
if (!match) { if (!match) {
console.error("Unexpected room URL", roomUrl); console.error("Unexpected room URL", roomUrl);
throw new Error('Unexpected room URL "' + roomUrl + '"'); throw new Error('Unexpected room URL "' + roomUrl + '"');
} }
const mapUrl = roomUrlObj.protocol + "//" + match[1]; const instance = match[1];
const mapUrl = roomUrlObj.protocol + "//" + match[2];
return { return {
mapUrl, mapUrl,
@ -578,6 +579,7 @@ export class GameRoom {
roomSlug: null, roomSlug: null,
contactPage: null, contactPage: null,
group: null, group: null,
instance
}; };
} }