Merge branch 'develop' of github.com:thecodingmachine/workadventure into develop
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Subject } from "rxjs";
|
||||
import type { BanUserMessage, SendUserMessage } from "../Messages/ts-proto-generated/messages";
|
||||
import type { BanUserMessage, SendUserMessage } from "../Messages/ts-proto-generated/protos/messages";
|
||||
|
||||
export enum AdminMessageEventTypes {
|
||||
admin = "message",
|
||||
|
||||
@@ -89,8 +89,7 @@ class ConnectionManager {
|
||||
* @return returns a promise to the Room we are going to load OR a pointer to the URL we must redirect to if authentication is needed.
|
||||
*/
|
||||
public async initGameConnexion(): Promise<Room | URL> {
|
||||
const connexionType = urlManager.getGameConnexionType();
|
||||
this.connexionType = connexionType;
|
||||
this.connexionType = urlManager.getGameConnexionType();
|
||||
this._currentRoom = null;
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
@@ -103,14 +102,15 @@ class ConnectionManager {
|
||||
urlParams.delete("token");
|
||||
}
|
||||
|
||||
if (connexionType === GameConnexionTypes.login) {
|
||||
if (this.connexionType === GameConnexionTypes.login) {
|
||||
this._currentRoom = await Room.createRoom(new URL(localUserStore.getLastRoomUrl()));
|
||||
const redirect = this.loadOpenIDScreen();
|
||||
if (redirect !== null) {
|
||||
return redirect;
|
||||
}
|
||||
urlManager.pushRoomIdToUrl(this._currentRoom);
|
||||
} else if (connexionType === GameConnexionTypes.jwt) {
|
||||
} else if (this.connexionType === GameConnexionTypes.jwt) {
|
||||
/** @deprecated */
|
||||
if (!token) {
|
||||
const code = urlParams.get("code");
|
||||
const state = urlParams.get("state");
|
||||
@@ -136,8 +136,9 @@ class ConnectionManager {
|
||||
return redirect;
|
||||
}
|
||||
urlManager.pushRoomIdToUrl(this._currentRoom);
|
||||
} else if (connexionType === GameConnexionTypes.register) {
|
||||
//@deprecated
|
||||
}
|
||||
//@deprecated
|
||||
else if (this.connexionType === GameConnexionTypes.register) {
|
||||
const organizationMemberToken = urlManager.getOrganizationToken();
|
||||
const data = await Axios.post(`${PUSHER_URL}/register`, { organizationMemberToken }).then(
|
||||
(res) => res.data
|
||||
@@ -166,11 +167,11 @@ class ConnectionManager {
|
||||
)
|
||||
);
|
||||
urlManager.pushRoomIdToUrl(this._currentRoom);
|
||||
} else if (connexionType === GameConnexionTypes.room || connexionType === GameConnexionTypes.empty) {
|
||||
} else if (this.connexionType === GameConnexionTypes.room || this.connexionType === GameConnexionTypes.empty) {
|
||||
this.authToken = localUserStore.getAuthToken();
|
||||
|
||||
let roomPath: string;
|
||||
if (connexionType === GameConnexionTypes.empty) {
|
||||
if (this.connexionType === GameConnexionTypes.empty) {
|
||||
roomPath = localUserStore.getLastRoomUrl();
|
||||
//get last room path from cache api
|
||||
try {
|
||||
|
||||
@@ -43,8 +43,8 @@ export interface PositionInterface {
|
||||
export interface GroupCreatedUpdatedMessageInterface {
|
||||
position: PositionInterface;
|
||||
groupId: number;
|
||||
groupSize: number;
|
||||
locked: boolean;
|
||||
groupSize?: number;
|
||||
locked?: boolean;
|
||||
}
|
||||
|
||||
export interface GroupUsersUpdateMessageInterface {
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
SetPlayerDetailsMessage as SetPlayerDetailsMessageTsProto,
|
||||
PingMessage as PingMessageTsProto,
|
||||
CharacterLayerMessage,
|
||||
} from "../Messages/ts-proto-generated/messages";
|
||||
} from "../Messages/ts-proto-generated/protos/messages";
|
||||
import { Subject } from "rxjs";
|
||||
import { selectCharacterSceneVisibleStore } from "../Stores/SelectCharacterStore";
|
||||
import { gameManager } from "../Phaser/Game/GameManager";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PositionMessage, PositionMessage_Direction } from "../Messages/ts-proto-generated/messages";
|
||||
import { PositionMessage, PositionMessage_Direction } from "../Messages/ts-proto-generated/protos/messages";
|
||||
|
||||
import type { PointInterface } from "../Connexion/ConnexionModels";
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ import { userIsAdminStore } from "../../Stores/GameStore";
|
||||
import { contactPageStore } from "../../Stores/MenuStore";
|
||||
import type { WasCameraUpdatedEvent } from "../../Api/Events/WasCameraUpdatedEvent";
|
||||
import { audioManagerFileStore } from "../../Stores/AudioManagerStore";
|
||||
import { currentPlayerGroupIdStore, currentPlayerGroupLockStateStore } from "../../Stores/CurrentPlayerGroupStore";
|
||||
import { currentPlayerGroupLockStateStore } from "../../Stores/CurrentPlayerGroupStore";
|
||||
|
||||
import EVENT_TYPE = Phaser.Scenes.Events;
|
||||
import Texture = Phaser.Textures.Texture;
|
||||
@@ -727,10 +727,6 @@ export class GameScene extends DirtyScene {
|
||||
}
|
||||
});
|
||||
|
||||
this.currentPlayerGroupIdStoreUnsubscribe = currentPlayerGroupIdStore.subscribe((groupId) => {
|
||||
this.currentPlayerGroupId = groupId;
|
||||
});
|
||||
|
||||
Promise.all([
|
||||
this.connectionAnswerPromiseDeferred.promise as Promise<unknown>,
|
||||
...scriptPromises,
|
||||
@@ -863,8 +859,7 @@ export class GameScene extends DirtyScene {
|
||||
});
|
||||
|
||||
this.connection.groupUsersUpdateMessageStream.subscribe((message) => {
|
||||
// TODO: how else can we deduce our current group?
|
||||
currentPlayerGroupIdStore.set(message.groupId);
|
||||
this.currentPlayerGroupId = message.groupId;
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -1905,7 +1900,6 @@ export class GameScene extends DirtyScene {
|
||||
break;
|
||||
case "DeleteGroupEvent": {
|
||||
this.doDeleteGroup(event.groupId);
|
||||
currentPlayerGroupIdStore.set(undefined);
|
||||
currentPlayerGroupLockStateStore.set(undefined);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -280,6 +280,9 @@ export class UserInputManager {
|
||||
);
|
||||
|
||||
this.scene.input.keyboard.on("keyup-SPACE", (event: Event) => {
|
||||
if (this.isInputDisabled) {
|
||||
return;
|
||||
}
|
||||
this.userInputHandler.handleSpaceKeyUpEvent(event);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
export const currentPlayerGroupIdStore = writable<number | undefined>(undefined);
|
||||
export const currentPlayerGroupLockStateStore = writable<boolean | undefined>(undefined);
|
||||
|
||||
@@ -3,10 +3,10 @@ import { localUserStore } from "../Connexion/LocalUserStore";
|
||||
|
||||
export enum GameConnexionTypes {
|
||||
room = 1,
|
||||
register,
|
||||
register /*@deprecated*/,
|
||||
empty,
|
||||
unknown,
|
||||
jwt,
|
||||
jwt /*@deprecated*/,
|
||||
login,
|
||||
}
|
||||
|
||||
@@ -16,11 +16,15 @@ class UrlManager {
|
||||
const url = window.location.pathname.toString();
|
||||
if (url === "/login") {
|
||||
return GameConnexionTypes.login;
|
||||
} else if (url === "/jwt") {
|
||||
}
|
||||
//@deprecated jwt url will be replace by "?token=<private access token>"
|
||||
else if (url === "/jwt") {
|
||||
return GameConnexionTypes.jwt;
|
||||
} else if (url.includes("_/") || url.includes("*/") || url.includes("@/")) {
|
||||
return GameConnexionTypes.room;
|
||||
} else if (url.includes("register/")) {
|
||||
}
|
||||
//@deprecated register url will be replace by "?token=<private access token>"
|
||||
else if (url.includes("register/")) {
|
||||
return GameConnexionTypes.register;
|
||||
} else if (url === "/") {
|
||||
return GameConnexionTypes.empty;
|
||||
@@ -29,6 +33,9 @@ class UrlManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public getOrganizationToken(): string | null {
|
||||
const match = /\/register\/(.+)/.exec(window.location.pathname.toString());
|
||||
return match ? match[1] : null;
|
||||
|
||||
Reference in New Issue
Block a user