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

@ -2,14 +2,12 @@ import type { Room } from "../Connexion/Room";
import { localUserStore } from "../Connexion/LocalUserStore";
export enum GameConnexionTypes {
anonymous = 1,
organization,
room = 1,
register,
empty,
unknown,
jwt,
login,
limit,
}
//this class is responsible with analysing and editing the game's url
@ -20,12 +18,8 @@ class UrlManager {
return GameConnexionTypes.login;
} else if (url === "/jwt") {
return GameConnexionTypes.jwt;
} else if (url.includes("*/")) {
return GameConnexionTypes.limit;
} else if (url.includes("_/")) {
return GameConnexionTypes.anonymous;
} else if (url.includes("@/")) {
return GameConnexionTypes.organization;
} else if (url.includes("_/") || url.includes("*/") || url.includes("@/")) {
return GameConnexionTypes.room;
} else if (url.includes("register/")) {
return GameConnexionTypes.register;
} else if (url === "/") {
@ -58,15 +52,6 @@ class UrlManager {
pushStartLayerNameToUrl(startLayerName: string): void {
window.location.hash = startLayerName;
}
get isActiveLimitRoom(): boolean {
const match = /\*\/(\w+)\/(?:\w+)/.exec(window.location.pathname.toString());
const timestamp = match ? Number.parseInt(match[1]) : null;
if (!timestamp) {
return false;
}
return new Date().getTime() - 48 * 60 * 60 * 1000 < timestamp;
}
}
export const urlManager = new UrlManager();