diff --git a/docs/maps/menu.php b/docs/maps/menu.php new file mode 100644 index 00000000..9fb3428f --- /dev/null +++ b/docs/maps/menu.php @@ -0,0 +1,133 @@ + 'Getting started', + 'url' => '/map-building', + 'markdown' => 'maps.index' + ], + [ + 'title' => 'WorkAdventure maps', + 'url' => '/map-building/wa-maps', + 'markdown' => 'maps.wa-maps' + ], + [ + 'title' => 'Entries and exits', + 'url' => '/map-building/entry-exit.md', + 'markdown' => 'maps.entry-exit' + ], + [ + 'title' => 'Opening a website', + 'url' => '/map-building/opening-a-website.md', + 'markdown' => 'maps.opening-a-website' + ], + [ + 'title' => 'Meeting rooms', + 'url' => '/map-building/meeting-rooms.md', + 'markdown' => 'maps.meeting-rooms' + ], + [ + 'title' => 'Special zones', + 'url' => '/map-building/special-zones.md', + 'markdown' => 'maps.special-zones' + ], + [ + 'title' => 'Animations', + 'url' => '/map-building/animations.md', + 'markdown' => 'maps.animations' + ], + [ + 'title' => 'Integrated websites', + 'url' => '/map-building/website-in-map.md', + 'markdown' => 'maps.website-in-map' + ], + [ + 'title' => 'Variables', + 'url' => '/map-building/variables.md', + 'markdown' => 'maps.variables' + ], + [ + 'title' => 'Self-hosting your map', + 'url' => '/map-building/hosting.md', + 'markdown' => 'maps.hosting' + ], + $extraMenu, + [ + 'title' => 'Scripting maps', + 'url' => '/map-building/scripting', + 'markdown' => 'maps.scripting', + 'children' => [ + [ + 'title' => 'Using Typescript', + 'url' => '/map-building/using-typescript.md', + 'markdown' => 'maps.using-typescript' + ], + [ + 'title' => 'API Reference', + 'url' => '/map-building/api-reference', + 'markdown' => 'maps.api-reference', + 'collapse' => true, + 'children' => [ + [ + 'title' => 'Initialization', + 'url' => '/map-building/api-start.md', + 'markdown' => 'maps.api-start', + ], + [ + 'title' => 'Navigation', + 'url' => '/map-building/api-nav.md', + 'markdown' => 'maps.api-nav', + ], + [ + 'title' => 'Chat', + 'url' => '/map-building/api-chat.md', + 'markdown' => 'maps.api-chat', + ], + [ + 'title' => 'Room', + 'url' => '/map-building/api-room.md', + 'markdown' => 'maps.api-room', + ], + [ + 'title' => 'State', + 'url' => '/map-building/api-state.md', + 'markdown' => 'maps.api-state', + ], + [ + 'title' => 'Player', + 'url' => '/map-building/api-player.md', + 'markdown' => 'maps.api-player', + ], + [ + 'title' => 'UI', + 'url' => '/map-building/api-ui.md', + 'markdown' => 'maps.api-ui', + ], + [ + 'title' => 'Sound', + 'url' => '/map-building/api-sound.md', + 'markdown' => 'maps.api-sound', + ], + [ + 'title' => 'Controls', + 'url' => '/map-building/api-controls.md', + 'markdown' => 'maps.api-controls', + ], + [ + 'title' => 'Deprecated', + 'url' => '/map-building/api-deprecated.md', + 'markdown' => 'maps.api-deprecated', + ], + ] + ], + $extraUtilsMenu + ] + ], + [ + 'title' => 'Troubleshooting', + 'url' => '/map-building/troubleshooting', + 'view' => 'content.map.troubleshooting' + ], +]; diff --git a/docs/maps/opening-a-website.md b/docs/maps/opening-a-website.md index 29ea8af1..682306b4 100644 --- a/docs/maps/opening-a-website.md +++ b/docs/maps/opening-a-website.md @@ -10,9 +10,10 @@ on the right side of the screen) In order to create a zone that opens websites: -* You must create a specific layer. -* In layer properties, you MUST add a "`openWebsite`" property (of type "`string`"). The value of the property is the URL of the website to open (the URL must start with "https://") -* You may also use "`openWebsiteWidth`" property (of type "`number`" between 0 and 100) to control the width of the iframe. +* You must create a specific layer. +* In layer properties, you MUST add a "`openWebsite`" property (of type "`string`"). The value of the property is the URL of the website to open (the URL must start with "https://") +* You may also use "`openWebsiteWidth`" property (of type "`number`" between 0 and 100) to control the width of the iframe. +* You may also use "`openTab`" property (of type "`string`") to open in a new tab instead. {.alert.alert-warning} A website can explicitly forbid another website from loading it in an iFrame using diff --git a/front/dist/.htaccess b/front/dist/.htaccess index 72c4d724..522fc2af 100644 --- a/front/dist/.htaccess +++ b/front/dist/.htaccess @@ -22,3 +22,5 @@ RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule "^[_@]/" "/index.html" [L] RewriteRule "^register/" "/index.html" [L] +RewriteRule "^login" "/index.html" [L] +RewriteRule "^jwt/" "/index.html" [L] diff --git a/front/src/Components/Menu/Menu.svelte b/front/src/Components/Menu/Menu.svelte index 4086a9ae..6cbef9c1 100644 --- a/front/src/Components/Menu/Menu.svelte +++ b/front/src/Components/Menu/Menu.svelte @@ -7,7 +7,13 @@ import GlobalMessageSubMenu from "./GlobalMessagesSubMenu.svelte"; import ContactSubMenu from "./ContactSubMenu.svelte"; import CustomSubMenu from "./CustomSubMenu.svelte" - import {customMenuIframe, menuVisiblilityStore, SubMenusInterface, subMenusStore} from "../../Stores/MenuStore"; + import { + checkSubMenuToShow, + customMenuIframe, + menuVisiblilityStore, + SubMenusInterface, + subMenusStore + } from "../../Stores/MenuStore"; import {onDestroy, onMount} from "svelte"; import {get} from "svelte/store"; import type {Unsubscriber} from "svelte/store"; @@ -25,6 +31,8 @@ } }) + checkSubMenuToShow(); + switchMenu(SubMenusInterface.settings); }) @@ -95,6 +103,7 @@
@@ -110,9 +119,9 @@ font-family: "Press Start 2P"; pointer-events: auto; - height: 80vh; - width: 75vw; - top: 10vh; + height: 80%; + width: 75%; + top: 10%; position: relative; margin: auto; @@ -139,16 +148,34 @@ div.menu-submenu-container { background-color: #333333; color: whitesmoke; + + .nes-btn.is-error.close { + position: absolute; + top: -20px; + right: -20px; + } } } @media only screen and (max-width: 800px) { div.menu-container-main { --size-first-columns-grid: 120px; - height: 70vh; + height: 70%; top: 55px; - width: 100vw; + width: 100%; font-size: 0.5em; + + div.menu-nav-sidebar { + overflow-y: auto; + } + + div.menu-submenu-container { + .nes-btn.is-error.close { + position: absolute; + top: -35px; + right: 0; + } + } } } \ No newline at end of file diff --git a/front/src/Components/Menu/ProfileSubMenu.svelte b/front/src/Components/Menu/ProfileSubMenu.svelte index 43276fb8..a210ab26 100644 --- a/front/src/Components/Menu/ProfileSubMenu.svelte +++ b/front/src/Components/Menu/ProfileSubMenu.svelte @@ -45,11 +45,6 @@ enableCameraSceneVisibilityStore.showEnableCameraScene(); gameManager.leaveGame(EnableCameraSceneName, new EnableCameraScene()); } - - //TODO: Uncomment when login will be completely developed - /*function clickLogin() { - connectionManager.loadOpenIDScreen(); - }*/ \ No newline at end of file diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index 228ae0d3..4668bb10 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -57,7 +57,7 @@ class ConnectionManager { loginSceneVisibleIframeStore.set(false); return null; } - const redirectUrl = `${this._currentRoom.iframeAuthentication}?state=${state}&nonce=${nonce}`; + const redirectUrl = `${this._currentRoom.iframeAuthentication}?state=${state}&nonce=${nonce}&playUri=${this._currentRoom.key}`; window.location.assign(redirectUrl); return redirectUrl; } @@ -88,10 +88,9 @@ class ConnectionManager { this.connexionType = connexionType; this._currentRoom = null; if (connexionType === GameConnexionTypes.login) { - //TODO clear all cash and redirect on login scene (iframe) - localUserStore.setAuthToken(null); this._currentRoom = await Room.createRoom(new URL(localUserStore.getLastRoomUrl())); - urlManager.pushRoomIdToUrl(this._currentRoom); + this.loadOpenIDScreen(); + return Promise.reject(new Error("You will be redirect on login page")); } else if (connexionType === GameConnexionTypes.jwt) { const urlParams = new URLSearchParams(window.location.search); const code = urlParams.get("code"); @@ -103,13 +102,14 @@ class ConnectionManager { throw "No Auth code provided"; } localUserStore.setCode(code); + this._currentRoom = await Room.createRoom(new URL(localUserStore.getLastRoomUrl())); try { await this.checkAuthUserConnexion(); } catch (err) { console.error(err); this.loadOpenIDScreen(); + return Promise.reject(new Error("You will be redirect on login page")); } - this._currentRoom = await Room.createRoom(new URL(localUserStore.getLastRoomUrl())); urlManager.pushRoomIdToUrl(this._currentRoom); } else if (connexionType === GameConnexionTypes.register) { //@deprecated diff --git a/front/src/Stores/MenuStore.ts b/front/src/Stores/MenuStore.ts index 374adae7..b13343b4 100644 --- a/front/src/Stores/MenuStore.ts +++ b/front/src/Stores/MenuStore.ts @@ -71,7 +71,7 @@ function createSubMenusStore() { export const subMenusStore = createSubMenusStore(); -function checkSubMenuToShow() { +export function checkSubMenuToShow() { if (!get(userIsAdminStore)) { subMenusStore.removeMenu(SubMenusInterface.globalMessages); } @@ -83,8 +83,6 @@ function checkSubMenuToShow() { subMenusStore.removeMenu(SubMenusInterface.aboutRoom); } -checkSubMenuToShow(); - export const customMenuIframe = new Map