Merge branch 'master' into develop

Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>

# Conflicts:
#	messages/JsonMessages/MapDetailsData.ts
This commit is contained in:
Gregoire Parant 2022-05-05 11:55:41 +02:00
commit b6e006d7bb
7 changed files with 40 additions and 3 deletions

View File

@ -570,6 +570,7 @@ export class GameRoom {
mapUrl,
authenticationMandatory: null,
group: null,
showPoweredBy: true,
};
}

View File

@ -63,7 +63,7 @@
<section class="action">
<button type="submit" class="nes-btn is-primary loginSceneFormSubmit">{$LL.login.continue()}</button>
</section>
{#if logo !== logoImg}
{#if logo !== logoImg && gameManager.currentStartedRoom.showPoweredBy !== false}
<section class="text-center powered-by">
<img src={poweredByWorkAdventureImg} alt="Powered by WorkAdventure" />
</section>

View File

@ -295,7 +295,32 @@ class ConnectionManager {
});
connection.connectionErrorStream.subscribe((event: CloseEvent) => {
console.log("connectionErrorStream => An error occurred while connecting to socket server. Retrying");
console.info(
"An error occurred while connecting to socket server. Retrying => Event: ",
event.reason,
event.code,
event
);
//However, Chrome will rarely report any close code 1006 reasons to the Javascript side.
//This is likely due to client security rules in the WebSocket spec to prevent abusing WebSocket.
//(such as using it to scan for open ports on a destination server, or for generating lots of connections for a denial-of-service attack).
// more detail here: https://www.rfc-editor.org/rfc/rfc6455#section-7.4.1
if (event.code === 1006) {
//check cookies
const cookies = document.cookie.split(";");
for (const cookie of cookies) {
//check id cookie posthog exist
const numberIndexPh = cookie.indexOf("_posthog=");
if (numberIndexPh !== -1) {
//if exist, remove posthog cookie
document.cookie =
cookie.slice(0, numberIndexPh + 9) +
"; domain=.workadventu.re; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";
}
}
}
reject(
new Error(
"An error occurred while connecting to socket server. Retrying. Code: " +

View File

@ -25,6 +25,7 @@ export class Room {
private _canReport: boolean = false;
private _loadingLogo: string | undefined;
private _loginSceneLogo: string | undefined;
private _showPoweredBy: boolean | undefined = true;
private constructor(private roomUrl: URL) {
this.id = roomUrl.pathname;
@ -120,6 +121,7 @@ export class Room {
this._canReport = data.canReport ?? false;
this._loadingLogo = data.loadingLogo ?? undefined;
this._loginSceneLogo = data.loginSceneLogo ?? undefined;
this._showPoweredBy = data.showPoweredBy ?? true;
return new MapDetail(data.mapUrl);
} else {
console.log(data);
@ -213,4 +215,8 @@ export class Room {
get loginSceneLogo(): string | undefined {
return this._loginSceneLogo;
}
get showPoweredBy(): boolean | undefined {
return this._showPoweredBy;
}
}

View File

@ -54,7 +54,7 @@ export class Loader {
.catch((e) => console.warn("Could not load logo: ", logoResource, e));
let poweredByLogoPromise: CancelablePromise<Texture> | undefined;
if (gameManager.currentStartedRoom.loadingLogo) {
if (gameManager.currentStartedRoom.loadingLogo && gameManager.currentStartedRoom.showPoweredBy !== false) {
poweredByLogoPromise = this.superLoad.image(
"poweredByLogo",
"static/images/Powered_By_WorkAdventure_Small.png"

View File

@ -49,6 +49,10 @@ export const isMapDetailsData = z.object({
description: "The URL of the image to be used on the LoginScene",
example: "https://example.com/logo_login.png",
}),
showPoweredBy: extendApi(z.boolean(), {
description: "The URL of the image to be used on the name scene",
example: "https://example.com/logo_login.png",
}),
});
export type MapDetailsData = z.infer<typeof isMapDetailsData>;

View File

@ -49,6 +49,7 @@ class LocalAdmin implements AdminInterface {
iframeAuthentication: null,
loadingLogo: null,
loginSceneLogo: null,
showPoweredBy: true,
});
}