Fix admin console in public room
This commit is contained in:
parent
73968bab94
commit
06221e6301
|
@ -3,7 +3,7 @@ const URL_ROOM_STARTED = "/Floor0/floor0.json";
|
||||||
const MINIMUM_DISTANCE = process.env.MINIMUM_DISTANCE ? Number(process.env.MINIMUM_DISTANCE) : 64;
|
const MINIMUM_DISTANCE = process.env.MINIMUM_DISTANCE ? Number(process.env.MINIMUM_DISTANCE) : 64;
|
||||||
const GROUP_RADIUS = process.env.GROUP_RADIUS ? Number(process.env.GROUP_RADIUS) : 48;
|
const GROUP_RADIUS = process.env.GROUP_RADIUS ? Number(process.env.GROUP_RADIUS) : 48;
|
||||||
const ALLOW_ARTILLERY = process.env.ALLOW_ARTILLERY ? process.env.ALLOW_ARTILLERY == 'true' : false;
|
const ALLOW_ARTILLERY = process.env.ALLOW_ARTILLERY ? process.env.ALLOW_ARTILLERY == 'true' : false;
|
||||||
const ADMIN_API_URL = process.env.ADMIN_API_URL || '';
|
const ADMIN_API_URL = process.env.ADMIN_API_URL || 'http://admin';
|
||||||
const ADMIN_API_TOKEN = process.env.ADMIN_API_TOKEN || 'myapitoken';
|
const ADMIN_API_TOKEN = process.env.ADMIN_API_TOKEN || 'myapitoken';
|
||||||
const MAX_USERS_PER_ROOM = parseInt(process.env.MAX_USERS_PER_ROOM || '') || 600;
|
const MAX_USERS_PER_ROOM = parseInt(process.env.MAX_USERS_PER_ROOM || '') || 600;
|
||||||
const CPU_OVERHEAT_THRESHOLD = Number(process.env.CPU_OVERHEAT_THRESHOLD) || 80;
|
const CPU_OVERHEAT_THRESHOLD = Number(process.env.CPU_OVERHEAT_THRESHOLD) || 80;
|
||||||
|
|
|
@ -31,7 +31,12 @@ class ConnectionManager {
|
||||||
|
|
||||||
const room = new Room(window.location.pathname + window.location.hash);
|
const room = new Room(window.location.pathname + window.location.hash);
|
||||||
return Promise.resolve(room);
|
return Promise.resolve(room);
|
||||||
} else if (connexionType === GameConnexionTypes.anonymous || connexionType === GameConnexionTypes.empty) {
|
} else {
|
||||||
|
//if connexion anonymous, remove local token
|
||||||
|
if(connexionType !== GameConnexionTypes.organization) {
|
||||||
|
localUserStore.removeUser();
|
||||||
|
}
|
||||||
|
if (connexionType === GameConnexionTypes.anonymous || connexionType === GameConnexionTypes.empty) {
|
||||||
const localUser = localUserStore.getLocalUser();
|
const localUser = localUserStore.getLocalUser();
|
||||||
|
|
||||||
if (localUser && localUser.jwtToken && localUser.uuid && localUser.textures) {
|
if (localUser && localUser.jwtToken && localUser.uuid && localUser.textures) {
|
||||||
|
@ -68,6 +73,7 @@ class ConnectionManager {
|
||||||
return Promise.reject('Could not find a user in localstorage');
|
return Promise.reject('Could not find a user in localstorage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Promise.reject('Invalid URL');
|
return Promise.reject('Invalid URL');
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,11 @@ class LocalUserStore {
|
||||||
saveUser(localUser: LocalUser) {
|
saveUser(localUser: LocalUser) {
|
||||||
localStorage.setItem('localUser', JSON.stringify(localUser));
|
localStorage.setItem('localUser', JSON.stringify(localUser));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeUser() {
|
||||||
|
localStorage.removeItem('localUser');
|
||||||
|
}
|
||||||
|
|
||||||
getLocalUser(): LocalUser|null {
|
getLocalUser(): LocalUser|null {
|
||||||
const data = localStorage.getItem('localUser');
|
const data = localStorage.getItem('localUser');
|
||||||
return data ? JSON.parse(data) : null;
|
return data ? JSON.parse(data) : null;
|
||||||
|
|
Loading…
Reference in a new issue