From a6e037425790c7d36b6e3938c7075112ae32c8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Cardinale?= Date: Thu, 5 May 2022 19:23:07 +0200 Subject: [PATCH] All customized logo (#2168) * Change dynamic logo in reconnecting scene * Add cowebsite customized logo * Fix prettier issues * Fix prettier issues (2) * Fix login scene PoweredBy * Delete all console logs --- front/src/Components/Login/LoginScene.svelte | 3 ++- front/src/Components/Menu/MenuIcon.svelte | 5 ++++- front/src/Connexion/Room.ts | 12 ++++++++++++ front/src/Phaser/Login/EntryScene.ts | 1 - front/src/Phaser/Reconnecting/ReconnectingScene.ts | 9 +++++++-- front/src/Stores/MenuStore.ts | 5 +++-- front/src/WebRtc/CoWebsiteManager.ts | 11 +++++++++++ front/style/cowebsite/_global.scss | 4 ++++ messages/JsonMessages/MapDetailsData.ts | 5 +++++ pusher/src/Controller/AuthenticateController.ts | 9 ++++++--- pusher/src/Services/AdminApi.ts | 8 ++++++-- pusher/src/Services/AdminInterface.ts | 8 +++++++- pusher/src/Services/LocalAdmin.ts | 8 +++++++- 13 files changed, 74 insertions(+), 14 deletions(-) diff --git a/front/src/Components/Login/LoginScene.svelte b/front/src/Components/Login/LoginScene.svelte index edc45ce2..a25fa2ee 100644 --- a/front/src/Components/Login/LoginScene.svelte +++ b/front/src/Components/Login/LoginScene.svelte @@ -64,7 +64,7 @@ {#if logo !== logoImg && gameManager.currentStartedRoom.showPoweredBy !== false} -
+
Powered by WorkAdventure
{/if} @@ -144,6 +144,7 @@ &.powered-by { position: fixed; bottom: 0; + right: 10px; } } } diff --git a/front/src/Components/Menu/MenuIcon.svelte b/front/src/Components/Menu/MenuIcon.svelte index b5d71563..00dd759d 100644 --- a/front/src/Components/Menu/MenuIcon.svelte +++ b/front/src/Components/Menu/MenuIcon.svelte @@ -11,6 +11,9 @@ import { showShareLinkMapModalStore } from "../../Stores/ModalStore"; import LL from "../../i18n/i18n-svelte"; import { analyticsClient } from "../../Administration/AnalyticsClient"; + import { gameManager } from "../../Phaser/Game/GameManager"; + + let miniLogo = gameManager.currentStartedRoom.miniLogo ?? logoWA; function showMenu() { menuVisiblilityStore.set(!get(menuVisiblilityStore)); @@ -57,7 +60,7 @@ /> {:else} {$LL.menu.icon.open.menu()} { diff --git a/front/style/cowebsite/_global.scss b/front/style/cowebsite/_global.scss index 2a6a3f4a..e3bad8be 100644 --- a/front/style/cowebsite/_global.scss +++ b/front/style/cowebsite/_global.scss @@ -5,6 +5,10 @@ background-color: rgba(10, 9, 9, 0.8); display: none; + #cowebsite-slot-main #custom-logo{ + max-width: 30%; + } + main { iframe { width: 100%; diff --git a/messages/JsonMessages/MapDetailsData.ts b/messages/JsonMessages/MapDetailsData.ts index c191ae72..51cb7187 100644 --- a/messages/JsonMessages/MapDetailsData.ts +++ b/messages/JsonMessages/MapDetailsData.ts @@ -39,6 +39,11 @@ export const isMapDetailsData = z.object({ description: 'Whether the "report" feature is enabled or not on this room', example: true, }), + loadingCowebsiteLogo: extendApi(z.optional(z.nullable(z.string())), { + description: "The URL of the image to be used on the cowebsite loading page", + example: "https://example.com/logo.gif", + }), + miniLogo: z.optional(z.nullable(z.string())), // The URL of the logo image on the loading screen loadingLogo: extendApi(z.optional(z.nullable(z.string())), { description: "The URL of the image to be used on the loading page", diff --git a/pusher/src/Controller/AuthenticateController.ts b/pusher/src/Controller/AuthenticateController.ts index 62daef9a..6eee2e5d 100644 --- a/pusher/src/Controller/AuthenticateController.ts +++ b/pusher/src/Controller/AuthenticateController.ts @@ -418,7 +418,7 @@ export class AuthenticateController extends BaseHttpController { profileCallback() { // eslint-disable-next-line @typescript-eslint/no-misused-promises this.app.get("/profile-callback", async (req, res) => { - const { token } = parse(req.path_query); + const { token, playUri } = parse(req.path_query); try { //verify connected by token if (token != undefined) { @@ -431,7 +431,10 @@ export class AuthenticateController extends BaseHttpController { //get login profile res.status(302); - res.setHeader("Location", adminService.getProfileUrl(authTokenData.accessToken)); + res.setHeader( + "Location", + adminService.getProfileUrl(authTokenData.accessToken, playUri as string) + ); res.send(""); return; } catch (error) { @@ -497,7 +500,7 @@ export class AuthenticateController extends BaseHttpController { * @param email * @param playUri * @param IPAddress - * @return + * @return |object * @private */ diff --git a/pusher/src/Services/AdminApi.ts b/pusher/src/Services/AdminApi.ts index cdd2e35b..6fbf0a8f 100644 --- a/pusher/src/Services/AdminApi.ts +++ b/pusher/src/Services/AdminApi.ts @@ -457,11 +457,15 @@ class AdminApi implements AdminInterface { }); } - getProfileUrl(accessToken: string): string { + getProfileUrl(accessToken: string, playUri: string): string { if (!OPID_PROFILE_SCREEN_PROVIDER) { throw new Error("No admin backoffice set!"); } - return `${OPID_PROFILE_SCREEN_PROVIDER}?accessToken=${accessToken}`; + return `${OPID_PROFILE_SCREEN_PROVIDER}?accessToken=${accessToken}&playUri=${playUri}`; + } + + async logoutOauth(token: string): Promise { + await Axios.get(ADMIN_API_URL + `/oauth/logout?token=${token}`); } } diff --git a/pusher/src/Services/AdminInterface.ts b/pusher/src/Services/AdminInterface.ts index afdf4a9e..7ec8806c 100644 --- a/pusher/src/Services/AdminInterface.ts +++ b/pusher/src/Services/AdminInterface.ts @@ -71,7 +71,13 @@ export interface AdminInterface { /** * @param accessToken + * @param playUri * @return string */ - getProfileUrl(accessToken: string): string; + getProfileUrl(accessToken: string, playUri: string): string; + + /** + * @param token + */ + logoutOauth(token: string): Promise; } diff --git a/pusher/src/Services/LocalAdmin.ts b/pusher/src/Services/LocalAdmin.ts index d16f4c30..4b58b359 100644 --- a/pusher/src/Services/LocalAdmin.ts +++ b/pusher/src/Services/LocalAdmin.ts @@ -47,9 +47,11 @@ class LocalAdmin implements AdminInterface { contactPage: null, group: null, iframeAuthentication: null, + miniLogo: null, loadingLogo: null, loginSceneLogo: null, showPoweredBy: true, + loadingCowebsiteLogo: null, }); } @@ -84,10 +86,14 @@ class LocalAdmin implements AdminInterface { return Promise.reject(new Error("No admin backoffice set!")); } - getProfileUrl(accessToken: string): string { + getProfileUrl(accessToken: string, playUri: string): string { new Error("No admin backoffice set!"); return ""; } + + async logoutOauth(token: string): Promise { + return Promise.reject(new Error("No admin backoffice set!")); + } } export const localAdmin = new LocalAdmin();