Merge branch 'develop' of github.com:thecodingmachine/workadventure

This commit is contained in:
_Bastler 2021-09-21 21:10:09 +02:00
commit 3b4cf0a68c
8 changed files with 29 additions and 8 deletions

View File

@ -22,3 +22,6 @@ MAX_USERNAME_LENGTH=8
OIDC_CLIENT_ID= OIDC_CLIENT_ID=
OIDC_CLIENT_SECRET= OIDC_CLIENT_SECRET=
OIDC_CLIENT_ISSUER= OIDC_CLIENT_ISSUER=
# If you want to have a contact page in your menu, you MUST set CONTACT_URL to the URL of the page that you want
CONTACT_URL=

View File

@ -1,9 +1,8 @@
<script lang="ts"> <script lang="ts">
import {CONTACT_URL} from "../../Enum/EnvironmentVariable"; import {contactPageStore} from "../../Stores/MenuStore";
</script> </script>
<iframe title="contact" src="{CONTACT_URL}"></iframe> <iframe title="contact" src="{$contactPageStore}" allow="clipboard-read; clipboard-write self {$contactPageStore}" allowfullscreen></iframe>
<style lang="scss"> <style lang="scss">
iframe { iframe {

View File

@ -1,5 +1,5 @@
import Axios from "axios"; import Axios from "axios";
import { PUSHER_URL } from "../Enum/EnvironmentVariable"; import { CONTACT_URL, PUSHER_URL } from "../Enum/EnvironmentVariable";
import type { CharacterTexture } from "./LocalUser"; import type { CharacterTexture } from "./LocalUser";
import { localUserStore } from "./LocalUserStore"; import { localUserStore } from "./LocalUserStore";
@ -20,6 +20,7 @@ export class Room {
private _textures: CharacterTexture[] | undefined; private _textures: CharacterTexture[] | undefined;
// private instance: string | undefined; // private instance: string | undefined;
private readonly _search: URLSearchParams; private readonly _search: URLSearchParams;
private _contactPage: string | undefined;
private constructor(private roomUrl: URL) { private constructor(private roomUrl: URL) {
this.id = roomUrl.pathname; this.id = roomUrl.pathname;
@ -106,6 +107,7 @@ export class Room {
this._textures = data.textures; this._textures = data.textures;
this._authenticationMandatory = data.authenticationMandatory || false; this._authenticationMandatory = data.authenticationMandatory || false;
this._iframeAuthentication = data.iframeAuthentication; this._iframeAuthentication = data.iframeAuthentication;
this._contactPage = data.contactPage || CONTACT_URL;
return new MapDetail(data.mapUrl, data.textures); return new MapDetail(data.mapUrl, data.textures);
} }
@ -202,4 +204,8 @@ export class Room {
get iframeAuthentication(): string | undefined { get iframeAuthentication(): string | undefined {
return this._iframeAuthentication; return this._iframeAuthentication;
} }
get contactPage(): string | undefined {
return this._contactPage;
}
} }

View File

@ -96,6 +96,7 @@ import { EmbeddedWebsiteManager } from "./EmbeddedWebsiteManager";
import { GameMapPropertiesListener } from "./GameMapPropertiesListener"; import { GameMapPropertiesListener } from "./GameMapPropertiesListener";
import { analyticsClient } from "../../Administration/AnalyticsClient"; import { analyticsClient } from "../../Administration/AnalyticsClient";
import { get } from "svelte/store"; import { get } from "svelte/store";
import { contactPageStore } from "../../Stores/MenuStore";
export interface GameSceneInitInterface { export interface GameSceneInitInterface {
initPosition: PointInterface | null; initPosition: PointInterface | null;
@ -436,6 +437,7 @@ export class GameScene extends DirtyScene {
gameManager.gameSceneIsCreated(this); gameManager.gameSceneIsCreated(this);
urlManager.pushRoomIdToUrl(this.room); urlManager.pushRoomIdToUrl(this.room);
analyticsClient.enteredRoom(this.room.id); analyticsClient.enteredRoom(this.room.id);
contactPageStore.set(this.room.contactPage);
if (touchScreenManager.supportTouchScreen) { if (touchScreenManager.supportTouchScreen) {
this.pinchManager = new PinchManager(this); this.pinchManager = new PinchManager(this);

View File

@ -74,13 +74,18 @@ function createSubMenusStore() {
export const subMenusStore = createSubMenusStore(); export const subMenusStore = createSubMenusStore();
export const contactPageStore = writable<string | undefined>(CONTACT_URL);
export function checkSubMenuToShow() { export function checkSubMenuToShow() {
if (!get(userIsAdminStore)) {
subMenusStore.removeMenu(SubMenusInterface.globalMessages); subMenusStore.removeMenu(SubMenusInterface.globalMessages);
subMenusStore.removeMenu(SubMenusInterface.contact);
if (get(userIsAdminStore)) {
subMenusStore.addMenu(SubMenusInterface.globalMessages);
} }
if (CONTACT_URL === undefined) { if (get(contactPageStore) !== undefined) {
subMenusStore.removeMenu(SubMenusInterface.contact); subMenusStore.addMenu(SubMenusInterface.contact);
} }
subMenusStore.removeMenu(SubMenusInterface.aboutRoom); subMenusStore.removeMenu(SubMenusInterface.aboutRoom);

View File

@ -129,6 +129,9 @@ class JitsiFactory {
* Slugifies the room name and prepends the room name with the instance * Slugifies the room name and prepends the room name with the instance
*/ */
public getRoomName(roomName: string, instance: string): string { public getRoomName(roomName: string, instance: string): string {
if (!instance || instance == '') {
return slugify(roomName);
}
return slugify(instance.replace("/", "-") + "-" + roomName); return slugify(instance.replace("/", "-") + "-" + roomName);
} }

View File

@ -62,6 +62,7 @@ export class MapController extends BaseController {
roomSlug: "", // Deprecated roomSlug: "", // Deprecated
tags: [], tags: [],
textures: [], textures: [],
contactPage: undefined,
} as MapDetailsData) } as MapDetailsData)
); );

View File

@ -15,6 +15,8 @@ export const isMapDetailsData = new tg.IsInterface()
policy_type: isNumber, //isNumericEnum(GameRoomPolicyTypes), policy_type: isNumber, //isNumericEnum(GameRoomPolicyTypes),
tags: tg.isArray(tg.isString), tags: tg.isArray(tg.isString),
textures: tg.isArray(isCharacterTexture), textures: tg.isArray(isCharacterTexture),
contactPage: tg.isUnion(tg.isString, tg.isUndefined),
}) })
.get(); .get();
export type MapDetailsData = tg.GuardedType<typeof isMapDetailsData>; export type MapDetailsData = tg.GuardedType<typeof isMapDetailsData>;