Removing completely any analysis of the URL from the front.

Instead, data related to room is sent from the admin, via the pusher.
This commit is contained in:
David Négrier 2022-01-05 14:32:02 +01:00
parent c85679b42c
commit 968e71cbca
6 changed files with 28 additions and 33 deletions

View file

@ -154,12 +154,7 @@ class ConnectionManager {
)
);
urlManager.pushRoomIdToUrl(this._currentRoom);
} else if (
connexionType === GameConnexionTypes.organization ||
connexionType === GameConnexionTypes.anonymous ||
connexionType === GameConnexionTypes.limit ||
connexionType === GameConnexionTypes.empty
) {
} else if (connexionType === GameConnexionTypes.room || connexionType === GameConnexionTypes.empty) {
this.authToken = localUserStore.getAuthToken();
let roomPath: string;
@ -241,12 +236,12 @@ class ConnectionManager {
}
//if limit room active test headband
if (connexionType === GameConnexionTypes.limit) {
if (this._currentRoom.expireOn !== undefined) {
warningContainerStore.activateWarningContainer();
limitMapStore.set(true);
//check time of map
if (!urlManager.isActiveLimitRoom) {
if (new Date() > this._currentRoom.expireOn) {
showLimitRoomModalStore.set(true);
}
}

View file

@ -27,6 +27,8 @@ export class Room {
private readonly _search: URLSearchParams;
private _contactPage: string | undefined;
private _group: string | null = null;
private _expireOn: Date | undefined;
private _canReport: boolean = false;
private constructor(private roomUrl: URL) {
this.id = roomUrl.pathname;
@ -121,6 +123,10 @@ export class Room {
data.authenticationMandatory != null ? data.authenticationMandatory : DISABLE_ANONYMOUS;
this._iframeAuthentication = data.iframeAuthentication || OPID_LOGIN_SCREEN_PROVIDER;
this._contactPage = data.contactPage || CONTACT_URL;
if (data.expireOn) {
this._expireOn = new Date(data.expireOn);
}
this._canReport = data.canReport ?? false;
return new MapDetail(data.mapUrl, data.textures);
} else {
throw new Error("Data received by the /map endpoint of the Pusher is not in a valid format.");
@ -222,4 +228,12 @@ export class Room {
get group(): string | null {
return this._group;
}
get expireOn(): Date | undefined {
return this._expireOn;
}
get canReport(): boolean {
return this._canReport;
}
}