Add test mode
`*` char permit to defined test mode with warning message Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
parent
27aa3c51d3
commit
a5d4d163e1
@ -1,9 +1,10 @@
|
|||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import { fly } from "svelte/transition";
|
import { fly } from "svelte/transition";
|
||||||
import { userIsAdminStore } from "../../Stores/GameStore";
|
import { userIsAdminStore, limitMap } from "../../Stores/GameStore";
|
||||||
import { ADMIN_URL } from "../../Enum/EnvironmentVariable";
|
import { ADMIN_URL } from "../../Enum/EnvironmentVariable";
|
||||||
|
|
||||||
const upgradeLink = ADMIN_URL + "/pricing";
|
const upgradeLink = ADMIN_URL + "/pricing";
|
||||||
|
const registerLink = ADMIN_URL + "/second-step-register";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main class="warningMain" transition:fly={{ y: -200, duration: 500 }}>
|
<main class="warningMain" transition:fly={{ y: -200, duration: 500 }}>
|
||||||
@ -14,6 +15,12 @@
|
|||||||
>here</a
|
>here</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
{:else if $limitMap}
|
||||||
|
<p>
|
||||||
|
Your are une test mode. This map will be opened during 2 days. You can register your domain <a
|
||||||
|
href={registerLink}>here</a
|
||||||
|
>!
|
||||||
|
</p>
|
||||||
{:else}
|
{:else}
|
||||||
<p>This world is close to its limit!</p>
|
<p>This world is close to its limit!</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -8,9 +8,10 @@ import { CharacterTexture, LocalUser } from "./LocalUser";
|
|||||||
import { Room } from "./Room";
|
import { Room } from "./Room";
|
||||||
import { _ServiceWorker } from "../Network/ServiceWorker";
|
import { _ServiceWorker } from "../Network/ServiceWorker";
|
||||||
import { loginSceneVisibleIframeStore } from "../Stores/LoginSceneStore";
|
import { loginSceneVisibleIframeStore } from "../Stores/LoginSceneStore";
|
||||||
import { userIsConnected } from "../Stores/MenuStore";
|
import { userIsConnected, warningContainerStore } from "../Stores/MenuStore";
|
||||||
import { analyticsClient } from "../Administration/AnalyticsClient";
|
import { analyticsClient } from "../Administration/AnalyticsClient";
|
||||||
import { axiosWithRetry } from "./AxiosUtils";
|
import { axiosWithRetry } from "./AxiosUtils";
|
||||||
|
import { limitMap } from "../Stores/GameStore";
|
||||||
|
|
||||||
class ConnectionManager {
|
class ConnectionManager {
|
||||||
private localUser!: LocalUser;
|
private localUser!: LocalUser;
|
||||||
@ -148,6 +149,7 @@ class ConnectionManager {
|
|||||||
} else if (
|
} else if (
|
||||||
connexionType === GameConnexionTypes.organization ||
|
connexionType === GameConnexionTypes.organization ||
|
||||||
connexionType === GameConnexionTypes.anonymous ||
|
connexionType === GameConnexionTypes.anonymous ||
|
||||||
|
connexionType === GameConnexionTypes.limit ||
|
||||||
connexionType === GameConnexionTypes.empty
|
connexionType === GameConnexionTypes.empty
|
||||||
) {
|
) {
|
||||||
this.authToken = localUserStore.getAuthToken();
|
this.authToken = localUserStore.getAuthToken();
|
||||||
@ -228,6 +230,12 @@ class ConnectionManager {
|
|||||||
analyticsClient.identifyUser(this.localUser.uuid, this.localUser.email);
|
analyticsClient.identifyUser(this.localUser.uuid, this.localUser.email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if limit room active test headband
|
||||||
|
if (connexionType === GameConnexionTypes.limit) {
|
||||||
|
warningContainerStore.activateWarningContainer();
|
||||||
|
limitMap.set(true);
|
||||||
|
}
|
||||||
|
|
||||||
this.serviceWorker = new _ServiceWorker();
|
this.serviceWorker = new _ServiceWorker();
|
||||||
return Promise.resolve(this._currentRoom);
|
return Promise.resolve(this._currentRoom);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ export class Room {
|
|||||||
if (this.id.startsWith("/")) {
|
if (this.id.startsWith("/")) {
|
||||||
this.id = this.id.substr(1);
|
this.id = this.id.substr(1);
|
||||||
}
|
}
|
||||||
if (this.id.startsWith("_/")) {
|
if (this.id.startsWith("_/") || this.id.startsWith("*/")) {
|
||||||
this.isPublic = true;
|
this.isPublic = true;
|
||||||
} else if (this.id.startsWith("@/")) {
|
} else if (this.id.startsWith("@/")) {
|
||||||
this.isPublic = false;
|
this.isPublic = false;
|
||||||
@ -138,7 +138,7 @@ export class Room {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.isPublic) {
|
if (this.isPublic) {
|
||||||
const match = /_\/([^/]+)\/.+/.exec(this.id);
|
const match = /[_*]\/([^/]+)\/.+/.exec(this.id);
|
||||||
if (!match) throw new Error('Could not extract instance from "' + this.id + '"');
|
if (!match) throw new Error('Could not extract instance from "' + this.id + '"');
|
||||||
this.instance = match[1];
|
this.instance = match[1];
|
||||||
return this.instance;
|
return this.instance;
|
||||||
|
@ -5,3 +5,5 @@ export const userMovingStore = writable(false);
|
|||||||
export const requestVisitCardsStore = writable<string | null>(null);
|
export const requestVisitCardsStore = writable<string | null>(null);
|
||||||
|
|
||||||
export const userIsAdminStore = writable(false);
|
export const userIsAdminStore = writable(false);
|
||||||
|
|
||||||
|
export const limitMap = writable(false);
|
||||||
|
@ -9,6 +9,7 @@ export enum GameConnexionTypes {
|
|||||||
unknown,
|
unknown,
|
||||||
jwt,
|
jwt,
|
||||||
login,
|
login,
|
||||||
|
limit,
|
||||||
}
|
}
|
||||||
|
|
||||||
//this class is responsible with analysing and editing the game's url
|
//this class is responsible with analysing and editing the game's url
|
||||||
@ -19,6 +20,8 @@ class UrlManager {
|
|||||||
return GameConnexionTypes.login;
|
return GameConnexionTypes.login;
|
||||||
} else if (url === "/jwt") {
|
} else if (url === "/jwt") {
|
||||||
return GameConnexionTypes.jwt;
|
return GameConnexionTypes.jwt;
|
||||||
|
} else if (url.includes("*/")) {
|
||||||
|
return GameConnexionTypes.limit;
|
||||||
} else if (url.includes("_/")) {
|
} else if (url.includes("_/")) {
|
||||||
return GameConnexionTypes.anonymous;
|
return GameConnexionTypes.anonymous;
|
||||||
} else if (url.includes("@/")) {
|
} else if (url.includes("@/")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user