From 3e54e7504037c9be7f1039686fb3569bc077ea2b Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 17 Jun 2021 15:14:54 +0300 Subject: [PATCH 01/62] Add workaround for #932 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 322f06ba..d24dbb4e 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Note: on some OSes, you will need to add this line to your `/etc/hosts` file: 127.0.0.1 workadventure.localhost ``` +Note: If on the first run you get a page with "network error". Try to ``docker-compose stop`` , then ``docker-compose start``. + ### MacOS developers, your environment with Vagrant If you are using MacOS, you can increase Docker performance using Vagrant. If you want more explanations, you can read [this medium article](https://medium.com/better-programming/vagrant-to-increase-docker-performance-with-macos-25b354b0c65c). From abfaf73a25cb16e34c78560cd472e35fccdeb478 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Jun 2021 20:36:36 +0000 Subject: [PATCH 02/62] Bump striptags from 3.1.1 to 3.2.0 in /messages Bumps [striptags](https://github.com/ericnorris/striptags) from 3.1.1 to 3.2.0. - [Release notes](https://github.com/ericnorris/striptags/releases) - [Commits](https://github.com/ericnorris/striptags/compare/v3.1.1...v3.2.0) --- updated-dependencies: - dependency-name: striptags dependency-type: indirect ... Signed-off-by: dependabot[bot] --- messages/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/messages/yarn.lock b/messages/yarn.lock index 564da3f4..4ad28ec4 100644 --- a/messages/yarn.lock +++ b/messages/yarn.lock @@ -3767,9 +3767,9 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== striptags@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/striptags/-/striptags-3.1.1.tgz#c8c3e7fdd6fb4bb3a32a3b752e5b5e3e38093ebd" - integrity sha1-yMPn/db7S7OjKjt1LltePjgJPr0= + version "3.2.0" + resolved "https://registry.yarnpkg.com/striptags/-/striptags-3.2.0.tgz#cc74a137db2de8b0b9a370006334161f7dd67052" + integrity sha512-g45ZOGzHDMe2bdYMdIvdAfCQkCTDMGBazSw1ypMowwGIee7ZQ5dU0rBJ8Jqgl+jAKIv4dbeE1jscZq9wid1Tkw== success-symbol@^0.1.0: version "0.1.0" From 120f19af65d4fc81ebe01aaa99dd044aef889394 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 24 Jun 2021 14:35:18 +0300 Subject: [PATCH 03/62] Add anthoer note for https://github.com/thecodingmachine/workadventure/issues/932#issuecomment-867562208 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d24dbb4e..ba9e70ce 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Note: on some OSes, you will need to add this line to your `/etc/hosts` file: ``` Note: If on the first run you get a page with "network error". Try to ``docker-compose stop`` , then ``docker-compose start``. +Note 2: If you are still getting "network error". Make sure you are authorizing the self-signed certificate by entering https://pusher.workadventure.testing and accepting them. ### MacOS developers, your environment with Vagrant From fecbc8a018fd783fe633dcf417f9f681b4c96752 Mon Sep 17 00:00:00 2001 From: kharhamel Date: Mon, 12 Jul 2021 17:39:16 +0200 Subject: [PATCH 04/62] WIP: svelte menu --- front/dist/static/images/logo-WA-min.png | Bin 0 -> 2136 bytes front/src/Components/App.svelte | 16 +++ .../Components/Menu/EditProfileMenu.svelte | 73 ++++++++++ .../Components/Menu/GameQualityMenu.svelte | 121 ++++++++++++++++ front/src/Components/Menu/Menu.svelte | 73 ++++++++++ front/src/Components/Menu/MenuIcon.svelte | 28 ++-- front/src/Phaser/Components/Loader.ts | 52 ++++--- front/src/Phaser/Game/GameManager.ts | 2 + front/src/Phaser/Login/CustomizeScene.ts | 2 +- front/src/Phaser/Login/EnableCameraScene.ts | 37 ++--- front/src/Phaser/Login/LoginScene.ts | 28 ++-- .../src/Phaser/Login/SelectCharacterScene.ts | 103 +++++++------ .../src/Phaser/Login/SelectCompanionScene.ts | 84 ++++++----- front/src/Phaser/Menu/MenuScene.ts | 40 +++--- front/src/Phaser/Menu/ReportMenu.ts | 23 ++- front/src/Stores/MediaStore.ts | 2 +- front/src/Stores/MenuStore.ts | 1 + maps/tests/MenuSvelte.json | 136 ++++++++++++++++++ 18 files changed, 623 insertions(+), 198 deletions(-) create mode 100644 front/dist/static/images/logo-WA-min.png create mode 100644 front/src/Components/Menu/EditProfileMenu.svelte create mode 100644 front/src/Components/Menu/GameQualityMenu.svelte create mode 100644 front/src/Components/Menu/Menu.svelte create mode 100644 maps/tests/MenuSvelte.json diff --git a/front/dist/static/images/logo-WA-min.png b/front/dist/static/images/logo-WA-min.png new file mode 100644 index 0000000000000000000000000000000000000000..fe2131519735538aa4a2c7bdfcb46f945f54b69d GIT binary patch literal 2136 zcmV-e2&eanP)y0Kf7jVwzah0w!eWcYeU2~_}zu{)LwUPa<9x_AWVAwm*B@}#c= zz$ySNcyK=~4gg>akD-6JH%$lv=-{#J!M%vk&xpZWd=)?wpZ1Q&PdhJ(SJ=QN!n=6E zHvy!EPmYEM_oI_B0Ng||c!N&@=->}jH^b*iJ%SfagAW2|qv2gg^S0@ur*oP)xa|j7_C1tcFfEM;|sHZzggS#g-i<|G5&2bz7!3Nl{zLb zVp0I>XnaDA+a^U|svsmu@va*>cZ{SDlJ?$16CR*L#y5fyPoP@>9di3d(Jlg=X<(AJ z{Hp6@EdIHFfAZ-kmoLNIxpUIrcXD8;!-*>C))L4x z0nS{1J_pZJm6NM}KYxzD|NP_l^|LR&oP6dWB}^HkZGf+%?v~YFr>&o7!GhYbtSw_KpiG& z#>4_|EWqml=;;rSK92}^1klFfM6Eo2{J8XVjYj$4;>(vW;nk~G!CB?v#fxzI^l4j{ ztE?N~X#$i68wjUV+OA3fP0THcFj=jt8K@F~(VBF^IE|{FK@vdyDHT9j5SZkV`=)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mxc9tsTAFlv0TuuxC?bI>PQs8a(1>Q&*l}h3O_B&nosD zQkuvn?c29DGuyTR04FPSDK40zkH)t;xzNR8(L-$8HXU5sN0O)hd(**Q5iUGHmKK&V z#X5%2*D<1}g6rkt)Bb`Rk#!s;{UhJt-|o!#;DHCo(!|<=^%@6>Y1y_nlWcqvKuR5j zkQ)A`Z)-98D1eky2%UhJt2;oWbIsIsfzJZSvWi0Raw7`{J7{$8m)Z+O04a+ZG5FSx zu!9EghP32 + import MenuIcon from "./Menu/MenuIcon.svelte"; + import {menuIconVisible, menuVisible} from "../Stores/MenuStore"; import {enableCameraSceneVisibilityStore} from "../Stores/MediaStore"; import CameraControls from "./CameraControls.svelte"; import MyCamera from "./MyCamera.svelte"; @@ -23,6 +25,7 @@ import AudioPlaying from "./UI/AudioPlaying.svelte"; import {soundPlayingStore} from "../Stores/SoundPlayingStore"; import ErrorDialog from "./UI/ErrorDialog.svelte"; + import Menu from "./Menu/Menu.svelte"; import VideoOverlay from "./Video/VideoOverlay.svelte"; import {gameOverlayVisibilityStore} from "../Stores/GameOverlayStoreVisibility"; import {consoleGlobalMessageManagerVisibleStore} from "../Stores/ConsoleGlobalMessageManagerStore"; @@ -63,6 +66,19 @@ {/if} + + + {#if $menuIconVisible} +
+ +
+ {/if} + {#if $menuVisible} +
+ +
+ {/if} + {#if $gameOverlayVisibilityStore}
diff --git a/front/src/Components/Menu/EditProfileMenu.svelte b/front/src/Components/Menu/EditProfileMenu.svelte new file mode 100644 index 00000000..94dd4308 --- /dev/null +++ b/front/src/Components/Menu/EditProfileMenu.svelte @@ -0,0 +1,73 @@ + + +
+
+
Edit your profile
+
+
+ +
+
+ +
+
+ +
+
+ + \ No newline at end of file diff --git a/front/src/Components/Menu/GameQualityMenu.svelte b/front/src/Components/Menu/GameQualityMenu.svelte new file mode 100644 index 00000000..e57d1336 --- /dev/null +++ b/front/src/Components/Menu/GameQualityMenu.svelte @@ -0,0 +1,121 @@ + + +
+
+
Game quality
+

(Editing these settings will restart the game)

+ +
+
+
Video quality
+ +
+
+ +
+
+ +
+
+ + \ No newline at end of file diff --git a/front/src/Components/Menu/Menu.svelte b/front/src/Components/Menu/Menu.svelte new file mode 100644 index 00000000..69a248b4 --- /dev/null +++ b/front/src/Components/Menu/Menu.svelte @@ -0,0 +1,73 @@ + + + + + + \ No newline at end of file diff --git a/front/src/Components/Menu/MenuIcon.svelte b/front/src/Components/Menu/MenuIcon.svelte index 241bf45f..f70f7eed 100644 --- a/front/src/Components/Menu/MenuIcon.svelte +++ b/front/src/Components/Menu/MenuIcon.svelte @@ -1,33 +1,41 @@
-
diff --git a/front/src/Phaser/Components/Loader.ts b/front/src/Phaser/Components/Loader.ts index 1ee18b32..c80e31b8 100644 --- a/front/src/Phaser/Components/Loader.ts +++ b/front/src/Phaser/Components/Loader.ts @@ -1,48 +1,63 @@ import ImageFrameConfig = Phaser.Types.Loader.FileTypes.ImageFrameConfig; +import { DirtyScene } from "../Game/DirtyScene"; -const LogoNameIndex: string = 'logoLoading'; -const TextName: string = 'Loading...'; -const LogoResource: string = 'resources/logos/logo.png'; -const LogoFrame: ImageFrameConfig = {frameWidth: 307, frameHeight: 59}; +const LogoNameIndex: string = "logoLoading"; +const TextName: string = "Loading..."; +const LogoResource: string = "resources/logos/logo.png"; +const LogoFrame: ImageFrameConfig = { frameWidth: 307, frameHeight: 59 }; export const addLoader = (scene: Phaser.Scene): void => { // If there is nothing to load, do not display the loader. if (scene.load.list.entries.length === 0) { return; } - let loadingText: Phaser.GameObjects.Text|null = null; + let loadingText: Phaser.GameObjects.Text | null = null; const loadingBarWidth: number = Math.floor(scene.game.renderer.width / 3); const loadingBarHeight: number = 16; const padding: number = 5; const promiseLoadLogoTexture = new Promise((res) => { - if(scene.load.textureManager.exists(LogoNameIndex)){ - return res(scene.add.image(scene.game.renderer.width / 2, scene.game.renderer.height / 2 - 150, LogoNameIndex)); - }else{ + if (scene.load.textureManager.exists(LogoNameIndex)) { + return res( + scene.add.image(scene.game.renderer.width / 2, scene.game.renderer.height / 2 - 150, LogoNameIndex) + ); + } else { //add loading if logo image is not ready loadingText = scene.add.text(scene.game.renderer.width / 2, scene.game.renderer.height / 2 - 50, TextName); } scene.load.spritesheet(LogoNameIndex, LogoResource, LogoFrame); scene.load.once(`filecomplete-spritesheet-${LogoNameIndex}`, () => { - if(loadingText){ + if (loadingText) { loadingText.destroy(); } - return res(scene.add.image(scene.game.renderer.width / 2, scene.game.renderer.height / 2 - 150, LogoNameIndex)); + return res( + scene.add.image(scene.game.renderer.width / 2, scene.game.renderer.height / 2 - 150, LogoNameIndex) + ); }); }); const progressContainer = scene.add.graphics(); const progress = scene.add.graphics(); progressContainer.fillStyle(0x444444, 0.8); - progressContainer.fillRect((scene.game.renderer.width - loadingBarWidth) / 2 - padding, scene.game.renderer.height / 2 + 50 - padding, loadingBarWidth + padding * 2, loadingBarHeight + padding * 2); + progressContainer.fillRect( + (scene.game.renderer.width - loadingBarWidth) / 2 - padding, + scene.game.renderer.height / 2 + 50 - padding, + loadingBarWidth + padding * 2, + loadingBarHeight + padding * 2 + ); - scene.load.on('progress', (value: number) => { + scene.load.on("progress", (value: number) => { progress.clear(); - progress.fillStyle(0xBBBBBB, 1); - progress.fillRect((scene.game.renderer.width - loadingBarWidth) / 2, scene.game.renderer.height / 2 + 50, loadingBarWidth * value, loadingBarHeight); + progress.fillStyle(0xbbbbbb, 1); + progress.fillRect( + (scene.game.renderer.width - loadingBarWidth) / 2, + scene.game.renderer.height / 2 + 50, + loadingBarWidth * value, + loadingBarHeight + ); }); - scene.load.on('complete', () => { - if(loadingText){ + scene.load.on("complete", () => { + if (loadingText) { loadingText.destroy(); } promiseLoadLogoTexture.then((resLoadingImage: Phaser.GameObjects.Image) => { @@ -50,5 +65,8 @@ export const addLoader = (scene: Phaser.Scene): void => { }); progress.destroy(); progressContainer.destroy(); + if (scene instanceof DirtyScene) { + scene.markDirty(); + } }); -} +}; diff --git a/front/src/Phaser/Game/GameManager.ts b/front/src/Phaser/Game/GameManager.ts index 3e39de9a..56c0d751 100644 --- a/front/src/Phaser/Game/GameManager.ts +++ b/front/src/Phaser/Game/GameManager.ts @@ -9,6 +9,7 @@ import { localUserStore } from "../../Connexion/LocalUserStore"; import { get } from "svelte/store"; import { requestedCameraState, requestedMicrophoneState } from "../../Stores/MediaStore"; import { helpCameraSettingsVisibleStore } from "../../Stores/HelpCameraSettingsStore"; +import { menuIconVisible } from "../../Stores/MenuStore"; /** * This class should be responsible for any scene starting/stopping @@ -97,6 +98,7 @@ export class GameManager { this.currentGameSceneName = scene.scene.key; const menuScene: MenuScene = scene.scene.get(MenuSceneName) as MenuScene; menuScene.revealMenuIcon(); + menuIconVisible.set(true); } /** diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index c65dabbb..c1a31901 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -281,7 +281,7 @@ export class CustomizeScene extends AbstractCharacterScene { this.scene.sleep(CustomizeSceneName); waScaleManager.restoreZoom(); this.events.removeListener("wake"); - gameManager.tryResumingGame(this, EnableCameraSceneName); + gameManager.tryResumingGame(EnableCameraSceneName); customCharacterSceneVisibleStore.set(false); } diff --git a/front/src/Phaser/Login/EnableCameraScene.ts b/front/src/Phaser/Login/EnableCameraScene.ts index ba27cd07..55fc4b82 100644 --- a/front/src/Phaser/Login/EnableCameraScene.ts +++ b/front/src/Phaser/Login/EnableCameraScene.ts @@ -1,50 +1,43 @@ -import {gameManager} from "../Game/GameManager"; -import {TextField} from "../Components/TextField"; +import { gameManager } from "../Game/GameManager"; +import { TextField } from "../Components/TextField"; import Image = Phaser.GameObjects.Image; -import {mediaManager} from "../../WebRtc/MediaManager"; -import {SoundMeter} from "../Components/SoundMeter"; -import {HtmlUtils} from "../../WebRtc/HtmlUtils"; -import {touchScreenManager} from "../../Touch/TouchScreenManager"; -import {PinchManager} from "../UserInput/PinchManager"; +import { mediaManager } from "../../WebRtc/MediaManager"; +import { SoundMeter } from "../Components/SoundMeter"; +import { HtmlUtils } from "../../WebRtc/HtmlUtils"; +import { touchScreenManager } from "../../Touch/TouchScreenManager"; +import { PinchManager } from "../UserInput/PinchManager"; import Zone = Phaser.GameObjects.Zone; import { MenuScene } from "../Menu/MenuScene"; -import {ResizableScene} from "./ResizableScene"; -import { - enableCameraSceneVisibilityStore, -} from "../../Stores/MediaStore"; +import { ResizableScene } from "./ResizableScene"; +import { enableCameraSceneVisibilityStore } from "../../Stores/MediaStore"; export const EnableCameraSceneName = "EnableCameraScene"; export class EnableCameraScene extends ResizableScene { - constructor() { super({ - key: EnableCameraSceneName + key: EnableCameraSceneName, }); } - preload() { - } + preload() {} create() { - - this.input.keyboard.on('keyup-ENTER', () => { + this.input.keyboard.on("keyup-ENTER", () => { this.login(); }); enableCameraSceneVisibilityStore.showEnableCameraScene(); } - public onResize(): void { - } + public onResize(): void {} - update(time: number, delta: number): void { - } + update(time: number, delta: number): void {} public login(): void { enableCameraSceneVisibilityStore.hideEnableCameraScene(); this.scene.sleep(EnableCameraSceneName); - gameManager.goToStartingMap(this.scene); + gameManager.goToStartingMap(); } } diff --git a/front/src/Phaser/Login/LoginScene.ts b/front/src/Phaser/Login/LoginScene.ts index 39a8f5f3..0cca9ccd 100644 --- a/front/src/Phaser/Login/LoginScene.ts +++ b/front/src/Phaser/Login/LoginScene.ts @@ -1,23 +1,21 @@ -import {gameManager} from "../Game/GameManager"; -import {SelectCharacterSceneName} from "./SelectCharacterScene"; -import {ResizableScene} from "./ResizableScene"; -import {loginSceneVisibleStore} from "../../Stores/LoginSceneStore"; +import { gameManager } from "../Game/GameManager"; +import { SelectCharacterSceneName } from "./SelectCharacterScene"; +import { ResizableScene } from "./ResizableScene"; +import { loginSceneVisibleStore } from "../../Stores/LoginSceneStore"; export const LoginSceneName = "LoginScene"; export class LoginScene extends ResizableScene { - - private name: string = ''; + private name: string = ""; constructor() { super({ - key: LoginSceneName + key: LoginSceneName, }); - this.name = gameManager.getPlayerName() || ''; + this.name = gameManager.getPlayerName() || ""; } - preload() { - } + preload() {} create() { loginSceneVisibleStore.set(true); @@ -27,15 +25,13 @@ export class LoginScene extends ResizableScene { name = name.trim(); gameManager.setPlayerName(name); - this.scene.stop(LoginSceneName) - gameManager.tryResumingGame(this, SelectCharacterSceneName); + this.scene.stop(LoginSceneName); + gameManager.tryResumingGame(SelectCharacterSceneName); this.scene.remove(LoginSceneName); loginSceneVisibleStore.set(false); } - update(time: number, delta: number): void { - } + update(time: number, delta: number): void {} - public onResize(): void { - } + public onResize(): void {} } diff --git a/front/src/Phaser/Login/SelectCharacterScene.ts b/front/src/Phaser/Login/SelectCharacterScene.ts index 0f590840..dd38706f 100644 --- a/front/src/Phaser/Login/SelectCharacterScene.ts +++ b/front/src/Phaser/Login/SelectCharacterScene.ts @@ -1,25 +1,25 @@ -import {gameManager} from "../Game/GameManager"; +import { gameManager } from "../Game/GameManager"; import Rectangle = Phaser.GameObjects.Rectangle; -import {EnableCameraSceneName} from "./EnableCameraScene"; -import {CustomizeSceneName} from "./CustomizeScene"; -import {localUserStore} from "../../Connexion/LocalUserStore"; -import {loadAllDefaultModels} from "../Entity/PlayerTexturesLoadingManager"; -import {addLoader} from "../Components/Loader"; -import type {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; -import {AbstractCharacterScene} from "./AbstractCharacterScene"; -import {areCharacterLayersValid} from "../../Connexion/LocalUser"; -import {touchScreenManager} from "../../Touch/TouchScreenManager"; -import {PinchManager} from "../UserInput/PinchManager"; -import {selectCharacterSceneVisibleStore} from "../../Stores/SelectCharacterStore"; -import {waScaleManager} from "../Services/WaScaleManager"; -import {isMobile} from "../../Enum/EnvironmentVariable"; +import { EnableCameraSceneName } from "./EnableCameraScene"; +import { CustomizeSceneName } from "./CustomizeScene"; +import { localUserStore } from "../../Connexion/LocalUserStore"; +import { loadAllDefaultModels } from "../Entity/PlayerTexturesLoadingManager"; +import { addLoader } from "../Components/Loader"; +import type { BodyResourceDescriptionInterface } from "../Entity/PlayerTextures"; +import { AbstractCharacterScene } from "./AbstractCharacterScene"; +import { areCharacterLayersValid } from "../../Connexion/LocalUser"; +import { touchScreenManager } from "../../Touch/TouchScreenManager"; +import { PinchManager } from "../UserInput/PinchManager"; +import { selectCharacterSceneVisibleStore } from "../../Stores/SelectCharacterStore"; +import { waScaleManager } from "../Services/WaScaleManager"; +import { isMobile } from "../../Enum/EnvironmentVariable"; //todo: put this constants in a dedicated file export const SelectCharacterSceneName = "SelectCharacterScene"; export class SelectCharacterScene extends AbstractCharacterScene { protected readonly nbCharactersPerRow = 6; - protected selectedPlayer!: Phaser.Physics.Arcade.Sprite|null; // null if we are selecting the "customize" option + protected selectedPlayer!: Phaser.Physics.Arcade.Sprite | null; // null if we are selecting the "customize" option protected players: Array = new Array(); protected playerModels!: BodyResourceDescriptionInterface[]; @@ -38,7 +38,6 @@ export class SelectCharacterScene extends AbstractCharacterScene { } preload() { - this.loadSelectSceneCharacters().then((bodyResourceDescriptions) => { bodyResourceDescriptions.forEach((bodyResourceDescription) => { this.playerModels.push(bodyResourceDescription); @@ -54,7 +53,7 @@ export class SelectCharacterScene extends AbstractCharacterScene { create() { selectCharacterSceneVisibleStore.set(true); - this.events.addListener('wake', () => { + this.events.addListener("wake", () => { waScaleManager.saveZoom(); waScaleManager.zoomModifier = isMobile() ? 2 : 1; selectCharacterSceneVisibleStore.set(true); @@ -68,26 +67,26 @@ export class SelectCharacterScene extends AbstractCharacterScene { waScaleManager.zoomModifier = isMobile() ? 2 : 1; const rectangleXStart = this.game.renderer.width / 2 - (this.nbCharactersPerRow / 2) * 32 + 16; - this.selectedRectangle = this.add.rectangle(rectangleXStart, 90, 32, 32).setStrokeStyle(2, 0xFFFFFF); + this.selectedRectangle = this.add.rectangle(rectangleXStart, 90, 32, 32).setStrokeStyle(2, 0xffffff); this.selectedRectangle.setDepth(2); /*create user*/ this.createCurrentPlayer(); - this.input.keyboard.on('keyup-ENTER', () => { + this.input.keyboard.on("keyup-ENTER", () => { return this.nextSceneToCameraScene(); }); - this.input.keyboard.on('keydown-RIGHT', () => { + this.input.keyboard.on("keydown-RIGHT", () => { this.moveToRight(); }); - this.input.keyboard.on('keydown-LEFT', () => { + this.input.keyboard.on("keydown-LEFT", () => { this.moveToLeft(); }); - this.input.keyboard.on('keydown-UP', () => { + this.input.keyboard.on("keydown-UP", () => { this.moveToUp(); }); - this.input.keyboard.on('keydown-DOWN', () => { + this.input.keyboard.on("keydown-DOWN", () => { this.moveToDown(); }); } @@ -96,16 +95,16 @@ export class SelectCharacterScene extends AbstractCharacterScene { if (this.selectedPlayer !== null && !areCharacterLayersValid([this.selectedPlayer.texture.key])) { return; } - if(!this.selectedPlayer){ + if (!this.selectedPlayer) { return; } this.scene.stop(SelectCharacterSceneName); waScaleManager.restoreZoom(); gameManager.setCharacterLayers([this.selectedPlayer.texture.key]); - gameManager.tryResumingGame(this, EnableCameraSceneName); + gameManager.tryResumingGame(EnableCameraSceneName); this.players = []; selectCharacterSceneVisibleStore.set(false); - this.events.removeListener('wake'); + this.events.removeListener("wake"); } public nextSceneToCustomizeScene(): void { @@ -119,11 +118,11 @@ export class SelectCharacterScene extends AbstractCharacterScene { } createCurrentPlayer(): void { - for (let i = 0; i c.texture.key === playerResource.name)){ + if (this.players.find((c) => c.texture.key === playerResource.name)) { continue; } @@ -132,9 +131,9 @@ export class SelectCharacterScene extends AbstractCharacterScene { this.setUpPlayer(player, i); this.anims.create({ key: playerResource.name, - frames: this.anims.generateFrameNumbers(playerResource.name, {start: 0, end: 11}), + frames: this.anims.generateFrameNumbers(playerResource.name, { start: 0, end: 11 }), frameRate: 8, - repeat: -1 + repeat: -1, }); player.setInteractive().on("pointerdown", () => { if (this.pointerClicked) { @@ -157,73 +156,72 @@ export class SelectCharacterScene extends AbstractCharacterScene { this.selectedPlayer.play(this.playerModels[this.currentSelectUser].name); } - protected moveUser(){ - for(let i = 0; i < this.players.length; i++){ + protected moveUser() { + for (let i = 0; i < this.players.length; i++) { const player = this.players[i]; this.setUpPlayer(player, i); } this.updateSelectedPlayer(); } - public moveToLeft(){ - if(this.currentSelectUser === 0){ + public moveToLeft() { + if (this.currentSelectUser === 0) { return; } this.currentSelectUser -= 1; this.moveUser(); } - public moveToRight(){ - if(this.currentSelectUser === (this.players.length - 1)){ + public moveToRight() { + if (this.currentSelectUser === this.players.length - 1) { return; } this.currentSelectUser += 1; this.moveUser(); } - protected moveToUp(){ - if(this.currentSelectUser < this.nbCharactersPerRow){ + protected moveToUp() { + if (this.currentSelectUser < this.nbCharactersPerRow) { return; } this.currentSelectUser -= this.nbCharactersPerRow; this.moveUser(); } - protected moveToDown(){ - if((this.currentSelectUser + this.nbCharactersPerRow) > (this.players.length - 1)){ + protected moveToDown() { + if (this.currentSelectUser + this.nbCharactersPerRow > this.players.length - 1) { return; } this.currentSelectUser += this.nbCharactersPerRow; this.moveUser(); } - protected defineSetupPlayer(num: number){ + protected defineSetupPlayer(num: number) { const deltaX = 32; const deltaY = 32; let [playerX, playerY] = this.getCharacterPosition(); // player X and player y are middle of the - playerX = ( (playerX - (deltaX * 2.5)) + ((deltaX) * (num % this.nbCharactersPerRow)) ); // calcul position on line users - playerY = ( (playerY - (deltaY * 2)) + ((deltaY) * ( Math.floor(num / this.nbCharactersPerRow) )) ); // calcul position on column users + playerX = playerX - deltaX * 2.5 + deltaX * (num % this.nbCharactersPerRow); // calcul position on line users + playerY = playerY - deltaY * 2 + deltaY * Math.floor(num / this.nbCharactersPerRow); // calcul position on column users const playerVisible = true; const playerScale = 1; const playerOpacity = 1; // if selected - if( num === this.currentSelectUser ){ + if (num === this.currentSelectUser) { this.selectedRectangle.setX(playerX); this.selectedRectangle.setY(playerY); } - return {playerX, playerY, playerScale, playerOpacity, playerVisible} + return { playerX, playerY, playerScale, playerOpacity, playerVisible }; } - protected setUpPlayer(player: Phaser.Physics.Arcade.Sprite, num: number){ - - const {playerX, playerY, playerScale, playerOpacity, playerVisible} = this.defineSetupPlayer(num); + protected setUpPlayer(player: Phaser.Physics.Arcade.Sprite, num: number) { + const { playerX, playerY, playerScale, playerOpacity, playerVisible } = this.defineSetupPlayer(num); player.setBounce(0.2); player.setCollideWorldBounds(false); - player.setVisible( playerVisible ); + player.setVisible(playerVisible); player.setScale(playerScale, playerScale); player.setAlpha(playerOpacity); player.setX(playerX); @@ -234,10 +232,7 @@ export class SelectCharacterScene extends AbstractCharacterScene { * Returns pixel position by on column and row number */ protected getCharacterPosition(): [number, number] { - return [ - this.game.renderer.width / 2, - this.game.renderer.height / 2.5 - ]; + return [this.game.renderer.width / 2, this.game.renderer.height / 2.5]; } protected updateSelectedPlayer(): void { @@ -256,7 +251,7 @@ export class SelectCharacterScene extends AbstractCharacterScene { this.pointerClicked = false; } - if(this.lazyloadingAttempt){ + if (this.lazyloadingAttempt) { //re-render players list this.createCurrentPlayer(); this.moveUser(); diff --git a/front/src/Phaser/Login/SelectCompanionScene.ts b/front/src/Phaser/Login/SelectCompanionScene.ts index 4c29f942..ed0947cf 100644 --- a/front/src/Phaser/Login/SelectCompanionScene.ts +++ b/front/src/Phaser/Login/SelectCompanionScene.ts @@ -1,18 +1,18 @@ import Image = Phaser.GameObjects.Image; import Rectangle = Phaser.GameObjects.Rectangle; import { addLoader } from "../Components/Loader"; -import { gameManager} from "../Game/GameManager"; +import { gameManager } from "../Game/GameManager"; import { ResizableScene } from "./ResizableScene"; import { EnableCameraSceneName } from "./EnableCameraScene"; import { localUserStore } from "../../Connexion/LocalUserStore"; import type { CompanionResourceDescriptionInterface } from "../Companion/CompanionTextures"; import { getAllCompanionResources } from "../Companion/CompanionTexturesLoadingManager"; -import {touchScreenManager} from "../../Touch/TouchScreenManager"; -import {PinchManager} from "../UserInput/PinchManager"; +import { touchScreenManager } from "../../Touch/TouchScreenManager"; +import { PinchManager } from "../UserInput/PinchManager"; import { MenuScene } from "../Menu/MenuScene"; -import {selectCompanionSceneVisibleStore} from "../../Stores/SelectCompanionStore"; -import {waScaleManager} from "../Services/WaScaleManager"; -import {isMobile} from "../../Enum/EnvironmentVariable"; +import { selectCompanionSceneVisibleStore } from "../../Stores/SelectCompanionStore"; +import { waScaleManager } from "../Services/WaScaleManager"; +import { isMobile } from "../../Enum/EnvironmentVariable"; export const SelectCompanionSceneName = "SelectCompanionScene"; @@ -28,12 +28,12 @@ export class SelectCompanionScene extends ResizableScene { constructor() { super({ - key: SelectCompanionSceneName + key: SelectCompanionSceneName, }); } preload() { - getAllCompanionResources(this.load).forEach(model => { + getAllCompanionResources(this.load).forEach((model) => { this.companionModels.push(model); }); @@ -42,7 +42,6 @@ export class SelectCompanionScene extends ResizableScene { } create() { - selectCompanionSceneVisibleStore.set(true); waScaleManager.saveZoom(); @@ -53,14 +52,16 @@ export class SelectCompanionScene extends ResizableScene { } // input events - this.input.keyboard.on('keyup-ENTER', this.selectCompanion.bind(this)); + this.input.keyboard.on("keyup-ENTER", this.selectCompanion.bind(this)); - this.input.keyboard.on('keydown-RIGHT', this.moveToRight.bind(this)); - this.input.keyboard.on('keydown-LEFT', this.moveToLeft.bind(this)); + this.input.keyboard.on("keydown-RIGHT", this.moveToRight.bind(this)); + this.input.keyboard.on("keydown-LEFT", this.moveToLeft.bind(this)); - if(localUserStore.getCompanion()){ - const companionIndex = this.companionModels.findIndex((companion) => companion.name === localUserStore.getCompanion()); - if(companionIndex > -1 || companionIndex < this.companions.length){ + if (localUserStore.getCompanion()) { + const companionIndex = this.companionModels.findIndex( + (companion) => companion.name === localUserStore.getCompanion() + ); + if (companionIndex > -1 || companionIndex < this.companions.length) { this.currentCompanion = companionIndex; this.selectedCompanion = this.companions[companionIndex]; } @@ -89,26 +90,26 @@ export class SelectCompanionScene extends ResizableScene { this.closeScene(); } - public closeScene(){ + public closeScene() { // next scene this.scene.stop(SelectCompanionSceneName); waScaleManager.restoreZoom(); - gameManager.tryResumingGame(this, EnableCameraSceneName); + gameManager.tryResumingGame(EnableCameraSceneName); this.scene.remove(SelectCompanionSceneName); selectCompanionSceneVisibleStore.set(false); } private createCurrentCompanion(): void { for (let i = 0; i < this.companionModels.length; i++) { - const companionResource = this.companionModels[i] + const companionResource = this.companionModels[i]; const [middleX, middleY] = this.getCompanionPosition(); const companion = this.physics.add.sprite(middleX, middleY, companionResource.name, 0); this.setUpCompanion(companion, i); this.anims.create({ key: companionResource.name, - frames: this.anims.generateFrameNumbers(companionResource.name, {start: 0, end: 2,}), + frames: this.anims.generateFrameNumbers(companionResource.name, { start: 0, end: 2 }), frameRate: 10, - repeat: -1 + repeat: -1, }); companion.setInteractive().on("pointerdown", () => { @@ -140,87 +141,84 @@ export class SelectCompanionScene extends ResizableScene { this.selectedCompanion = companion; } - private moveCompanion(){ - for(let i = 0; i < this.companions.length; i++){ + private moveCompanion() { + for (let i = 0; i < this.companions.length; i++) { const companion = this.companions[i]; this.setUpCompanion(companion, i); } this.updateSelectedCompanion(); } - public moveToRight(){ - if(this.currentCompanion === (this.companions.length - 1)){ + public moveToRight() { + if (this.currentCompanion === this.companions.length - 1) { return; } this.currentCompanion += 1; this.moveCompanion(); } - public moveToLeft(){ - if(this.currentCompanion === 0){ + public moveToLeft() { + if (this.currentCompanion === 0) { return; } this.currentCompanion -= 1; this.moveCompanion(); } - private defineSetupCompanion(num: number){ + private defineSetupCompanion(num: number) { const deltaX = 30; const deltaY = 2; let [companionX, companionY] = this.getCompanionPosition(); let companionVisible = true; let companionScale = 1.5; let companionOpactity = 1; - if( this.currentCompanion !== num ){ + if (this.currentCompanion !== num) { companionVisible = false; } - if( num === (this.currentCompanion + 1) ){ + if (num === this.currentCompanion + 1) { companionY -= deltaY; companionX += deltaX; companionScale = 0.8; companionOpactity = 0.6; companionVisible = true; } - if( num === (this.currentCompanion + 2) ){ + if (num === this.currentCompanion + 2) { companionY -= deltaY; - companionX += (deltaX * 2); + companionX += deltaX * 2; companionScale = 0.8; companionOpactity = 0.6; companionVisible = true; } - if( num === (this.currentCompanion - 1) ){ + if (num === this.currentCompanion - 1) { companionY -= deltaY; companionX -= deltaX; companionScale = 0.8; companionOpactity = 0.6; companionVisible = true; } - if( num === (this.currentCompanion - 2) ){ + if (num === this.currentCompanion - 2) { companionY -= deltaY; - companionX -= (deltaX * 2); + companionX -= deltaX * 2; companionScale = 0.8; companionOpactity = 0.6; companionVisible = true; } - return {companionX, companionY, companionScale, companionOpactity, companionVisible} + return { companionX, companionY, companionScale, companionOpactity, companionVisible }; } /** * Returns pixel position by on column and row number */ private getCompanionPosition(): [number, number] { - return [ - this.game.renderer.width / 2, - this.game.renderer.height / 3 - ]; + return [this.game.renderer.width / 2, this.game.renderer.height / 3]; } - private setUpCompanion(companion: Phaser.Physics.Arcade.Sprite, numero: number){ - - const {companionX, companionY, companionScale, companionOpactity, companionVisible} = this.defineSetupCompanion(numero); + private setUpCompanion(companion: Phaser.Physics.Arcade.Sprite, numero: number) { + const { companionX, companionY, companionScale, companionOpactity, companionVisible } = + this.defineSetupCompanion(numero); companion.setBounce(0.2); companion.setCollideWorldBounds(true); - companion.setVisible( companionVisible ); + companion.setVisible(companionVisible); companion.setScale(companionScale, companionScale); companion.setAlpha(companionOpactity); companion.setX(companionX); diff --git a/front/src/Phaser/Menu/MenuScene.ts b/front/src/Phaser/Menu/MenuScene.ts index da59cecb..960dff8c 100644 --- a/front/src/Phaser/Menu/MenuScene.ts +++ b/front/src/Phaser/Menu/MenuScene.ts @@ -8,7 +8,7 @@ import { connectionManager } from "../../Connexion/ConnectionManager"; import { GameConnexionTypes } from "../../Url/UrlManager"; import { WarningContainer, warningContainerHtml, warningContainerKey } from "../Components/WarningContainer"; import { worldFullWarningStream } from "../../Connexion/WorldFullWarningStream"; -import { menuIconVisible } from "../../Stores/MenuStore"; +import { menuIconVisible, menuVisible } from "../../Stores/MenuStore"; import { videoConstraintStore } from "../../Stores/MediaStore"; import { showReportScreenStore } from "../../Stores/ShowReportScreenStore"; import { HtmlUtils } from "../../WebRtc/HtmlUtils"; @@ -18,7 +18,6 @@ import { registerMenuCommandStream } from "../../Api/Events/ui/MenuItemRegisterE import { sendMenuClickedEvent } from "../../Api/iframe/Ui/MenuItem"; import { consoleGlobalMessageManagerVisibleStore } from "../../Stores/ConsoleGlobalMessageManagerStore"; import { get } from "svelte/store"; -import { playersStore } from "../../Stores/PlayersStore"; export const MenuSceneName = "MenuScene"; const gameMenuKey = "gameMenu"; @@ -93,7 +92,6 @@ export class MenuScene extends Phaser.Scene { } create() { - menuIconVisible.set(true); this.menuElement = this.add.dom(closedSideMenuX, 30).createFromCache(gameMenuKey); this.menuElement.setOrigin(0); MenuScene.revealMenusAfterInit(this.menuElement, "gameMenu"); @@ -121,11 +119,7 @@ export class MenuScene extends Phaser.Scene { showReportScreenStore.subscribe((user) => { if (user !== null) { this.closeAll(); - const uuid = playersStore.getPlayerById(user.userId)?.userUuid; - if (uuid === undefined) { - throw new Error("Could not find UUID for user with ID " + user.userId); - } - this.gameReportElement.open(uuid, user.userName); + this.gameReportElement.open(user.userId, user.userName); } }); @@ -154,6 +148,7 @@ export class MenuScene extends Phaser.Scene { } public revealMenuIcon(): void { + return; //TODO fix me: add try catch because at the same time, 'this.menuButton' variable doesn't exist and there is error on 'getChildByID' function try { (this.menuButton.getChildByID("menuIcon") as HTMLElement).hidden = false; @@ -163,26 +158,28 @@ export class MenuScene extends Phaser.Scene { } openSideMenu() { + menuVisible.set(true); if (this.sideMenuOpened) return; - this.closeAll(); + + /*this.closeAll(); this.sideMenuOpened = true; - this.menuButton.getChildByID("openMenuButton").innerHTML = "X"; + this.menuButton.getChildByID('openMenuButton').innerHTML = 'X'; const connection = gameManager.getCurrentGameScene(this).connection; if (connection && connection.isAdmin()) { - const adminSection = this.menuElement.getChildByID("adminConsoleSection") as HTMLElement; + const adminSection = this.menuElement.getChildByID('adminConsoleSection') as HTMLElement; adminSection.hidden = false; } //TODO bind with future metadata of card //if (connectionManager.getConnexionType === GameConnexionTypes.anonymous){ - const adminSection = this.menuElement.getChildByID("socialLinks") as HTMLElement; + const adminSection = this.menuElement.getChildByID('socialLinks') as HTMLElement; adminSection.hidden = false; //} this.tweens.add({ targets: this.menuElement, x: openedSideMenuX, duration: 500, - ease: "Power3", - }); + ease: 'Power3' + });*/ } private showWorldCapacityWarning() { @@ -200,17 +197,18 @@ export class MenuScene extends Phaser.Scene { } private closeSideMenu(): void { - if (!this.sideMenuOpened) return; + menuVisible.set(false); + /* if (!this.sideMenuOpened) return; this.sideMenuOpened = false; this.closeAll(); - this.menuButton.getChildByID("openMenuButton").innerHTML = ``; + this.menuButton.getChildByID('openMenuButton').innerHTML = ``; consoleGlobalMessageManagerVisibleStore.set(false); this.tweens.add({ targets: this.menuElement, x: closedSideMenuX, duration: 500, - ease: "Power3", - }); + ease: 'Power3' + });*/ } private openGameSettingsMenu(): void { @@ -332,18 +330,18 @@ export class MenuScene extends Phaser.Scene { switch ((event?.target as HTMLInputElement).id) { case "changeNameButton": this.closeSideMenu(); - gameManager.leaveGame(this, LoginSceneName, new LoginScene()); + gameManager.leaveGame(LoginSceneName, new LoginScene()); break; case "sparkButton": this.gotToCreateMapPage(); break; case "changeSkinButton": this.closeSideMenu(); - gameManager.leaveGame(this, SelectCharacterSceneName, new SelectCharacterScene()); + gameManager.leaveGame(SelectCharacterSceneName, new SelectCharacterScene()); break; case "changeCompanionButton": this.closeSideMenu(); - gameManager.leaveGame(this, SelectCompanionSceneName, new SelectCompanionScene()); + gameManager.leaveGame(SelectCompanionSceneName, new SelectCompanionScene()); break; case "closeButton": this.closeSideMenu(); diff --git a/front/src/Phaser/Menu/ReportMenu.ts b/front/src/Phaser/Menu/ReportMenu.ts index effb92b2..0bb863b3 100644 --- a/front/src/Phaser/Menu/ReportMenu.ts +++ b/front/src/Phaser/Menu/ReportMenu.ts @@ -1,7 +1,6 @@ import { MenuScene } from "./MenuScene"; import { gameManager } from "../Game/GameManager"; import { blackListManager } from "../../WebRtc/BlackListManager"; -import { playersStore } from "../../Stores/PlayersStore"; export const gameReportKey = "gameReport"; export const gameReportRessource = "resources/html/gameReport.html"; @@ -9,7 +8,7 @@ export const gameReportRessource = "resources/html/gameReport.html"; export class ReportMenu extends Phaser.GameObjects.DOMElement { private opened: boolean = false; - private userUuid!: string; + private userId!: number; private userName!: string | undefined; private anonymous: boolean; @@ -41,13 +40,13 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { }); } - public open(userUuid: string, userName: string | undefined): void { + public open(userId: number, userName: string | undefined): void { if (this.opened) { this.close(); return; } - this.userUuid = userUuid; + this.userId = userId; this.userName = userName; const mainEl = this.getChildByID("gameReport") as HTMLElement; @@ -58,11 +57,11 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { gameTitleReport.innerText = userName || ""; const blockButton = this.getChildByID("toggleBlockButton") as HTMLElement; - blockButton.innerText = blackListManager.isBlackListed(this.userUuid) ? "Unblock this user" : "Block this user"; + blockButton.innerText = blackListManager.isBlackListed(this.userId) ? "Unblock this user" : "Block this user"; this.opened = true; - gameManager.getCurrentGameScene(this.scene).userInputManager.disableControls(); + gameManager.getCurrentGameScene().userInputManager.disableControls(); this.scene.tweens.add({ targets: this, @@ -73,7 +72,7 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { } public close(): void { - gameManager.getCurrentGameScene(this.scene).userInputManager.restoreControls(); + gameManager.getCurrentGameScene().userInputManager.restoreControls(); this.opened = false; const mainEl = this.getChildByID("gameReport") as HTMLElement; this.scene.tweens.add({ @@ -96,9 +95,9 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { } private toggleBlock(): void { - !blackListManager.isBlackListed(this.userUuid) - ? blackListManager.blackList(this.userUuid) - : blackListManager.cancelBlackList(this.userUuid); + !blackListManager.isBlackListed(this.userId) + ? blackListManager.blackList(this.userId) + : blackListManager.cancelBlackList(this.userId); this.close(); } @@ -112,9 +111,7 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { gamePError.style.display = "block"; return; } - gameManager - .getCurrentGameScene(this.scene) - .connection?.emitReportPlayerMessage(this.userUuid, gameTextArea.value); + gameManager.getCurrentGameScene().connection?.emitReportPlayerMessage(this.userId, gameTextArea.value); this.close(); } } diff --git a/front/src/Stores/MediaStore.ts b/front/src/Stores/MediaStore.ts index 9144a6ee..8d485328 100644 --- a/front/src/Stores/MediaStore.ts +++ b/front/src/Stores/MediaStore.ts @@ -170,7 +170,7 @@ function createVideoConstraintStore() { setFrameRate: (frameRate: number) => update((constraints) => { constraints.frameRate = { ideal: frameRate }; - + localUserStore.setVideoQualityValue(frameRate); return constraints; }), }; diff --git a/front/src/Stores/MenuStore.ts b/front/src/Stores/MenuStore.ts index c7c02130..39b88b3d 100644 --- a/front/src/Stores/MenuStore.ts +++ b/front/src/Stores/MenuStore.ts @@ -1,3 +1,4 @@ import { derived, writable, Writable } from "svelte/store"; export const menuIconVisible = writable(false); +export const menuVisible = writable(false); diff --git a/maps/tests/MenuSvelte.json b/maps/tests/MenuSvelte.json new file mode 100644 index 00000000..f65c7c6c --- /dev/null +++ b/maps/tests/MenuSvelte.json @@ -0,0 +1,136 @@ +{ "compressionlevel":-1, + "height":20, + "infinite":false, + "layers":[ + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":20, + "id":6, + "name":"playSoundLoop", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":20, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":5, + "name":"floorLayer", + "objects":[ + { + "height":19.296875, + "id":2, + "name":"", + "rotation":0, + "text": + { + "text":"Play Sound", + "wrap":true + }, + "type":"", + "visible":true, + "width":107.109375, + "x":258.4453125, + "y":197.018229166667 + }, + { + "height":19.296875, + "id":3, + "name":"", + "rotation":0, + "text": + { + "text":"Bonjour Monde", + "wrap":true + }, + "type":"", + "visible":true, + "width":107.109375, + "x":-348.221354166667, + "y":257.018229166667 + }, + { + "height":55.296875, + "id":4, + "name":"", + "rotation":0, + "text": + { + "text":"Play Sound Loop\nexit Zone Stop Sound \n", + "wrap":true + }, + "type":"", + "visible":true, + "width":176.442708333333, + "x":243.778645833333, + "y":368.3515625 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "x":0, + "y":0 + }], + "nextlayerid":8, + "nextobjectid":5, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.6.0", + "tileheight":32, + "tilesets":[ + { + "columns":11, + "firstgid":1, + "image":"tileset1.png", + "imageheight":352, + "imagewidth":352, + "margin":0, + "name":"tileset1", + "spacing":0, + "tilecount":121, + "tileheight":32, + "tilewidth":32 + }], + "tilewidth":32, + "type":"map", + "version":"1.6", + "width":20 +} \ No newline at end of file From 50f3af81e469742d7fae712aca29d0d39d4d5921 Mon Sep 17 00:00:00 2001 From: kharhamel Date: Tue, 13 Jul 2021 10:54:53 +0200 Subject: [PATCH 05/62] temp --- front/src/Phaser/Login/EnableCameraScene.ts | 2 +- front/src/Phaser/Menu/MenuScene.ts | 8 ++++---- front/src/Phaser/Menu/ReportMenu.ts | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/front/src/Phaser/Login/EnableCameraScene.ts b/front/src/Phaser/Login/EnableCameraScene.ts index 55fc4b82..faeb9c12 100644 --- a/front/src/Phaser/Login/EnableCameraScene.ts +++ b/front/src/Phaser/Login/EnableCameraScene.ts @@ -38,6 +38,6 @@ export class EnableCameraScene extends ResizableScene { enableCameraSceneVisibilityStore.hideEnableCameraScene(); this.scene.sleep(EnableCameraSceneName); - gameManager.goToStartingMap(); + gameManager.goToStartingMap(this.scene); } } diff --git a/front/src/Phaser/Menu/MenuScene.ts b/front/src/Phaser/Menu/MenuScene.ts index 960dff8c..926a45db 100644 --- a/front/src/Phaser/Menu/MenuScene.ts +++ b/front/src/Phaser/Menu/MenuScene.ts @@ -119,7 +119,7 @@ export class MenuScene extends Phaser.Scene { showReportScreenStore.subscribe((user) => { if (user !== null) { this.closeAll(); - this.gameReportElement.open(user.userId, user.userName); + //this.gameReportElement.open(user., user.userName); } }); @@ -330,18 +330,18 @@ export class MenuScene extends Phaser.Scene { switch ((event?.target as HTMLInputElement).id) { case "changeNameButton": this.closeSideMenu(); - gameManager.leaveGame(LoginSceneName, new LoginScene()); + gameManager.leaveGame(this, LoginSceneName, new LoginScene()); break; case "sparkButton": this.gotToCreateMapPage(); break; case "changeSkinButton": this.closeSideMenu(); - gameManager.leaveGame(SelectCharacterSceneName, new SelectCharacterScene()); + gameManager.leaveGame(this, SelectCharacterSceneName, new SelectCharacterScene()); break; case "changeCompanionButton": this.closeSideMenu(); - gameManager.leaveGame(SelectCompanionSceneName, new SelectCompanionScene()); + gameManager.leaveGame(this, SelectCompanionSceneName, new SelectCompanionScene()); break; case "closeButton": this.closeSideMenu(); diff --git a/front/src/Phaser/Menu/ReportMenu.ts b/front/src/Phaser/Menu/ReportMenu.ts index 0bb863b3..82e2e3f2 100644 --- a/front/src/Phaser/Menu/ReportMenu.ts +++ b/front/src/Phaser/Menu/ReportMenu.ts @@ -8,7 +8,7 @@ export const gameReportRessource = "resources/html/gameReport.html"; export class ReportMenu extends Phaser.GameObjects.DOMElement { private opened: boolean = false; - private userId!: number; + private userUuid!: string; private userName!: string | undefined; private anonymous: boolean; @@ -40,13 +40,13 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { }); } - public open(userId: number, userName: string | undefined): void { + public open(userUuid: string, userName: string | undefined): void { if (this.opened) { this.close(); return; } - this.userId = userId; + this.userUuid = userUuid; this.userName = userName; const mainEl = this.getChildByID("gameReport") as HTMLElement; @@ -57,11 +57,11 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { gameTitleReport.innerText = userName || ""; const blockButton = this.getChildByID("toggleBlockButton") as HTMLElement; - blockButton.innerText = blackListManager.isBlackListed(this.userId) ? "Unblock this user" : "Block this user"; + blockButton.innerText = blackListManager.isBlackListed(this.userUuid) ? "Unblock this user" : "Block this user"; this.opened = true; - gameManager.getCurrentGameScene().userInputManager.disableControls(); + //gameManager.getCurrentGameScene().userInputManager.disableControls(); this.scene.tweens.add({ targets: this, @@ -72,7 +72,7 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { } public close(): void { - gameManager.getCurrentGameScene().userInputManager.restoreControls(); + //gameManager.getCurrentGameScene().userInputManager.restoreControls(); this.opened = false; const mainEl = this.getChildByID("gameReport") as HTMLElement; this.scene.tweens.add({ @@ -95,9 +95,9 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { } private toggleBlock(): void { - !blackListManager.isBlackListed(this.userId) - ? blackListManager.blackList(this.userId) - : blackListManager.cancelBlackList(this.userId); + !blackListManager.isBlackListed(this.userUuid) + ? blackListManager.blackList(this.userUuid) + : blackListManager.cancelBlackList(this.userUuid); this.close(); } @@ -111,7 +111,7 @@ export class ReportMenu extends Phaser.GameObjects.DOMElement { gamePError.style.display = "block"; return; } - gameManager.getCurrentGameScene().connection?.emitReportPlayerMessage(this.userId, gameTextArea.value); + //gameManager.getCurrentGameScene().connection?.emitReportPlayerMessage(this.userId, gameTextArea.value); this.close(); } } From 1ce801cced88d97d2c1efc7239506e0416bb43fa Mon Sep 17 00:00:00 2001 From: kharhamel Date: Tue, 13 Jul 2021 12:00:09 +0200 Subject: [PATCH 06/62] temp --- front/src/Components/App.svelte | 2 +- .../ConsoleGlobalMessageManager.svelte | 5 +-- .../InputTextGlobalMessage.svelte | 5 +-- .../UploadAudioGlobalMessage.svelte | 5 +-- front/src/Components/Menu/Menu.svelte | 21 ++++++--- front/src/Components/Menu/MenuIcon.svelte | 4 +- front/src/Phaser/Game/GameManager.ts | 44 ++++++++++--------- front/src/Phaser/Game/GameScene.ts | 4 +- front/src/Phaser/Login/EnableCameraScene.ts | 2 +- front/src/Phaser/Menu/MenuScene.ts | 6 +-- 10 files changed, 49 insertions(+), 49 deletions(-) diff --git a/front/src/Components/App.svelte b/front/src/Components/App.svelte index cc40ea07..7db2a8fe 100644 --- a/front/src/Components/App.svelte +++ b/front/src/Components/App.svelte @@ -70,7 +70,7 @@ {#if $menuIconVisible}
- +
{/if} {#if $menuVisible} diff --git a/front/src/Components/ConsoleGlobalMessageManager/ConsoleGlobalMessageManager.svelte b/front/src/Components/ConsoleGlobalMessageManager/ConsoleGlobalMessageManager.svelte index 83837f28..9800817d 100644 --- a/front/src/Components/ConsoleGlobalMessageManager/ConsoleGlobalMessageManager.svelte +++ b/front/src/Components/ConsoleGlobalMessageManager/ConsoleGlobalMessageManager.svelte @@ -4,7 +4,6 @@ import {gameManager} from "../../Phaser/Game/GameManager"; import type {Game} from "../../Phaser/Game/Game"; - export let game: Game; let inputSendTextActive = true; let uploadMusicActive = false; @@ -33,10 +32,10 @@
{#if inputSendTextActive} - + {/if} {#if uploadMusicActive} - + {/if}
diff --git a/front/src/Components/ConsoleGlobalMessageManager/InputTextGlobalMessage.svelte b/front/src/Components/ConsoleGlobalMessageManager/InputTextGlobalMessage.svelte index c11b4b0e..188e0bd3 100644 --- a/front/src/Components/ConsoleGlobalMessageManager/InputTextGlobalMessage.svelte +++ b/front/src/Components/ConsoleGlobalMessageManager/InputTextGlobalMessage.svelte @@ -1,12 +1,10 @@ @@ -20,17 +27,17 @@
-

This room use this map :

+

This room use the following map :

{mapName}

{mapDescription}

diff --git a/front/src/Components/Menu/ContactSubMenu.svelte b/front/src/Components/Menu/ContactSubMenu.svelte index bf16e42d..223f0324 100644 --- a/front/src/Components/Menu/ContactSubMenu.svelte +++ b/front/src/Components/Menu/ContactSubMenu.svelte @@ -22,37 +22,37 @@ The WorkAdventure team has its own offices in ... WorkAdventure! Do not hesitate to come see and talk to us.

- Visit us + Visit us

Our Mail

Although we offer a solution to reduce their use, we have an email address that allows us to receive all your requests.

- hello@workadventu.re + hello@workadventu.re

Our web site

If you want to know more about us, follow the link to our web site.

- About us + About us

Our social media

- {'Discord'} + {'Discord'} - {'Facebook'} + {'Facebook'} - {'Instagram'} + {'Instagram'} - {'LinkedIn'} + {'LinkedIn'} - {'Twitter'} + {'Twitter'} - {'Youtube'} + {'Youtube'}
diff --git a/front/src/Components/Menu/CustomSubMenu.svelte b/front/src/Components/Menu/CustomSubMenu.svelte new file mode 100644 index 00000000..6e51c38d --- /dev/null +++ b/front/src/Components/Menu/CustomSubMenu.svelte @@ -0,0 +1,13 @@ + + +
+ +
\ No newline at end of file diff --git a/front/src/Components/Menu/Menu.svelte b/front/src/Components/Menu/Menu.svelte index 3ac1f781..572fa19e 100644 --- a/front/src/Components/Menu/Menu.svelte +++ b/front/src/Components/Menu/Menu.svelte @@ -1,32 +1,57 @@ + +
- open menu + open menu
- - diff --git a/front/dist/resources/html/gameMenuIcon.html b/front/dist/resources/html/gameMenuIcon.html deleted file mode 100644 index 22fe9867..00000000 --- a/front/dist/resources/html/gameMenuIcon.html +++ /dev/null @@ -1,28 +0,0 @@ - -
-
- -
-
\ No newline at end of file diff --git a/front/dist/resources/html/gameQualityMenu.html b/front/dist/resources/html/gameQualityMenu.html deleted file mode 100644 index babb3f0e..00000000 --- a/front/dist/resources/html/gameQualityMenu.html +++ /dev/null @@ -1,81 +0,0 @@ - - - diff --git a/front/dist/resources/html/gameReport.html b/front/dist/resources/html/gameReport.html deleted file mode 100644 index d35ae556..00000000 --- a/front/dist/resources/html/gameReport.html +++ /dev/null @@ -1,115 +0,0 @@ - - -
-
- -

Moderate

-

What action do you want to take?

-
-
-

Block:

-

Block any communication from and to this user. This can be reverted.

-
- -
-
-
-

Report:

-

Send a report message to the administrators of this room. They may later ban this user.

-
-
-
Your message:
- -

-
-
- -
-
-
-
- diff --git a/front/dist/resources/html/gameShare.html b/front/dist/resources/html/gameShare.html deleted file mode 100644 index 404c8680..00000000 --- a/front/dist/resources/html/gameShare.html +++ /dev/null @@ -1,96 +0,0 @@ - - - diff --git a/front/dist/webpack.config.d.ts b/front/dist/webpack.config.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/front/dist/webpack.config.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; From 005a3c5a0d091cb93524418fefc9edafabdfd88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gr=C3=A9goire=20parant?= Date: Sun, 15 Aug 2021 23:13:48 +0200 Subject: [PATCH 12/62] Release 1.4.14 (#1370) * New version of cache management (#1365) Signed-off-by: Gregoire Parant * Exit scene acess denied detected (#1369) * Add auth token user to get right in admin and check if user have right Signed-off-by: Gregoire Parant * Update error show Signed-off-by: Gregoire Parant * Update token generation (#1372) - Permit only decode token to get map details, - If user have token expired, set the token to null and reload the page. This feature will be updated when authentication stategy will be finished. Signed-off-by: Gregoire Parant --- front/dist/service-worker-prod.js | 2 +- .../src/Components/Video/VideoMediaBox.svelte | 1 - front/src/Connexion/ConnectionManager.ts | 19 +++++++++++-- front/src/Connexion/Room.ts | 2 ++ front/src/Phaser/Game/GameScene.ts | 28 +++++++++++++++++-- front/src/Phaser/Login/EntryScene.ts | 13 ++++++++- front/src/Phaser/Reconnecting/ErrorScene.ts | 6 +++- pusher/src/Controller/BaseController.ts | 7 ++++- pusher/src/Controller/IoSocketController.ts | 2 +- pusher/src/Controller/MapController.ts | 18 +++++++++++- pusher/src/Services/AdminApi.ts | 10 +++++-- pusher/src/Services/JWTTokenManager.ts | 4 +-- 12 files changed, 96 insertions(+), 16 deletions(-) diff --git a/front/dist/service-worker-prod.js b/front/dist/service-worker-prod.js index 2f8d6a51..919b0b91 100644 --- a/front/dist/service-worker-prod.js +++ b/front/dist/service-worker-prod.js @@ -1,4 +1,4 @@ -let CACHE_NAME = 'workavdenture-cache-v1.2'; +let CACHE_NAME = 'workavdenture-cache-v1.4.14'; let urlsToCache = [ '/' ]; diff --git a/front/src/Components/Video/VideoMediaBox.svelte b/front/src/Components/Video/VideoMediaBox.svelte index 6b981dc8..924bb13a 100644 --- a/front/src/Components/Video/VideoMediaBox.svelte +++ b/front/src/Components/Video/VideoMediaBox.svelte @@ -22,7 +22,6 @@ let isMobile : boolean|null; const unsubscribe = obtainedMediaConstraintIsMobileStore.subscribe(value => { - console.log('unsubscribe => obtainedMediaConstraintIsMobileStore', value); isMobile = value; }); onDestroy(unsubscribe); diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index 38272737..9e245d3a 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -29,11 +29,24 @@ class ConnectionManager { }); } - public loadOpenIDScreen() { - localUserStore.setAuthToken(null); + /** + * @return Promise + */ + public loadOpenIDScreen(): Promise { const state = localUserStore.generateState(); const nonce = localUserStore.generateNonce(); - window.location.assign(`http://${PUSHER_URL}/login-screen?state=${state}&nonce=${nonce}`); + localUserStore.setAuthToken(null); + + //TODO refactor this and don't realise previous call + return Axios.get(`http://${PUSHER_URL}/login-screen?state=${state}&nonce=${nonce}`) + .then(() => { + window.location.assign(`http://${PUSHER_URL}/login-screen?state=${state}&nonce=${nonce}`); + }) + .catch((err) => { + console.error(err, "We don't have URL to regenerate authentication user"); + //TODO show modal login + window.location.reload(); + }); } public logout() { diff --git a/front/src/Connexion/Room.ts b/front/src/Connexion/Room.ts index 2053911d..be9b5294 100644 --- a/front/src/Connexion/Room.ts +++ b/front/src/Connexion/Room.ts @@ -1,6 +1,7 @@ import Axios from "axios"; import { PUSHER_URL } from "../Enum/EnvironmentVariable"; import type { CharacterTexture } from "./LocalUser"; +import { localUserStore } from "./LocalUserStore"; export class MapDetail { constructor(public readonly mapUrl: string, public readonly textures: CharacterTexture[] | undefined) {} @@ -87,6 +88,7 @@ export class Room { const result = await Axios.get(`${PUSHER_URL}/map`, { params: { playUri: this.roomUrl.toString(), + authToken: localUserStore.getAuthToken(), }, }); diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index ce947224..16fa2c83 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -94,6 +94,7 @@ import { userIsAdminStore } from "../../Stores/GameStore"; import { layoutManagerActionStore } from "../../Stores/LayoutManagerStore"; import { get } from "svelte/store"; import { EmbeddedWebsiteManager } from "./EmbeddedWebsiteManager"; +import { helpCameraSettingsVisibleStore } from "../../Stores/HelpCameraSettingsStore"; export interface GameSceneInitInterface { initPosition: PointInterface | null; @@ -814,13 +815,24 @@ export class GameScene extends DirtyScene { private triggerOnMapLayerPropertyChange() { this.gameMap.onPropertyChange("exitSceneUrl", (newValue, oldValue) => { - if (newValue) + if (newValue) { this.onMapExit( Room.getRoomPathFromExitSceneUrl(newValue as string, window.location.toString(), this.MapUrlFile) ); + } else { + setTimeout(() => { + layoutManagerActionStore.removeAction("roomAccessDenied"); + }, 2000); + } }); this.gameMap.onPropertyChange("exitUrl", (newValue, oldValue) => { - if (newValue) this.onMapExit(Room.getRoomPathFromExitUrl(newValue as string, window.location.toString())); + if (newValue) { + this.onMapExit(Room.getRoomPathFromExitUrl(newValue as string, window.location.toString())); + } else { + setTimeout(() => { + layoutManagerActionStore.removeAction("roomAccessDenied"); + }, 2000); + } }); this.gameMap.onPropertyChange("openWebsite", (newValue, oldValue, allProps) => { if (newValue === undefined) { @@ -1290,6 +1302,18 @@ ${escapedMessage} targetRoom = await Room.createRoom(roomUrl); } catch (e /*: unknown*/) { console.error('Error while fetching new room "' + roomUrl.toString() + '"', e); + + //show information room access denied + layoutManagerActionStore.addAction({ + uuid: "roomAccessDenied", + type: "warning", + message: "Room access denied. You don't have right to access on this room.", + callback: () => { + layoutManagerActionStore.removeAction("roomAccessDenied"); + }, + userInputManager: this.userInputManager, + }); + this.mapTransitioning = false; return; } diff --git a/front/src/Phaser/Login/EntryScene.ts b/front/src/Phaser/Login/EntryScene.ts index 3180d0f6..63181ae9 100644 --- a/front/src/Phaser/Login/EntryScene.ts +++ b/front/src/Phaser/Login/EntryScene.ts @@ -1,6 +1,6 @@ import { gameManager } from "../Game/GameManager"; import { Scene } from "phaser"; -import { ErrorScene } from "../Reconnecting/ErrorScene"; +import { ErrorScene, ErrorSceneName } from "../Reconnecting/ErrorScene"; import { WAError } from "../Reconnecting/WAError"; import { waScaleManager } from "../Services/WaScaleManager"; @@ -36,6 +36,17 @@ export class EntryScene extends Scene { ), this.scene ); + } else if (err.response && err.response.status == 403) { + ErrorScene.showError( + new WAError( + "Connection rejected", + "You cannot join the World. Try again later" + + (err.response.data ? ". \n\r \n\r" + `${err.response.data}` : "") + + ".", + "If you want more information, you may contact administrator or contact us at: hello@workadventu.re" + ), + this.scene + ); } else { ErrorScene.showError(err, this.scene); } diff --git a/front/src/Phaser/Reconnecting/ErrorScene.ts b/front/src/Phaser/Reconnecting/ErrorScene.ts index fb3d333a..6477b918 100644 --- a/front/src/Phaser/Reconnecting/ErrorScene.ts +++ b/front/src/Phaser/Reconnecting/ErrorScene.ts @@ -90,7 +90,11 @@ export class ErrorScene extends Phaser.Scene { // Axios HTTP error // client received an error response (5xx, 4xx) scene.start(ErrorSceneName, { - title: "HTTP " + error.response.status + " - " + error.response.statusText, + title: + "HTTP " + + error.response.status + + " - " + + (error.response.data ? error.response.data : error.response.statusText), subTitle: "An error occurred while accessing URL:", message: error.response.config.url, }); diff --git a/pusher/src/Controller/BaseController.ts b/pusher/src/Controller/BaseController.ts index ce378a55..a983333a 100644 --- a/pusher/src/Controller/BaseController.ts +++ b/pusher/src/Controller/BaseController.ts @@ -29,7 +29,12 @@ export class BaseController { if (e.response) { res.writeStatus(e.response.status + " " + e.response.statusText); this.addCorsHeaders(res); - res.end("An error occurred: " + e.response.status + " " + e.response.statusText); + res.end( + "An error occurred: " + + e.response.status + + " " + + (e.response.data && e.response.data.message ? e.response.data.message : e.response.statusText) + ); } else { res.writeStatus("500 Internal Server Error"); this.addCorsHeaders(res); diff --git a/pusher/src/Controller/IoSocketController.ts b/pusher/src/Controller/IoSocketController.ts index daf45ce4..0466100c 100644 --- a/pusher/src/Controller/IoSocketController.ts +++ b/pusher/src/Controller/IoSocketController.ts @@ -174,7 +174,7 @@ export class IoSocketController { } const tokenData = - token && typeof token === "string" ? jwtTokenManager.decodeJWTToken(token) : null; + token && typeof token === "string" ? jwtTokenManager.verifyJWTToken(token) : null; const userIdentifier = tokenData ? tokenData.identifier : ""; let memberTags: string[] = []; diff --git a/pusher/src/Controller/MapController.ts b/pusher/src/Controller/MapController.ts index 6ea2f19d..ccaa231f 100644 --- a/pusher/src/Controller/MapController.ts +++ b/pusher/src/Controller/MapController.ts @@ -5,6 +5,9 @@ import { adminApi } from "../Services/AdminApi"; import { ADMIN_API_URL } from "../Enum/EnvironmentVariable"; import { GameRoomPolicyTypes } from "../Model/PusherRoom"; import { MapDetailsData } from "../Services/AdminApi/MapDetailsData"; +import { socketManager } from "../Services/SocketManager"; +import { AuthTokenData, jwtTokenManager } from "../Services/JWTTokenManager"; +import { v4 } from "uuid"; export class MapController extends BaseController { constructor(private App: TemplatedApp) { @@ -67,7 +70,20 @@ export class MapController extends BaseController { (async () => { try { - const mapDetails = await adminApi.fetchMapDetails(query.playUri as string); + let userId: string | undefined = undefined; + if (query.authToken != undefined) { + let authTokenData: AuthTokenData; + try { + authTokenData = jwtTokenManager.verifyJWTToken(query.authToken as string); + userId = authTokenData.identifier; + } catch (e) { + // Decode token, in this case we don't need to create new token. + authTokenData = jwtTokenManager.verifyJWTToken(query.authToken as string, true); + userId = authTokenData.identifier; + console.info("JWT expire, but decoded", userId); + } + } + const mapDetails = await adminApi.fetchMapDetails(query.playUri as string, userId); res.writeStatus("200 OK"); this.addCorsHeaders(res); diff --git a/pusher/src/Services/AdminApi.ts b/pusher/src/Services/AdminApi.ts index 61ef8e20..f33480ca 100644 --- a/pusher/src/Services/AdminApi.ts +++ b/pusher/src/Services/AdminApi.ts @@ -31,13 +31,19 @@ export interface FetchMemberDataByUuidResponse { } class AdminApi { - async fetchMapDetails(playUri: string): Promise { + /** + * @var playUri: is url of the room + * @var userId: can to be undefined or email or uuid + * @return MapDetailsData|RoomRedirect + */ + async fetchMapDetails(playUri: string, userId?: string): Promise { if (!ADMIN_API_URL) { return Promise.reject(new Error("No admin backoffice set!")); } - const params: { playUri: string } = { + const params: { playUri: string; userId?: string } = { playUri, + userId, }; const res = await Axios.get(ADMIN_API_URL + "/api/map", { diff --git a/pusher/src/Services/JWTTokenManager.ts b/pusher/src/Services/JWTTokenManager.ts index bb21531c..4711ccfd 100644 --- a/pusher/src/Services/JWTTokenManager.ts +++ b/pusher/src/Services/JWTTokenManager.ts @@ -15,9 +15,9 @@ class JWTTokenManager { return Jwt.sign({ identifier }, SECRET_KEY, { expiresIn: "200d" }); } - public decodeJWTToken(token: string): AuthTokenData { + public verifyJWTToken(token: string, ignoreExpiration: boolean = false): AuthTokenData { try { - return Jwt.verify(token, SECRET_KEY, { ignoreExpiration: false }) as AuthTokenData; + return Jwt.verify(token, SECRET_KEY, { ignoreExpiration }) as AuthTokenData; } catch (e) { throw { reason: tokenInvalidException, message: e.message }; } From d0a85b0870baccf49b8cd64dae02f0a8209f570e Mon Sep 17 00:00:00 2001 From: GRL Date: Mon, 16 Aug 2021 14:33:53 +0200 Subject: [PATCH 13/62] fix deeployer --- deeployer.libsonnet | 1 + 1 file changed, 1 insertion(+) diff --git a/deeployer.libsonnet b/deeployer.libsonnet index 494c72b8..a2e8970a 100644 --- a/deeployer.libsonnet +++ b/deeployer.libsonnet @@ -101,6 +101,7 @@ }, "redis": { "image": "redis:6", + "ports": [6379] } }, "config": { From 82b95faa53a40159d997e32a7d1f402ad8ccef43 Mon Sep 17 00:00:00 2001 From: GRL Date: Mon, 16 Aug 2021 14:45:22 +0200 Subject: [PATCH 14/62] fix deeployer --- deeployer.libsonnet | 1 + 1 file changed, 1 insertion(+) diff --git a/deeployer.libsonnet b/deeployer.libsonnet index 494c72b8..a2e8970a 100644 --- a/deeployer.libsonnet +++ b/deeployer.libsonnet @@ -101,6 +101,7 @@ }, "redis": { "image": "redis:6", + "ports": [6379] } }, "config": { From 0bfac1a164c776f3612f755a5d210dd1eb056234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gr=C3=A9goire=20parant?= Date: Tue, 17 Aug 2021 13:26:20 +0200 Subject: [PATCH 15/62] Update cache API index (#1378) Signed-off-by: Gregoire Parant --- front/src/Connexion/LocalUserStore.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/src/Connexion/LocalUserStore.ts b/front/src/Connexion/LocalUserStore.ts index 25b673ac..03a64285 100644 --- a/front/src/Connexion/LocalUserStore.ts +++ b/front/src/Connexion/LocalUserStore.ts @@ -17,7 +17,7 @@ const authToken = "authToken"; const state = "state"; const nonce = "nonce"; -const cacheAPIIndex = "workavdenture-cache-v1"; +const cacheAPIIndex = "workavdenture-cache-v1.4.14"; class LocalUserStore { saveUser(localUser: LocalUser) { From 096baa88979d1ed13503fe88901d79c2083c7564 Mon Sep 17 00:00:00 2001 From: GRL Date: Tue, 17 Aug 2021 14:44:43 +0200 Subject: [PATCH 16/62] First pass on css --- .../Components/Menu/AboutRoomSubMenu.svelte | 58 +++++----- .../src/Components/Menu/ContactSubMenu.svelte | 101 ++++++++++-------- .../Components/Menu/CreateMapSubMenu.svelte | 43 +++++--- front/src/Components/Menu/Menu.svelte | 18 +++- front/src/Components/Menu/MenuIcon.svelte | 7 +- .../src/Components/Menu/ProfileSubMenu.svelte | 12 ++- .../Components/Menu/SettingsSubMenu.svelte | 33 ++++-- 7 files changed, 162 insertions(+), 110 deletions(-) diff --git a/front/src/Components/Menu/AboutRoomSubMenu.svelte b/front/src/Components/Menu/AboutRoomSubMenu.svelte index 711ebb5d..7749abd7 100644 --- a/front/src/Components/Menu/AboutRoomSubMenu.svelte +++ b/front/src/Components/Menu/AboutRoomSubMenu.svelte @@ -51,15 +51,13 @@ -
-

This room use the following map :

+

Informations on the map

+

{mapName}

{mapDescription}

-
-