Merge remote-tracking branch 'origin/develop' into swaggerPusher
This commit is contained in:
commit
bb675184e2
1
.github/workflows/end_to_end_tests.yml
vendored
1
.github/workflows/end_to_end_tests.yml
vendored
@ -21,6 +21,7 @@ jobs:
|
||||
working-directory: tests
|
||||
- name: Install Playwright
|
||||
run: npx playwright install --with-deps
|
||||
working-directory: tests
|
||||
- name: 'Setup .env file'
|
||||
run: cp .env.template .env
|
||||
- name: Install messages dependencies
|
||||
|
@ -44,6 +44,7 @@
|
||||
"cross-env": "^7.0.3",
|
||||
"deep-copy-ts": "^0.5.0",
|
||||
"easystarjs": "^0.4.4",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"google-protobuf": "^3.13.0",
|
||||
"phaser": "3.55.1",
|
||||
"phaser-animated-tiles": "workadventure/phaser-animated-tiles#da68bbededd605925621dd4f03bd27e69284b254",
|
||||
|
@ -9,5 +9,8 @@
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"rxjs": "^6.6.3"
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ class AnalyticsClient {
|
||||
constructor() {
|
||||
if (POSTHOG_API_KEY && POSTHOG_URL) {
|
||||
this.posthogPromise = import("posthog-js").then(({ default: posthog }) => {
|
||||
posthog.init(POSTHOG_API_KEY, { api_host: POSTHOG_URL, disable_cookie: true });
|
||||
posthog.init(POSTHOG_API_KEY, { api_host: POSTHOG_URL });
|
||||
//the posthog toolbar need a reference in window to be able to work
|
||||
window.posthog = posthog;
|
||||
return posthog;
|
||||
|
@ -1,7 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { gameManager } from "../../Phaser/Game/GameManager";
|
||||
import { SelectCompanionScene, SelectCompanionSceneName } from "../../Phaser/Login/SelectCompanionScene";
|
||||
import { menuIconVisiblilityStore, menuVisiblilityStore, userIsConnected } from "../../Stores/MenuStore";
|
||||
import {
|
||||
menuIconVisiblilityStore,
|
||||
menuVisiblilityStore,
|
||||
userIsConnected,
|
||||
profileAvailable,
|
||||
getProfileUrl,
|
||||
} from "../../Stores/MenuStore";
|
||||
import { selectCompanionSceneVisibleStore } from "../../Stores/SelectCompanionStore";
|
||||
import { LoginScene, LoginSceneName } from "../../Phaser/Login/LoginScene";
|
||||
import { loginSceneVisibleStore } from "../../Stores/LoginSceneStore";
|
||||
@ -9,7 +15,6 @@
|
||||
import { SelectCharacterScene, SelectCharacterSceneName } from "../../Phaser/Login/SelectCharacterScene";
|
||||
import { connectionManager } from "../../Connexion/ConnectionManager";
|
||||
import { PROFILE_URL } from "../../Enum/EnvironmentVariable";
|
||||
import { localUserStore } from "../../Connexion/LocalUserStore";
|
||||
import { EnableCameraScene, EnableCameraSceneName } from "../../Phaser/Login/EnableCameraScene";
|
||||
import { enableCameraSceneVisibilityStore } from "../../Stores/MediaStore";
|
||||
import btnProfileSubMenuCamera from "../images/btn-menu-profile-camera.svg";
|
||||
@ -47,10 +52,6 @@
|
||||
return connectionManager.logout();
|
||||
}
|
||||
|
||||
function getProfileUrl() {
|
||||
return PROFILE_URL + `?token=${localUserStore.getAuthToken()}`;
|
||||
}
|
||||
|
||||
function openEnableCameraScene() {
|
||||
disableMenuStores();
|
||||
enableCameraSceneVisibilityStore.showEnableCameraScene();
|
||||
@ -81,7 +82,7 @@
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
{#if $userIsConnected}
|
||||
{#if $userIsConnected && $profileAvailable}
|
||||
<section>
|
||||
{#if PROFILE_URL != undefined}
|
||||
<iframe title="profile" src={getProfileUrl()} />
|
||||
|
@ -290,12 +290,12 @@ class ConnectionManager {
|
||||
);
|
||||
|
||||
connection.onConnectError((error: object) => {
|
||||
console.log("An error occurred while connecting to socket server. Retrying");
|
||||
console.log("onConnectError => An error occurred while connecting to socket server. Retrying");
|
||||
reject(error);
|
||||
});
|
||||
|
||||
connection.connectionErrorStream.subscribe((event: CloseEvent) => {
|
||||
console.log("An error occurred while connecting to socket server. Retrying");
|
||||
console.log("connectionErrorStream => An error occurred while connecting to socket server. Retrying");
|
||||
reject(
|
||||
new Error(
|
||||
"An error occurred while connecting to socket server. Retrying. Code: " +
|
||||
|
@ -23,6 +23,7 @@ export const DISPLAY_TERMS_OF_USE = getEnvConfig("DISPLAY_TERMS_OF_USE") == "tru
|
||||
export const NODE_ENV = getEnvConfig("NODE_ENV") || "development";
|
||||
export const CONTACT_URL = getEnvConfig("CONTACT_URL") || undefined;
|
||||
export const PROFILE_URL = getEnvConfig("PROFILE_URL") || undefined;
|
||||
export const IDENTITY_URL = getEnvConfig("IDENTITY_URL") || undefined;
|
||||
export const POSTHOG_API_KEY: string = (getEnvConfig("POSTHOG_API_KEY") as string) || "";
|
||||
export const POSTHOG_URL = getEnvConfig("POSTHOG_URL") || undefined;
|
||||
export const DISABLE_ANONYMOUS: boolean = getEnvConfig("DISABLE_ANONYMOUS") === "true";
|
||||
|
@ -177,6 +177,7 @@ export class GameScene extends DirtyScene {
|
||||
|
||||
private localVolumeStoreUnsubscriber: Unsubscriber | undefined;
|
||||
private followUsersColorStoreUnsubscribe!: Unsubscriber;
|
||||
private currentPlayerGroupIdStoreUnsubscribe!: Unsubscriber;
|
||||
private privacyShutdownStoreUnsubscribe!: Unsubscriber;
|
||||
private userIsJitsiDominantSpeakerStoreUnsubscriber!: Unsubscriber;
|
||||
private jitsiParticipantsCountStoreUnsubscriber!: Unsubscriber;
|
||||
@ -221,8 +222,8 @@ export class GameScene extends DirtyScene {
|
||||
private loader: Loader;
|
||||
private lastCameraEvent: WasCameraUpdatedEvent | undefined;
|
||||
private firstCameraUpdateSent: boolean = false;
|
||||
private showVoiceIndicatorChangeMessageSent: boolean = false;
|
||||
private currentPlayerGroupId?: number;
|
||||
private showVoiceIndicatorChangeMessageSent: boolean = false;
|
||||
private jitsiDominantSpeaker: boolean = false;
|
||||
private jitsiParticipantsCount: number = 0;
|
||||
public readonly superLoad: SuperLoaderPlugin;
|
||||
@ -842,6 +843,10 @@ export class GameScene extends DirtyScene {
|
||||
this.currentPlayerGroupId = message.groupId;
|
||||
});
|
||||
|
||||
this.connection.groupUsersUpdateMessageStream.subscribe((message) => {
|
||||
this.currentPlayerGroupId = message.groupId;
|
||||
});
|
||||
|
||||
/**
|
||||
* Triggered when we receive the JWT token to connect to Jitsi
|
||||
*/
|
||||
|
@ -11,6 +11,7 @@ import { peerStore } from "./PeerStore";
|
||||
import { privacyShutdownStore } from "./PrivacyShutdownStore";
|
||||
import { MediaStreamConstraintsError } from "./Errors/MediaStreamConstraintsError";
|
||||
import { SoundMeter } from "../Phaser/Components/SoundMeter";
|
||||
import deepEqual from "fast-deep-equal";
|
||||
|
||||
/**
|
||||
* A store that contains the camera state requested by the user (on or off).
|
||||
@ -314,10 +315,10 @@ export const mediaStreamConstraintsStore = derived(
|
||||
currentAudioConstraint = false;
|
||||
}
|
||||
|
||||
// Let's make the changes only if the new value is different from the old one.
|
||||
// Let's make the changes only if the new value is different from the old one.tile
|
||||
if (
|
||||
previousComputedVideoConstraint != currentVideoConstraint ||
|
||||
previousComputedAudioConstraint != currentAudioConstraint
|
||||
!deepEqual(previousComputedVideoConstraint, currentVideoConstraint) ||
|
||||
!deepEqual(previousComputedAudioConstraint, currentAudioConstraint)
|
||||
) {
|
||||
previousComputedVideoConstraint = currentVideoConstraint;
|
||||
previousComputedAudioConstraint = currentAudioConstraint;
|
||||
|
@ -1,17 +1,27 @@
|
||||
import { get, writable } from "svelte/store";
|
||||
import Timeout = NodeJS.Timeout;
|
||||
import { userIsAdminStore } from "./GameStore";
|
||||
import { CONTACT_URL } from "../Enum/EnvironmentVariable";
|
||||
import { CONTACT_URL, IDENTITY_URL, PROFILE_URL } from "../Enum/EnvironmentVariable";
|
||||
import { analyticsClient } from "../Administration/AnalyticsClient";
|
||||
import type { Translation } from "../i18n/i18n-types";
|
||||
import axios from "axios";
|
||||
import { localUserStore } from "../Connexion/LocalUserStore";
|
||||
|
||||
export const menuIconVisiblilityStore = writable(false);
|
||||
export const menuVisiblilityStore = writable(false);
|
||||
menuVisiblilityStore.subscribe((value) => {
|
||||
if (value) analyticsClient.openedMenu();
|
||||
});
|
||||
export const menuInputFocusStore = writable(false);
|
||||
export const userIsConnected = writable(false);
|
||||
export const profileAvailable = writable(true);
|
||||
|
||||
menuVisiblilityStore.subscribe((value) => {
|
||||
if (value) analyticsClient.openedMenu();
|
||||
if (userIsConnected && value && IDENTITY_URL != null) {
|
||||
axios.get(getMeUrl()).catch((err) => {
|
||||
console.error("menuVisiblilityStore => err => ", err);
|
||||
profileAvailable.set(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let warningContainerTimeout: Timeout | null = null;
|
||||
function createWarningContainerStore() {
|
||||
@ -173,3 +183,11 @@ export function handleMenuUnregisterEvent(menuName: string) {
|
||||
subMenusStore.removeScriptingMenu(menuName);
|
||||
customMenuIframe.delete(menuName);
|
||||
}
|
||||
|
||||
export function getProfileUrl() {
|
||||
return PROFILE_URL + `?token=${localUserStore.getAuthToken()}`;
|
||||
}
|
||||
|
||||
export function getMeUrl() {
|
||||
return IDENTITY_URL + `?token=${localUserStore.getAuthToken()}`;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const audio: BaseTranslation = {
|
||||
const audio: NonNullable<Translation["audio"]> = {
|
||||
manager: {
|
||||
reduce: "说话时降低音乐音量",
|
||||
allow: "播放声音",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const camera: BaseTranslation = {
|
||||
const camera: NonNullable<Translation["camera"]> = {
|
||||
enable: {
|
||||
title: "开启你的摄像头和麦克风",
|
||||
start: "出发!",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const chat: BaseTranslation = {
|
||||
const chat: NonNullable<Translation["chat"]> = {
|
||||
intro: "聊天历史:",
|
||||
enter: "输入消息...",
|
||||
menu: {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const companion: BaseTranslation = {
|
||||
const companion: NonNullable<Translation["companion"]> = {
|
||||
select: {
|
||||
title: "选择你的伙伴",
|
||||
any: "没有伙伴",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const emoji: BaseTranslation = {
|
||||
const emoji: NonNullable<Translation["emoji"]> = {
|
||||
search: "搜索 emojis...",
|
||||
categories: {
|
||||
recents: "最近的 Emojis",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const error: BaseTranslation = {
|
||||
const error: NonNullable<Translation["error"]> = {
|
||||
accessLink: {
|
||||
title: "访问链接错误",
|
||||
subTitle: "找不到地图。请检查你的访问链接。",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const follow: BaseTranslation = {
|
||||
const follow: NonNullable<Translation["follow"]> = {
|
||||
interactStatus: {
|
||||
following: "跟随 {leader}",
|
||||
waitingFollowers: "等待跟随者确认",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import en_US from "../en-US";
|
||||
import type { Translation } from "../i18n-types";
|
||||
import audio from "./audio";
|
||||
import camera from "./camera";
|
||||
import chat from "./chat";
|
||||
@ -13,7 +14,8 @@ import warning from "./warning";
|
||||
import emoji from "./emoji";
|
||||
import trigger from "./trigger";
|
||||
|
||||
const zh_CN: BaseTranslation = {
|
||||
const zh_CN: Translation = {
|
||||
...(en_US as Translation),
|
||||
language: "中文",
|
||||
country: "中国",
|
||||
audio,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const login: BaseTranslation = {
|
||||
const login: NonNullable<Translation["login"]> = {
|
||||
input: {
|
||||
name: {
|
||||
placeholder: "输入你的名字",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const menu: BaseTranslation = {
|
||||
const menu: NonNullable<Translation["menu"]> = {
|
||||
title: "菜单",
|
||||
icon: {
|
||||
open: {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const report: BaseTranslation = {
|
||||
const report: NonNullable<Translation["report"]> = {
|
||||
block: {
|
||||
title: "屏蔽",
|
||||
content: "屏蔽任何来自 {userName} 的通信。该操作是可逆的。",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const trigger: BaseTranslation = {
|
||||
const trigger: NonNullable<Translation["trigger"]> = {
|
||||
cowebsite: "按空格键或点击这里打开网页",
|
||||
jitsiRoom: "按空格键或点击这里进入Jitsi Meet会议",
|
||||
newTab: "按空格键或点击这里在新标签打开网页",
|
||||
|
@ -1,9 +1,9 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
import { ADMIN_URL } from "../../Enum/EnvironmentVariable";
|
||||
|
||||
const upgradeLink = ADMIN_URL + "/pricing";
|
||||
|
||||
const warning: BaseTranslation = {
|
||||
const warning: NonNullable<Translation["warning"]> = {
|
||||
title: "警告!",
|
||||
content: `该世界已接近容量限制!你可以 <a href="${upgradeLink}" target="_blank">点击这里</a> 升级它的容量`,
|
||||
limit: "该世界已接近容量限制!",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { BaseTranslation } from "../i18n-types";
|
||||
import type { Translation } from "../i18n-types";
|
||||
|
||||
const woka: BaseTranslation = {
|
||||
const woka: NonNullable<Translation["woka"]> = {
|
||||
customWoka: {
|
||||
title: "自定义你的WOKA",
|
||||
navigation: {
|
||||
|
@ -28,6 +28,7 @@ export default defineConfig({
|
||||
"ADMIN_URL",
|
||||
"CONTACT_URL",
|
||||
"PROFILE_URL",
|
||||
"IDENTITY_URL",
|
||||
"ICON_URL",
|
||||
"DEBUG_MODE",
|
||||
"STUN_SERVER",
|
||||
|
@ -6,6 +6,7 @@ import { parse } from "query-string";
|
||||
import { openIDClient } from "../Services/OpenIDClient";
|
||||
import { DISABLE_ANONYMOUS } from "../Enum/EnvironmentVariable";
|
||||
import { RegisterData } from "../Messages/JsonMessages/RegisterData";
|
||||
import { adminService } from "../Services/AdminService";
|
||||
|
||||
export interface TokenInterface {
|
||||
userUuid: string;
|
||||
@ -18,6 +19,7 @@ export class AuthenticateController extends BaseHttpController {
|
||||
this.register();
|
||||
this.anonymLogin();
|
||||
this.profileCallback();
|
||||
this.me();
|
||||
}
|
||||
|
||||
openIDLogin() {
|
||||
@ -166,10 +168,11 @@ export class AuthenticateController extends BaseHttpController {
|
||||
|
||||
//Get user data from Admin Back Office
|
||||
//This is very important to create User Local in LocalStorage in WorkAdventure
|
||||
const resUserData = await this.getUserByUserIdentifier(
|
||||
const resUserData = await adminService.fetchMemberDataByUuid(
|
||||
authTokenData.identifier,
|
||||
playUri as string,
|
||||
IPAddress
|
||||
IPAddress,
|
||||
[]
|
||||
);
|
||||
|
||||
if (authTokenData.accessToken == undefined) {
|
||||
@ -178,7 +181,7 @@ export class AuthenticateController extends BaseHttpController {
|
||||
if (!code && !nonce) {
|
||||
return res.json({ ...resUserData, authToken: token });
|
||||
}
|
||||
console.error("Token cannot to be check on OpenId provider");
|
||||
console.error("Token cannot be checked on OpenId provider");
|
||||
res.status(500);
|
||||
res.send("User cannot to be connected on openid provider");
|
||||
return;
|
||||
@ -221,7 +224,7 @@ export class AuthenticateController extends BaseHttpController {
|
||||
|
||||
//Get user data from Admin Back Office
|
||||
//This is very important to create User Local in LocalStorage in WorkAdventure
|
||||
const data = await this.getUserByUserIdentifier(email, playUri as string, IPAddress);
|
||||
const data = await adminService.fetchMemberDataByUuid(email, playUri as string, IPAddress, []);
|
||||
|
||||
return res.json({ ...data, authToken, username: userInfo?.username, locale: userInfo?.locale });
|
||||
} catch (e) {
|
||||
@ -253,7 +256,7 @@ export class AuthenticateController extends BaseHttpController {
|
||||
try {
|
||||
const authTokenData: AuthTokenData = jwtTokenManager.verifyJWTToken(token as string, false);
|
||||
if (authTokenData.accessToken == undefined) {
|
||||
throw Error("Token cannot to be logout on Hydra");
|
||||
throw Error("Token cannot be logout on Hydra");
|
||||
}
|
||||
await openIDClient.logoutUser(authTokenData.accessToken);
|
||||
} catch (error) {
|
||||
@ -412,7 +415,7 @@ export class AuthenticateController extends BaseHttpController {
|
||||
try {
|
||||
const authTokenData: AuthTokenData = jwtTokenManager.verifyJWTToken(token as string, false);
|
||||
if (authTokenData.accessToken == undefined) {
|
||||
throw Error("Token cannot to be check on Hydra");
|
||||
throw Error("Token cannot be checked on OpenID connect provider");
|
||||
}
|
||||
await openIDClient.checkTokenAuth(authTokenData.accessToken);
|
||||
|
||||
@ -433,6 +436,52 @@ export class AuthenticateController extends BaseHttpController {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* /me:
|
||||
* get:
|
||||
* description: ???
|
||||
* parameters:
|
||||
* - name: "token"
|
||||
* in: "query"
|
||||
* description: "A JWT authentication token ???"
|
||||
* required: true
|
||||
* type: "string"
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Data of user connected
|
||||
*/
|
||||
me() {
|
||||
// @ts-ignore
|
||||
this.app.get("/me", async (req, res): void => {
|
||||
const { token } = parse(req.path_query);
|
||||
try {
|
||||
//verify connected by token
|
||||
if (token != undefined) {
|
||||
try {
|
||||
const authTokenData: AuthTokenData = jwtTokenManager.verifyJWTToken(token as string, false);
|
||||
if (authTokenData.accessToken == undefined) {
|
||||
throw Error("Token cannot to be checked on Hydra");
|
||||
}
|
||||
const me = await openIDClient.checkTokenAuth(authTokenData.accessToken);
|
||||
|
||||
//get login profile
|
||||
res.status(200);
|
||||
res.json({ ...me });
|
||||
return;
|
||||
} catch (error) {
|
||||
this.castErrorToResponse(error, res);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("me => ERROR", error);
|
||||
this.castErrorToResponse(error, res);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param email
|
||||
|
@ -160,12 +160,12 @@ export class MapController extends BaseHttpController {
|
||||
}
|
||||
}
|
||||
}
|
||||
const mapDetails = isMapDetailsData.safeParse(
|
||||
const mapDetails = isMapDetailsData.parse(
|
||||
await adminApi.fetchMapDetails(query.playUri as string, userId)
|
||||
);
|
||||
|
||||
if (mapDetails.success && DISABLE_ANONYMOUS) {
|
||||
mapDetails.data.authenticationMandatory = true;
|
||||
if (DISABLE_ANONYMOUS) {
|
||||
mapDetails.authenticationMandatory = true;
|
||||
}
|
||||
|
||||
res.json(mapDetails);
|
||||
|
@ -6,6 +6,7 @@ import { AdminApiData, isAdminApiData } from "../Messages/JsonMessages/AdminApiD
|
||||
import { z } from "zod";
|
||||
import { isWokaDetail } from "../Messages/JsonMessages/PlayerTextures";
|
||||
import qs from "qs";
|
||||
import { AdminInterface } from "./AdminInterface";
|
||||
|
||||
export interface AdminBannedData {
|
||||
is_banned: boolean;
|
||||
@ -25,10 +26,9 @@ export const isFetchMemberDataByUuidResponse = z.object({
|
||||
|
||||
export type FetchMemberDataByUuidResponse = z.infer<typeof isFetchMemberDataByUuidResponse>;
|
||||
|
||||
class AdminApi {
|
||||
class AdminApi implements AdminInterface {
|
||||
private locale: string = "en";
|
||||
setLocale(locale: string) {
|
||||
//console.info('PUSHER LOCALE SET TO :', locale);
|
||||
this.locale = locale;
|
||||
}
|
||||
/**
|
||||
@ -70,7 +70,7 @@ class AdminApi {
|
||||
}
|
||||
|
||||
async fetchMemberDataByUuid(
|
||||
userIdentifier: string | null,
|
||||
userIdentifier: string,
|
||||
playUri: string,
|
||||
ipAddress: string,
|
||||
characterLayers: string[]
|
||||
|
10
pusher/src/Services/AdminInterface.ts
Normal file
10
pusher/src/Services/AdminInterface.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { FetchMemberDataByUuidResponse } from "./AdminApi";
|
||||
|
||||
export interface AdminInterface {
|
||||
fetchMemberDataByUuid(
|
||||
userIdentifier: string,
|
||||
playUri: string,
|
||||
ipAddress: string,
|
||||
characterLayers: string[]
|
||||
): Promise<FetchMemberDataByUuidResponse>;
|
||||
}
|
5
pusher/src/Services/AdminService.ts
Normal file
5
pusher/src/Services/AdminService.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { ADMIN_API_URL } from "../Enum/EnvironmentVariable";
|
||||
import { adminApi } from "./AdminApi";
|
||||
import { localAdmin } from "./LocalAdmin";
|
||||
|
||||
export const adminService = ADMIN_API_URL ? adminApi : localAdmin;
|
29
pusher/src/Services/LocalAdmin.ts
Normal file
29
pusher/src/Services/LocalAdmin.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { FetchMemberDataByUuidResponse } from "./AdminApi";
|
||||
import { AdminInterface } from "./AdminInterface";
|
||||
|
||||
/**
|
||||
* A local class mocking a real admin if no admin is configured.
|
||||
*/
|
||||
class LocalAdmin implements AdminInterface {
|
||||
fetchMemberDataByUuid(
|
||||
userIdentifier: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
playUri: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
ipAddress: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
characterLayers: string[]
|
||||
): Promise<FetchMemberDataByUuidResponse> {
|
||||
return Promise.resolve({
|
||||
email: userIdentifier,
|
||||
userUuid: userIdentifier,
|
||||
tags: [],
|
||||
messages: [],
|
||||
visitCardUrl: null,
|
||||
textures: [],
|
||||
userRoomToken: undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const localAdmin = new LocalAdmin();
|
@ -122,7 +122,13 @@ export class SocketManager implements ZoneEventListener {
|
||||
}
|
||||
})
|
||||
.on("end", () => {
|
||||
console.warn("Admin connection lost to back server");
|
||||
console.warn(
|
||||
"Admin connection lost to back server '" +
|
||||
apiClient.getChannel().getTarget() +
|
||||
"' for room '" +
|
||||
roomId +
|
||||
"'"
|
||||
);
|
||||
// Let's close the front connection if the back connection is closed. This way, we can retry connecting from the start.
|
||||
if (!client.disconnecting) {
|
||||
this.closeWebsocketConnection(client, 1011, "Admin Connection lost to back server");
|
||||
@ -130,7 +136,14 @@ export class SocketManager implements ZoneEventListener {
|
||||
console.log("A user left");
|
||||
})
|
||||
.on("error", (err: Error) => {
|
||||
console.error("Error in connection to back server:", err);
|
||||
console.error(
|
||||
"Error in connection to back server '" +
|
||||
apiClient.getChannel().getTarget() +
|
||||
"' for room '" +
|
||||
roomId +
|
||||
"':",
|
||||
err
|
||||
);
|
||||
if (!client.disconnecting) {
|
||||
this.closeWebsocketConnection(client, 1011, "Error while connecting to back server");
|
||||
}
|
||||
@ -187,7 +200,7 @@ export class SocketManager implements ZoneEventListener {
|
||||
joinRoomMessage.addCharacterlayer(characterLayerMessage);
|
||||
}
|
||||
|
||||
console.log("Calling joinRoom");
|
||||
console.log("Calling joinRoom '" + client.roomId + "'");
|
||||
const apiClient = await apiClientRepository.getClient(client.roomId);
|
||||
const streamToPusher = apiClient.joinRoom();
|
||||
clientEventsEmitter.emitClientJoin(client.userUuid, client.roomId);
|
||||
@ -215,7 +228,13 @@ export class SocketManager implements ZoneEventListener {
|
||||
}
|
||||
})
|
||||
.on("end", () => {
|
||||
console.warn("Connection lost to back server");
|
||||
console.warn(
|
||||
"Connection lost to back server '" +
|
||||
apiClient.getChannel().getTarget() +
|
||||
"' for room '" +
|
||||
client.roomId +
|
||||
"'"
|
||||
);
|
||||
// Let's close the front connection if the back connection is closed. This way, we can retry connecting from the start.
|
||||
if (!client.disconnecting) {
|
||||
this.closeWebsocketConnection(client, 1011, "Connection lost to back server");
|
||||
@ -223,7 +242,14 @@ export class SocketManager implements ZoneEventListener {
|
||||
console.log("A user left");
|
||||
})
|
||||
.on("error", (err: Error) => {
|
||||
console.error("Error in connection to back server:", err);
|
||||
console.error(
|
||||
"Error in connection to back server '" +
|
||||
apiClient.getChannel().getTarget() +
|
||||
"' for room '" +
|
||||
client.roomId +
|
||||
"':",
|
||||
err
|
||||
);
|
||||
if (!client.disconnecting) {
|
||||
this.closeWebsocketConnection(client, 1011, "Error while connecting to back server");
|
||||
}
|
||||
|
66
tests/package-lock.json
generated
66
tests/package-lock.json
generated
@ -5,7 +5,7 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.20.0",
|
||||
"@playwright/test": "~1.21.0",
|
||||
"@types/dockerode": "^3.3.0",
|
||||
"axios": "^0.24.0",
|
||||
"dockerode": "^3.3.1",
|
||||
@ -854,9 +854,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@playwright/test": {
|
||||
"version": "1.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.20.0.tgz",
|
||||
"integrity": "sha512-UpI5HTcgNLckR0kqXqwNvbcIXtRaDxk+hnO0OBwPSjfbBjRfRgAJ2ClA/b30C5E3UW5dJa17zhsy2qrk66l5cg==",
|
||||
"version": "1.21.0",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.21.0.tgz",
|
||||
"integrity": "sha512-jvgN3ZeAG6rw85z4u9Rc4uyj6qIaYlq2xrOtS7J2+CDYhzKOttab9ix9ELcvBOCHuQ6wgTfxfJYdh6DRZmQ9hg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "7.16.7",
|
||||
@ -882,13 +882,13 @@
|
||||
"debug": "4.3.3",
|
||||
"expect": "27.2.5",
|
||||
"jest-matcher-utils": "27.2.5",
|
||||
"json5": "2.2.0",
|
||||
"json5": "2.2.1",
|
||||
"mime": "3.0.0",
|
||||
"minimatch": "3.0.4",
|
||||
"ms": "2.1.3",
|
||||
"open": "8.4.0",
|
||||
"pirates": "4.0.4",
|
||||
"playwright-core": "1.20.0",
|
||||
"playwright-core": "1.21.0",
|
||||
"rimraf": "3.0.2",
|
||||
"source-map-support": "0.4.18",
|
||||
"stack-utils": "2.0.5",
|
||||
@ -1007,9 +1007,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/yauzl": {
|
||||
"version": "2.9.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz",
|
||||
"integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==",
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz",
|
||||
"integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@ -2071,13 +2071,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/json5": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz",
|
||||
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
|
||||
"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5"
|
||||
},
|
||||
"bin": {
|
||||
"json5": "lib/cli.js"
|
||||
},
|
||||
@ -2279,9 +2276,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/playwright-core": {
|
||||
"version": "1.20.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.20.0.tgz",
|
||||
"integrity": "sha512-d25IRcdooS278Cijlp8J8A5fLQZ+/aY3dKRJvgX5yjXA69N0huIUdnh3xXSgn+LsQ9DCNmB7Ngof3eY630jgdA==",
|
||||
"version": "1.21.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.21.0.tgz",
|
||||
"integrity": "sha512-yDGVs9qaaW6WiefgR7wH1CGt9D6D/X4U3jNpIzH0FjjrrWLCOYQo78Tu3SkW8X+/kWlBpj49iWf3QNSxhYc12Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"colors": "1.4.0",
|
||||
@ -3340,9 +3337,9 @@
|
||||
}
|
||||
},
|
||||
"@playwright/test": {
|
||||
"version": "1.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.20.0.tgz",
|
||||
"integrity": "sha512-UpI5HTcgNLckR0kqXqwNvbcIXtRaDxk+hnO0OBwPSjfbBjRfRgAJ2ClA/b30C5E3UW5dJa17zhsy2qrk66l5cg==",
|
||||
"version": "1.21.0",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.21.0.tgz",
|
||||
"integrity": "sha512-jvgN3ZeAG6rw85z4u9Rc4uyj6qIaYlq2xrOtS7J2+CDYhzKOttab9ix9ELcvBOCHuQ6wgTfxfJYdh6DRZmQ9hg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "7.16.7",
|
||||
@ -3368,13 +3365,13 @@
|
||||
"debug": "4.3.3",
|
||||
"expect": "27.2.5",
|
||||
"jest-matcher-utils": "27.2.5",
|
||||
"json5": "2.2.0",
|
||||
"json5": "2.2.1",
|
||||
"mime": "3.0.0",
|
||||
"minimatch": "3.0.4",
|
||||
"ms": "2.1.3",
|
||||
"open": "8.4.0",
|
||||
"pirates": "4.0.4",
|
||||
"playwright-core": "1.20.0",
|
||||
"playwright-core": "1.21.0",
|
||||
"rimraf": "3.0.2",
|
||||
"source-map-support": "0.4.18",
|
||||
"stack-utils": "2.0.5",
|
||||
@ -3489,9 +3486,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/yauzl": {
|
||||
"version": "2.9.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz",
|
||||
"integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==",
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz",
|
||||
"integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
@ -4269,13 +4266,10 @@
|
||||
"dev": true
|
||||
},
|
||||
"json5": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz",
|
||||
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
|
||||
"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
|
||||
"dev": true
|
||||
},
|
||||
"micromatch": {
|
||||
"version": "4.0.4",
|
||||
@ -4425,9 +4419,9 @@
|
||||
}
|
||||
},
|
||||
"playwright-core": {
|
||||
"version": "1.20.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.20.0.tgz",
|
||||
"integrity": "sha512-d25IRcdooS278Cijlp8J8A5fLQZ+/aY3dKRJvgX5yjXA69N0huIUdnh3xXSgn+LsQ9DCNmB7Ngof3eY630jgdA==",
|
||||
"version": "1.21.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.21.0.tgz",
|
||||
"integrity": "sha512-yDGVs9qaaW6WiefgR7wH1CGt9D6D/X4U3jNpIzH0FjjrrWLCOYQo78Tu3SkW8X+/kWlBpj49iWf3QNSxhYc12Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"colors": "1.4.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.20.0",
|
||||
"@playwright/test": "~1.21.0",
|
||||
"@types/dockerode": "^3.3.0",
|
||||
"axios": "^0.24.0",
|
||||
"dockerode": "^3.3.1",
|
||||
|
@ -40,17 +40,17 @@
|
||||
/* Module Resolution Options */
|
||||
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
//"baseUrl": ".", /* Base directory to resolve non-absolute module names. */
|
||||
"paths": {
|
||||
"_Controller/*": [
|
||||
"src/Controller/*"
|
||||
],
|
||||
"_Model/*": [
|
||||
"src/Model/*"
|
||||
],
|
||||
"_Enum/*": [
|
||||
"src/Enum/*"
|
||||
]
|
||||
}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "paths": {
|
||||
// "_Controller/*": [
|
||||
// "src/Controller/*"
|
||||
// ],
|
||||
// "_Model/*": [
|
||||
// "src/Model/*"
|
||||
// ],
|
||||
// "_Enum/*": [
|
||||
// "src/Enum/*"
|
||||
// ]
|
||||
// }, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
|
Loading…
Reference in New Issue
Block a user