2020-09-25 18:29:22 +02:00
|
|
|
import Axios from "axios";
|
2021-07-16 11:22:36 +02:00
|
|
|
import { PUSHER_URL, START_ROOM_URL } from "../Enum/EnvironmentVariable";
|
|
|
|
import { RoomConnection } from "./RoomConnection";
|
|
|
|
import type { OnConnectInterface, PositionInterface, ViewportInterface } from "./ConnexionModels";
|
|
|
|
import { GameConnexionTypes, urlManager } from "../Url/UrlManager";
|
|
|
|
import { localUserStore } from "./LocalUserStore";
|
|
|
|
import { CharacterTexture, LocalUser } from "./LocalUser";
|
|
|
|
import { Room } from "./Room";
|
2021-07-29 16:42:31 +02:00
|
|
|
import { _ServiceWorker } from "../Network/ServiceWorker";
|
2021-09-06 18:36:31 +02:00
|
|
|
import { loginSceneVisibleIframeStore } from "../Stores/LoginSceneStore";
|
|
|
|
import { userIsConnected } from "../Stores/MenuStore";
|
2021-09-17 09:46:04 +02:00
|
|
|
import { analyticsClient } from "../Administration/AnalyticsClient";
|
|
|
|
import { gameManager } from "../Phaser/Game/GameManager";
|
2020-09-28 15:02:37 +02:00
|
|
|
|
2020-09-25 18:29:22 +02:00
|
|
|
class ConnectionManager {
|
2021-07-16 11:22:36 +02:00
|
|
|
private localUser!: LocalUser;
|
2020-09-29 17:12:28 +02:00
|
|
|
|
2021-07-16 11:22:36 +02:00
|
|
|
private connexionType?: GameConnexionTypes;
|
|
|
|
private reconnectingTimeout: NodeJS.Timeout | null = null;
|
|
|
|
private _unloading: boolean = false;
|
2021-07-27 16:37:01 +02:00
|
|
|
private authToken: string | null = null;
|
2021-09-06 18:36:31 +02:00
|
|
|
private _currentRoom: Room | null = null;
|
2021-03-30 16:08:49 +02:00
|
|
|
|
2021-07-29 16:42:31 +02:00
|
|
|
private serviceWorker?: _ServiceWorker;
|
2021-03-30 16:08:49 +02:00
|
|
|
|
2021-07-16 11:22:36 +02:00
|
|
|
get unloading() {
|
2021-03-26 14:12:22 +01:00
|
|
|
return this._unloading;
|
|
|
|
}
|
2021-03-30 16:08:49 +02:00
|
|
|
|
2021-03-26 14:12:22 +01:00
|
|
|
constructor() {
|
2021-07-16 11:22:36 +02:00
|
|
|
window.addEventListener("beforeunload", () => {
|
2021-03-26 14:12:22 +01:00
|
|
|
this._unloading = true;
|
2021-07-16 11:22:36 +02:00
|
|
|
if (this.reconnectingTimeout) clearTimeout(this.reconnectingTimeout);
|
|
|
|
});
|
2021-03-26 14:12:22 +01:00
|
|
|
}
|
2021-07-27 16:37:01 +02:00
|
|
|
|
2021-08-15 22:51:06 +02:00
|
|
|
/**
|
2021-09-06 18:36:31 +02:00
|
|
|
* TODO fix me to be move in game manager
|
2021-08-15 22:51:06 +02:00
|
|
|
*/
|
2021-09-06 18:36:31 +02:00
|
|
|
public loadOpenIDScreen() {
|
2021-07-27 16:37:01 +02:00
|
|
|
const state = localUserStore.generateState();
|
|
|
|
const nonce = localUserStore.generateNonce();
|
2021-08-15 22:51:06 +02:00
|
|
|
localUserStore.setAuthToken(null);
|
|
|
|
|
2021-09-06 18:36:31 +02:00
|
|
|
//TODO fix me to redirect this URL by pusher
|
2021-09-17 09:46:04 +02:00
|
|
|
if (!this._currentRoom) {
|
|
|
|
console.error("cannot get currentRoom!");
|
2021-09-06 18:36:31 +02:00
|
|
|
loginSceneVisibleIframeStore.set(false);
|
|
|
|
return null;
|
|
|
|
}
|
2021-09-17 09:46:04 +02:00
|
|
|
|
|
|
|
const redirectUrl = `${PUSHER_URL}/login-screen?state=${state}&nonce=${nonce}&playUri=${this._currentRoom.key}`;
|
2021-09-06 18:36:31 +02:00
|
|
|
window.location.assign(redirectUrl);
|
|
|
|
return redirectUrl;
|
2021-07-27 16:37:01 +02:00
|
|
|
}
|
|
|
|
|
2021-09-06 18:36:31 +02:00
|
|
|
/**
|
|
|
|
* Logout
|
|
|
|
*/
|
|
|
|
public async logout() {
|
|
|
|
//user logout, set connected store for menu at false
|
|
|
|
userIsConnected.set(false);
|
|
|
|
|
|
|
|
//Logout user in pusher and hydra
|
|
|
|
const token = localUserStore.getAuthToken();
|
|
|
|
const { authToken } = await Axios.get(`${PUSHER_URL}/logout-callback`, { params: { token } }).then(
|
|
|
|
(res) => res.data
|
|
|
|
);
|
2021-07-27 16:37:01 +02:00
|
|
|
localUserStore.setAuthToken(null);
|
2021-09-06 18:36:31 +02:00
|
|
|
|
|
|
|
//Go on login page can permit to clear token and start authentication process
|
|
|
|
window.location.assign("/login");
|
2021-07-27 16:37:01 +02:00
|
|
|
}
|
|
|
|
|
2020-10-12 16:23:07 +02:00
|
|
|
/**
|
|
|
|
* Tries to login to the node server and return the starting map url to be loaded
|
|
|
|
*/
|
|
|
|
public async initGameConnexion(): Promise<Room> {
|
|
|
|
const connexionType = urlManager.getGameConnexionType();
|
2020-11-22 12:40:03 +01:00
|
|
|
this.connexionType = connexionType;
|
2021-09-06 18:36:31 +02:00
|
|
|
this._currentRoom = null;
|
|
|
|
if (connexionType === GameConnexionTypes.login) {
|
|
|
|
this._currentRoom = await Room.createRoom(new URL(localUserStore.getLastRoomUrl()));
|
2021-09-16 17:57:14 +02:00
|
|
|
if (this.loadOpenIDScreen() !== null) {
|
|
|
|
return Promise.reject(new Error("You will be redirect on login page"));
|
|
|
|
}
|
|
|
|
urlManager.pushRoomIdToUrl(this._currentRoom);
|
2021-09-06 18:36:31 +02:00
|
|
|
} else if (connexionType === GameConnexionTypes.jwt) {
|
2021-07-27 16:37:01 +02:00
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
const code = urlParams.get("code");
|
|
|
|
const state = urlParams.get("state");
|
|
|
|
if (!state || !localUserStore.verifyState(state)) {
|
|
|
|
throw "Could not validate state!";
|
|
|
|
}
|
|
|
|
if (!code) {
|
|
|
|
throw "No Auth code provided";
|
|
|
|
}
|
2021-09-06 18:36:31 +02:00
|
|
|
localUserStore.setCode(code);
|
2021-09-08 13:39:46 +02:00
|
|
|
this._currentRoom = await Room.createRoom(new URL(localUserStore.getLastRoomUrl()));
|
2021-09-06 18:36:31 +02:00
|
|
|
try {
|
|
|
|
await this.checkAuthUserConnexion();
|
2021-09-15 11:50:25 +02:00
|
|
|
analyticsClient.loggedWithSso();
|
2021-09-06 18:36:31 +02:00
|
|
|
} catch (err) {
|
|
|
|
console.error(err);
|
|
|
|
this.loadOpenIDScreen();
|
2021-09-08 13:39:46 +02:00
|
|
|
return Promise.reject(new Error("You will be redirect on login page"));
|
2021-08-10 10:25:24 +02:00
|
|
|
}
|
2021-09-06 18:36:31 +02:00
|
|
|
urlManager.pushRoomIdToUrl(this._currentRoom);
|
2021-07-27 16:37:01 +02:00
|
|
|
} else if (connexionType === GameConnexionTypes.register) {
|
|
|
|
//@deprecated
|
2021-07-16 11:22:36 +02:00
|
|
|
const organizationMemberToken = urlManager.getOrganizationToken();
|
|
|
|
const data = await Axios.post(`${PUSHER_URL}/register`, { organizationMemberToken }).then(
|
|
|
|
(res) => res.data
|
|
|
|
);
|
2021-09-30 16:14:55 +02:00
|
|
|
this.localUser = new LocalUser(data.userUuid, data.textures, data.email);
|
2021-07-27 16:37:01 +02:00
|
|
|
this.authToken = data.authToken;
|
2020-10-12 16:23:07 +02:00
|
|
|
localUserStore.saveUser(this.localUser);
|
2021-07-27 16:37:01 +02:00
|
|
|
localUserStore.setAuthToken(this.authToken);
|
2021-09-15 11:50:25 +02:00
|
|
|
analyticsClient.loggedWithToken();
|
2020-10-13 16:46:46 +02:00
|
|
|
|
2021-07-13 19:09:07 +02:00
|
|
|
const roomUrl = data.roomUrl;
|
2020-10-13 16:46:46 +02:00
|
|
|
|
2021-09-06 18:36:31 +02:00
|
|
|
this._currentRoom = await Room.createRoom(
|
2021-07-16 11:22:36 +02:00
|
|
|
new URL(
|
|
|
|
window.location.protocol +
|
2021-08-16 19:21:09 +02:00
|
|
|
"//" +
|
|
|
|
window.location.host +
|
|
|
|
roomUrl +
|
|
|
|
window.location.search +
|
|
|
|
window.location.hash
|
2021-07-16 11:22:36 +02:00
|
|
|
)
|
|
|
|
);
|
2021-09-06 18:36:31 +02:00
|
|
|
urlManager.pushRoomIdToUrl(this._currentRoom);
|
2021-07-16 11:22:36 +02:00
|
|
|
} else if (
|
|
|
|
connexionType === GameConnexionTypes.organization ||
|
|
|
|
connexionType === GameConnexionTypes.anonymous ||
|
|
|
|
connexionType === GameConnexionTypes.empty
|
|
|
|
) {
|
2021-07-27 16:37:01 +02:00
|
|
|
this.authToken = localUserStore.getAuthToken();
|
2021-06-03 13:07:52 +02:00
|
|
|
|
2021-07-13 19:09:07 +02:00
|
|
|
let roomPath: string;
|
2020-10-13 17:20:20 +02:00
|
|
|
if (connexionType === GameConnexionTypes.empty) {
|
2021-09-06 18:36:31 +02:00
|
|
|
roomPath = localUserStore.getLastRoomUrl();
|
2021-08-04 13:33:58 +02:00
|
|
|
//get last room path from cache api
|
|
|
|
try {
|
|
|
|
const lastRoomUrl = await localUserStore.getLastRoomUrlCacheApi();
|
|
|
|
if (lastRoomUrl != undefined) {
|
|
|
|
roomPath = lastRoomUrl;
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
console.error(err);
|
|
|
|
}
|
2020-10-13 17:20:20 +02:00
|
|
|
} else {
|
2021-07-16 11:22:36 +02:00
|
|
|
roomPath =
|
|
|
|
window.location.protocol +
|
|
|
|
"//" +
|
|
|
|
window.location.host +
|
|
|
|
window.location.pathname +
|
|
|
|
window.location.search +
|
|
|
|
window.location.hash;
|
2020-10-13 17:20:20 +02:00
|
|
|
}
|
2021-06-03 13:07:52 +02:00
|
|
|
|
|
|
|
//get detail map for anonymous login and set texture in local storage
|
2021-10-05 18:59:26 +02:00
|
|
|
//before set token of user we must load room and all information. For example the mandatory authentication could be require on current room
|
Release v1.4.15 (#1411)
* audio player volume improvements
* Add workaround for #932
* Bump striptags from 3.1.1 to 3.2.0 in /messages
Bumps [striptags](https://github.com/ericnorris/striptags) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/ericnorris/striptags/releases)
- [Commits](https://github.com/ericnorris/striptags/compare/v3.1.1...v3.2.0)
---
updated-dependencies:
- dependency-name: striptags
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Add anthoer note for https://github.com/thecodingmachine/workadventure/issues/932#issuecomment-867562208
* WIP: svelte menu
* temp
* temp
* Bump tar from 4.4.13 to 4.4.15 in /back
Bumps [tar](https://github.com/npm/node-tar) from 4.4.13 to 4.4.15.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v4.4.13...v4.4.15)
---
updated-dependencies:
- dependency-name: tar
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* New menu svelte
* Migration of report menu in svelte
* Migration of registerCustomMenu for Menu in Svelte
Refactor subMenuStore
Suppression of old MenuScene and ReportMenu
* Suppression of HTML files that aren't use anymore
* New version of cache management (#1365)
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* migrate to svelte
* remove redundancy
* initial localUserStore volume
* Exit scene acess denied detected (#1369)
* Add auth token user to get right in admin and check if user have right
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update error show
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update token generation (#1372)
- Permit only decode token to get map details,
- If user have token expired, set the token to null and reload the page. This feature will be updated when authentication stategy will be finished.
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* GameManager has an attribute scenePlugin
* GameManager has an attribute scenePlugin
* Suppression of gameManager in IframeListener
* fix deeployer
* fix deeployer
* Fixing enter/leave event not properly sent on adjacent zones
On adjacent zones, the zone leave event was not properly triggered when leaving a zone for the zone next to it.
Closes #1366
* First pass on css
* First pass on css
* Second pass on css and reportMenu
* Second pass on css and reportMenu
* Second pass on css and reportMenu
* Improving popup
If a popup message is empty, only the buttons will be displayed (not the container)
Unrelated: the Sound.play method in the API now accepts 0 arguments.
* Third pass on css and reportMenu
* Correction following test
* Player return a the same position when after editing his profile
* Player return a the same position when after editing his profile (same as reconnection)
* Contact page only if environment variable exist
* Execute scripts of the map after creating gameScene
* Rollback on createPromise switched to public
* Bump tar from 6.1.0 to 6.1.10 in /pusher
Bumps [tar](https://github.com/npm/node-tar) from 6.1.0 to 6.1.10.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v6.1.0...v6.1.10)
---
updated-dependencies:
- dependency-name: tar
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Add iframe submenu by scripting API
Delete menu by scripting API
* Removing ts-ignore
* REVIEW : Migration Menu and Report Menu in Svelte (#1363)
* WIP: svelte menu
* temp
* temp
* New menu svelte
* Migration of report menu in svelte
* Migration of registerCustomMenu for Menu in Svelte
Refactor subMenuStore
Suppression of old MenuScene and ReportMenu
* Suppression of HTML files that aren't use anymore
* fix deeployer
* First pass on css
* First pass on css
* Second pass on css and reportMenu
* Second pass on css and reportMenu
* Second pass on css and reportMenu
* Third pass on css and reportMenu
* Correction following test
* Contact page only if environment variable exist
* Update service worker
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Change requested
* Change requested
Co-authored-by: kharhamel <oognic@gmail.com>
Co-authored-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Refactor to only have one function registerMenuCommand
When selected custom menu is removed, go to settings menu
Allow iframe in custom menu to use Scripting API
Return menu object when it is registered, can call remove function on it
* Correct bad change
* Add types file in API
* Add types file in API
* Fixing "has/in" on variables proxy object
When using WA.state, using `"myVariable" in WA.state` would always return false.
This is now fixed by adding a "has" method on the Proxy class.
Also, added a `WA.state.hasVariable` method.
* Add documentation
delete unused test map
* Properties changed via the Iframe API now trigger changes directly
Changes performed in WA.room.setPropertyLayer now have a real-time impact.
If the property is changed on a layer the current player is on, the changes will be triggered.
* documentation and CHANGELOG
* add possibility to set size of coWebsite and Jitsis via map property
* Update GameScene.ts
typo fixed
* Update CoWebsiteManager.ts
typos and style
* Update CoWebsiteManager.ts
yet another typo
* FIX: media tracks were not readded to a 3rd person in some situations
* fix ReportMenu (#1397)
* remove the package systeminformation from back
* Bump url-parse from 1.5.1 to 1.5.3 in /front
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.1 to 1.5.3.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.1...1.5.3)
---
updated-dependencies:
- dependency-name: url-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump tar from 4.4.15 to 4.4.19 in /back
Bumps [tar](https://github.com/npm/node-tar) from 4.4.15 to 4.4.19.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v4.4.15...v4.4.19)
---
updated-dependencies:
- dependency-name: tar
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump path-parse from 1.0.6 to 1.0.7 in /messages
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* openTabPropertyKey (create new props in own file)
* Bump path-parse from 1.0.6 to 1.0.7 in /uploader
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump path-parse from 1.0.6 to 1.0.7 in /front
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump path-parse from 1.0.6 to 1.0.7 in /back
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump path-parse from 1.0.6 to 1.0.7 in /maps
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* FEATURE: improved the mediaStore code to disable tracks instead of deleting them
* Bump path-parse from 1.0.6 to 1.0.7 in /benchmark
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* added jitsiTypes
* renamed
* Allowing variables nested in group layers
Up until this commit, variables nested in object layers inside group layers where not found by the front nor the back.
This PR changes analysis so that variables can be detected.
* FIX: fixed a circular dependancy in stores by rewriting createPeerStore() and createScreenSharingPeerStore()
* WIP: Bypass camera scene (#1337)
* Set new local camera setup variable
* Finish by pass video settings
- TODO add button to update camera settings
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Merge branch 'develop' into jumpVideoCamera
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
# Conflicts:
# front/src/Connexion/LocalUserStore.ts
# front/src/Phaser/Components/Loader.ts
# front/src/Phaser/Game/GameManager.ts
# front/src/Phaser/Login/EnableCameraScene.ts
* Add menu to open enable camera scene
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Finish jump camera setup
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Active authentication Oauth (#1377)
* Active authentication Oauth
- Google authentication
- GitHub authentication
- Linkedin authentication
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Finish connexion et get user info connexion
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Fix lint error
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Change the expires token for 30 days
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update connexion stratgey
- Set last room when it will be created and not when connexion is openned
- Add '/login' end point permit to logout and open iframe to log user
- Add logout feature permit to logout in front
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Implement logout and revoke token with hydra
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Fix pull develop conflict
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Profile url (#1399)
* Create function that permit to get profile URL
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Continue profil user
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Add menu and logout button
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update last room use
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Profile callback permit to get url profile setting from admin
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Finish profile show
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Delete profileUrl will be not use today
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Correct lint
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update size of iframe
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Delete console log
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update feedback ARP
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Emote silent zone (#1342)
* Add an emote when the user is in silent zone
* Update silent icon strategy
* Update strategy for silent zone
- Add svelte store
- Show silent zone indication and replace camera
This update permit to hide silent zone when user is in Jitsi discussion
* Fix css silent zone
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Hotfix media constraint error
- Create error to manage displayed warning when we try to access on media with no constraint video and audio
- Fix disabled microphone if we try to active and we don't have right or there is an error.
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
Co-authored-by: Lurkars <git@8lh.de>
Co-authored-by: Guy Sheffer <guysoft@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: kharhamel <oognic@gmail.com>
Co-authored-by: GRL <g.lesniewski@thecodingmachine.com>
Co-authored-by: David Négrier <d.negrier@thecodingmachine.com>
Co-authored-by: GRL78 <80678534+GRL78@users.noreply.github.com>
Co-authored-by: ¯\_(ツ)_/¯ <tabascoeye@gmail.com>
Co-authored-by: Kharhamel <Kharhamel@users.noreply.github.com>
Co-authored-by: jonny <ga86lad@mytum.de>
2021-09-05 19:51:33 +02:00
|
|
|
this._currentRoom = await Room.createRoom(new URL(roomPath));
|
2021-10-05 18:59:26 +02:00
|
|
|
|
|
|
|
//todo: add here some kind of warning if authToken has expired.
|
|
|
|
if (!this.authToken && !this._currentRoom.authenticationMandatory) {
|
|
|
|
await this.anonymousLogin();
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
await this.checkAuthUserConnexion();
|
|
|
|
} catch (err) {
|
|
|
|
console.error(err);
|
|
|
|
}
|
2021-09-20 08:56:14 +02:00
|
|
|
}
|
2021-10-05 18:59:26 +02:00
|
|
|
this.localUser = localUserStore.getLocalUser() as LocalUser; //if authToken exist in localStorage then localUser cannot be null
|
|
|
|
|
Release v1.4.15 (#1411)
* audio player volume improvements
* Add workaround for #932
* Bump striptags from 3.1.1 to 3.2.0 in /messages
Bumps [striptags](https://github.com/ericnorris/striptags) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/ericnorris/striptags/releases)
- [Commits](https://github.com/ericnorris/striptags/compare/v3.1.1...v3.2.0)
---
updated-dependencies:
- dependency-name: striptags
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Add anthoer note for https://github.com/thecodingmachine/workadventure/issues/932#issuecomment-867562208
* WIP: svelte menu
* temp
* temp
* Bump tar from 4.4.13 to 4.4.15 in /back
Bumps [tar](https://github.com/npm/node-tar) from 4.4.13 to 4.4.15.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v4.4.13...v4.4.15)
---
updated-dependencies:
- dependency-name: tar
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* New menu svelte
* Migration of report menu in svelte
* Migration of registerCustomMenu for Menu in Svelte
Refactor subMenuStore
Suppression of old MenuScene and ReportMenu
* Suppression of HTML files that aren't use anymore
* New version of cache management (#1365)
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* migrate to svelte
* remove redundancy
* initial localUserStore volume
* Exit scene acess denied detected (#1369)
* Add auth token user to get right in admin and check if user have right
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update error show
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update token generation (#1372)
- Permit only decode token to get map details,
- If user have token expired, set the token to null and reload the page. This feature will be updated when authentication stategy will be finished.
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* GameManager has an attribute scenePlugin
* GameManager has an attribute scenePlugin
* Suppression of gameManager in IframeListener
* fix deeployer
* fix deeployer
* Fixing enter/leave event not properly sent on adjacent zones
On adjacent zones, the zone leave event was not properly triggered when leaving a zone for the zone next to it.
Closes #1366
* First pass on css
* First pass on css
* Second pass on css and reportMenu
* Second pass on css and reportMenu
* Second pass on css and reportMenu
* Improving popup
If a popup message is empty, only the buttons will be displayed (not the container)
Unrelated: the Sound.play method in the API now accepts 0 arguments.
* Third pass on css and reportMenu
* Correction following test
* Player return a the same position when after editing his profile
* Player return a the same position when after editing his profile (same as reconnection)
* Contact page only if environment variable exist
* Execute scripts of the map after creating gameScene
* Rollback on createPromise switched to public
* Bump tar from 6.1.0 to 6.1.10 in /pusher
Bumps [tar](https://github.com/npm/node-tar) from 6.1.0 to 6.1.10.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v6.1.0...v6.1.10)
---
updated-dependencies:
- dependency-name: tar
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Add iframe submenu by scripting API
Delete menu by scripting API
* Removing ts-ignore
* REVIEW : Migration Menu and Report Menu in Svelte (#1363)
* WIP: svelte menu
* temp
* temp
* New menu svelte
* Migration of report menu in svelte
* Migration of registerCustomMenu for Menu in Svelte
Refactor subMenuStore
Suppression of old MenuScene and ReportMenu
* Suppression of HTML files that aren't use anymore
* fix deeployer
* First pass on css
* First pass on css
* Second pass on css and reportMenu
* Second pass on css and reportMenu
* Second pass on css and reportMenu
* Third pass on css and reportMenu
* Correction following test
* Contact page only if environment variable exist
* Update service worker
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Change requested
* Change requested
Co-authored-by: kharhamel <oognic@gmail.com>
Co-authored-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Refactor to only have one function registerMenuCommand
When selected custom menu is removed, go to settings menu
Allow iframe in custom menu to use Scripting API
Return menu object when it is registered, can call remove function on it
* Correct bad change
* Add types file in API
* Add types file in API
* Fixing "has/in" on variables proxy object
When using WA.state, using `"myVariable" in WA.state` would always return false.
This is now fixed by adding a "has" method on the Proxy class.
Also, added a `WA.state.hasVariable` method.
* Add documentation
delete unused test map
* Properties changed via the Iframe API now trigger changes directly
Changes performed in WA.room.setPropertyLayer now have a real-time impact.
If the property is changed on a layer the current player is on, the changes will be triggered.
* documentation and CHANGELOG
* add possibility to set size of coWebsite and Jitsis via map property
* Update GameScene.ts
typo fixed
* Update CoWebsiteManager.ts
typos and style
* Update CoWebsiteManager.ts
yet another typo
* FIX: media tracks were not readded to a 3rd person in some situations
* fix ReportMenu (#1397)
* remove the package systeminformation from back
* Bump url-parse from 1.5.1 to 1.5.3 in /front
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.1 to 1.5.3.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.1...1.5.3)
---
updated-dependencies:
- dependency-name: url-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump tar from 4.4.15 to 4.4.19 in /back
Bumps [tar](https://github.com/npm/node-tar) from 4.4.15 to 4.4.19.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v4.4.15...v4.4.19)
---
updated-dependencies:
- dependency-name: tar
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump path-parse from 1.0.6 to 1.0.7 in /messages
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* openTabPropertyKey (create new props in own file)
* Bump path-parse from 1.0.6 to 1.0.7 in /uploader
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump path-parse from 1.0.6 to 1.0.7 in /front
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump path-parse from 1.0.6 to 1.0.7 in /back
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump path-parse from 1.0.6 to 1.0.7 in /maps
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* FEATURE: improved the mediaStore code to disable tracks instead of deleting them
* Bump path-parse from 1.0.6 to 1.0.7 in /benchmark
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)
---
updated-dependencies:
- dependency-name: path-parse
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* added jitsiTypes
* renamed
* Allowing variables nested in group layers
Up until this commit, variables nested in object layers inside group layers where not found by the front nor the back.
This PR changes analysis so that variables can be detected.
* FIX: fixed a circular dependancy in stores by rewriting createPeerStore() and createScreenSharingPeerStore()
* WIP: Bypass camera scene (#1337)
* Set new local camera setup variable
* Finish by pass video settings
- TODO add button to update camera settings
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Merge branch 'develop' into jumpVideoCamera
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
# Conflicts:
# front/src/Connexion/LocalUserStore.ts
# front/src/Phaser/Components/Loader.ts
# front/src/Phaser/Game/GameManager.ts
# front/src/Phaser/Login/EnableCameraScene.ts
* Add menu to open enable camera scene
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Finish jump camera setup
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Active authentication Oauth (#1377)
* Active authentication Oauth
- Google authentication
- GitHub authentication
- Linkedin authentication
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Finish connexion et get user info connexion
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Fix lint error
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Change the expires token for 30 days
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update connexion stratgey
- Set last room when it will be created and not when connexion is openned
- Add '/login' end point permit to logout and open iframe to log user
- Add logout feature permit to logout in front
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Implement logout and revoke token with hydra
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Fix pull develop conflict
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Profile url (#1399)
* Create function that permit to get profile URL
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Continue profil user
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Add menu and logout button
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update last room use
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Profile callback permit to get url profile setting from admin
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Finish profile show
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Delete profileUrl will be not use today
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Correct lint
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update size of iframe
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Delete console log
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Update feedback ARP
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Emote silent zone (#1342)
* Add an emote when the user is in silent zone
* Update silent icon strategy
* Update strategy for silent zone
- Add svelte store
- Show silent zone indication and replace camera
This update permit to hide silent zone when user is in Jitsi discussion
* Fix css silent zone
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
* Hotfix media constraint error
- Create error to manage displayed warning when we try to access on media with no constraint video and audio
- Fix disabled microphone if we try to active and we don't have right or there is an error.
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
Co-authored-by: Lurkars <git@8lh.de>
Co-authored-by: Guy Sheffer <guysoft@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: kharhamel <oognic@gmail.com>
Co-authored-by: GRL <g.lesniewski@thecodingmachine.com>
Co-authored-by: David Négrier <d.negrier@thecodingmachine.com>
Co-authored-by: GRL78 <80678534+GRL78@users.noreply.github.com>
Co-authored-by: ¯\_(ツ)_/¯ <tabascoeye@gmail.com>
Co-authored-by: Kharhamel <Kharhamel@users.noreply.github.com>
Co-authored-by: jonny <ga86lad@mytum.de>
2021-09-05 19:51:33 +02:00
|
|
|
if (this._currentRoom.textures != undefined && this._currentRoom.textures.length > 0) {
|
2021-06-03 13:07:52 +02:00
|
|
|
//check if texture was changed
|
2021-07-27 16:37:01 +02:00
|
|
|
if (this.localUser.textures.length === 0) {
|
2021-09-06 18:36:31 +02:00
|
|
|
this.localUser.textures = this._currentRoom.textures;
|
2021-07-16 11:22:36 +02:00
|
|
|
} else {
|
2021-09-06 18:36:31 +02:00
|
|
|
this._currentRoom.textures.forEach((newTexture) => {
|
2021-07-27 16:37:01 +02:00
|
|
|
const alreadyExistTexture = this.localUser.textures.find((c) => newTexture.id === c.id);
|
|
|
|
if (this.localUser.textures.findIndex((c) => newTexture.id === c.id) !== -1) {
|
2021-06-03 13:07:52 +02:00
|
|
|
return;
|
|
|
|
}
|
2021-07-27 16:37:01 +02:00
|
|
|
this.localUser.textures.push(newTexture);
|
2021-06-03 13:07:52 +02:00
|
|
|
});
|
|
|
|
}
|
2021-07-27 16:37:01 +02:00
|
|
|
localUserStore.saveUser(this.localUser);
|
2021-06-03 13:07:52 +02:00
|
|
|
}
|
2021-07-29 16:42:31 +02:00
|
|
|
}
|
2021-09-06 18:36:31 +02:00
|
|
|
if (this._currentRoom == undefined) {
|
2021-07-29 16:42:31 +02:00
|
|
|
return Promise.reject(new Error("Invalid URL"));
|
2021-08-02 22:06:24 +02:00
|
|
|
}
|
2021-09-15 11:50:25 +02:00
|
|
|
if (this.localUser) {
|
2021-09-30 16:14:55 +02:00
|
|
|
analyticsClient.identifyUser(this.localUser.uuid, this.localUser.email);
|
2021-09-15 11:50:25 +02:00
|
|
|
}
|
2020-10-13 17:20:20 +02:00
|
|
|
|
2021-07-29 16:42:31 +02:00
|
|
|
this.serviceWorker = new _ServiceWorker();
|
2021-09-06 18:36:31 +02:00
|
|
|
return Promise.resolve(this._currentRoom);
|
2020-10-15 16:48:42 +02:00
|
|
|
}
|
|
|
|
|
2020-10-21 14:55:18 +02:00
|
|
|
public async anonymousLogin(isBenchmark: boolean = false): Promise<void> {
|
2021-09-20 08:56:14 +02:00
|
|
|
localUserStore.setAuthToken(null);
|
2021-09-17 09:46:04 +02:00
|
|
|
try {
|
|
|
|
const data = await Axios.post(`${PUSHER_URL}/anonymLogin`).then((res) => res.data);
|
|
|
|
this.localUser = new LocalUser(data.userUuid, []);
|
|
|
|
this.authToken = data.authToken;
|
|
|
|
if (!isBenchmark) {
|
|
|
|
// In benchmark, we don't have a local storage.
|
|
|
|
localUserStore.saveUser(this.localUser);
|
|
|
|
localUserStore.setAuthToken(this.authToken);
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
this.loadOpenIDScreen();
|
2020-10-21 14:55:18 +02:00
|
|
|
}
|
2020-10-15 16:48:42 +02:00
|
|
|
}
|
|
|
|
|
2020-09-30 12:12:24 +02:00
|
|
|
public initBenchmark(): void {
|
2021-07-27 16:37:01 +02:00
|
|
|
this.localUser = new LocalUser("", []);
|
2020-09-30 12:12:24 +02:00
|
|
|
}
|
|
|
|
|
2021-07-16 11:22:36 +02:00
|
|
|
public connectToRoomSocket(
|
|
|
|
roomUrl: string,
|
|
|
|
name: string,
|
|
|
|
characterLayers: string[],
|
|
|
|
position: PositionInterface,
|
|
|
|
viewport: ViewportInterface,
|
|
|
|
companion: string | null
|
|
|
|
): Promise<OnConnectInterface> {
|
2020-12-03 16:39:44 +01:00
|
|
|
return new Promise<OnConnectInterface>((resolve, reject) => {
|
2021-07-16 11:22:36 +02:00
|
|
|
const connection = new RoomConnection(
|
2021-07-27 16:37:01 +02:00
|
|
|
this.authToken,
|
2021-07-16 11:22:36 +02:00
|
|
|
roomUrl,
|
|
|
|
name,
|
|
|
|
characterLayers,
|
|
|
|
position,
|
|
|
|
viewport,
|
|
|
|
companion
|
|
|
|
);
|
2021-07-29 16:42:31 +02:00
|
|
|
|
2020-09-28 15:02:37 +02:00
|
|
|
connection.onConnectError((error: object) => {
|
2021-07-16 11:22:36 +02:00
|
|
|
console.log("An error occurred while connecting to socket server. Retrying");
|
2020-09-28 15:02:37 +02:00
|
|
|
reject(error);
|
2020-09-25 18:29:22 +02:00
|
|
|
});
|
2020-11-13 18:00:22 +01:00
|
|
|
|
2020-12-03 16:39:44 +01:00
|
|
|
connection.onConnectingError((event: CloseEvent) => {
|
2021-07-16 11:22:36 +02:00
|
|
|
console.log("An error occurred while connecting to socket server. Retrying");
|
|
|
|
reject(
|
|
|
|
new Error(
|
|
|
|
"An error occurred while connecting to socket server. Retrying. Code: " +
|
2021-08-16 19:21:09 +02:00
|
|
|
event.code +
|
|
|
|
", Reason: " +
|
|
|
|
event.reason
|
2021-07-16 11:22:36 +02:00
|
|
|
)
|
|
|
|
);
|
2020-12-03 16:39:44 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
connection.onConnect((connect: OnConnectInterface) => {
|
|
|
|
resolve(connect);
|
|
|
|
});
|
2020-09-28 15:02:37 +02:00
|
|
|
}).catch((err) => {
|
|
|
|
// Let's retry in 4-6 seconds
|
2020-12-03 16:39:44 +01:00
|
|
|
return new Promise<OnConnectInterface>((resolve, reject) => {
|
2021-03-26 14:12:22 +01:00
|
|
|
this.reconnectingTimeout = setTimeout(() => {
|
2020-12-03 16:39:44 +01:00
|
|
|
//todo: allow a way to break recursion?
|
|
|
|
//todo: find a way to avoid recursive function. Otherwise, the call stack will grow indefinitely.
|
2021-07-16 11:22:36 +02:00
|
|
|
this.connectToRoomSocket(roomUrl, name, characterLayers, position, viewport, companion).then(
|
|
|
|
(connection) => resolve(connection)
|
|
|
|
);
|
|
|
|
}, 4000 + Math.floor(Math.random() * 2000));
|
2020-09-28 15:02:37 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2020-11-22 12:40:03 +01:00
|
|
|
|
2021-07-16 11:22:36 +02:00
|
|
|
get getConnexionType() {
|
2020-11-22 12:40:03 +01:00
|
|
|
return this.connexionType;
|
|
|
|
}
|
2021-09-06 18:36:31 +02:00
|
|
|
|
|
|
|
async checkAuthUserConnexion() {
|
|
|
|
//set connected store for menu at false
|
|
|
|
userIsConnected.set(false);
|
|
|
|
|
|
|
|
const state = localUserStore.getState();
|
|
|
|
const code = localUserStore.getCode();
|
|
|
|
if (!state || !localUserStore.verifyState(state)) {
|
|
|
|
throw "Could not validate state!";
|
|
|
|
}
|
|
|
|
if (!code) {
|
|
|
|
throw "No Auth code provided";
|
|
|
|
}
|
|
|
|
const nonce = localUserStore.getNonce();
|
|
|
|
const token = localUserStore.getAuthToken();
|
2021-09-17 14:02:43 +02:00
|
|
|
const { authToken, username, userUuid } = await Axios.get(`${PUSHER_URL}/login-callback`, { params: { code, nonce, token } }).then(
|
2021-09-06 18:36:31 +02:00
|
|
|
(res) => res.data
|
|
|
|
);
|
2021-09-17 14:02:43 +02:00
|
|
|
|
|
|
|
this.localUser = new LocalUser(userUuid, []);
|
2021-09-06 18:36:31 +02:00
|
|
|
this.authToken = authToken;
|
2021-09-17 14:02:43 +02:00
|
|
|
localUserStore.saveUser(this.localUser);
|
|
|
|
localUserStore.setAuthToken(this.authToken);
|
2021-09-06 18:36:31 +02:00
|
|
|
|
2021-09-17 09:46:04 +02:00
|
|
|
gameManager.setPlayerName(username);
|
|
|
|
|
2021-09-06 18:36:31 +02:00
|
|
|
//user connected, set connected store for menu at true
|
|
|
|
userIsConnected.set(true);
|
2021-09-20 15:06:44 +02:00
|
|
|
|
|
|
|
if (this.connexionType === GameConnexionTypes.anonymous) {
|
|
|
|
this.connexionType = GameConnexionTypes.empty
|
|
|
|
}
|
2021-09-06 18:36:31 +02:00
|
|
|
}
|
|
|
|
|
2021-09-28 09:44:11 +02:00
|
|
|
async getWorlds() {
|
|
|
|
|
|
|
|
const token = localUserStore.getAuthToken();
|
|
|
|
if (!token) {
|
|
|
|
throw "No token provided";
|
|
|
|
}
|
|
|
|
|
|
|
|
const { worlds } = await Axios.get(`${PUSHER_URL}/worlds`, { params: { token } }).then((res) => {
|
|
|
|
return res.data;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
return worlds;
|
|
|
|
}
|
|
|
|
|
2021-09-06 18:36:31 +02:00
|
|
|
get currentRoom() {
|
|
|
|
return this._currentRoom;
|
|
|
|
}
|
2020-09-25 18:29:22 +02:00
|
|
|
}
|
|
|
|
|
2020-09-29 17:12:28 +02:00
|
|
|
export const connectionManager = new ConnectionManager();
|