lint fixes

This commit is contained in:
arp 2020-10-13 15:55:30 +02:00
parent 94538bfaf4
commit d98efc0433
7 changed files with 20 additions and 23 deletions

View File

@ -77,20 +77,18 @@ export class AuthenticateController extends BaseController {
});
this.App.post("/anonymLogin", (res: HttpResponse, req: HttpRequest) => {
(async () => {
this.addCorsHeaders(res);
this.addCorsHeaders(res);
res.onAborted(() => {
console.warn('Login request was aborted');
})
res.onAborted(() => {
console.warn('Login request was aborted');
})
const userUuid = v4();
const authToken = jwtTokenManager.createJWTToken(userUuid);
res.writeStatus("200 OK").end(JSON.stringify({
authToken,
userUuid,
}));
})();
const userUuid = v4();
const authToken = jwtTokenManager.createJWTToken(userUuid);
res.writeStatus("200 OK").end(JSON.stringify({
authToken,
userUuid,
}));
});
}
}

View File

@ -2,9 +2,9 @@ export class RoomIdentifier {
public anonymous: boolean;
public id:string
constructor(roomID: string) {
if (roomID.indexOf('_/') === 0) {
if (roomID.startsWith('_/')) {
this.anonymous = true;
} else if(roomID.indexOf('@/') === 0) {
} else if(roomID.startsWith('@/')) {
this.anonymous = false;
} else {
throw new Error('Incorrect room ID: '+roomID);

View File

@ -6,7 +6,6 @@ import {PlayGlobalMessageInterface} from "../Connexion/ConnexionModels";
export const CLASS_CONSOLE_MESSAGE = 'main-console';
export const INPUT_CONSOLE_MESSAGE = 'input-send-text';
export const UPLOAD_CONSOLE_MESSAGE = 'input-upload-music';
export const BUTTON_CONSOLE_SEND = 'button-send';
export const INPUT_TYPE_CONSOLE = 'input-type';
export const AUDIO_TYPE = 'audio';
@ -124,7 +123,7 @@ export class ConsoleGlobalMessageManager {
// Start loading CSS
const cssPromise = ConsoleGlobalMessageManager.loadCss();
// Import quill
const Quill = await import("quill") as any;
const Quill:any = await import("quill"); // eslint-disable-line @typescript-eslint/no-explicit-any
// Wait for CSS to be loaded
await cssPromise;

View File

@ -18,7 +18,7 @@ class ConnectionManager {
const connexionType = urlManager.getGameConnexionType();
if(connexionType === GameConnexionTypes.register) {
const organizationMemberToken = urlManager.getOrganizationToken();
const data:any = await Axios.post(`${API_URL}/register`, {organizationMemberToken}).then(res => res.data);
const data = await Axios.post(`${API_URL}/register`, {organizationMemberToken}).then(res => res.data);
this.localUser = new LocalUser(data.userUuid, data.authToken);
localUserStore.saveUser(this.localUser);
@ -35,7 +35,7 @@ class ConnectionManager {
if (localUser) {
this.localUser = localUser
} else {
const data:any = await Axios.post(`${API_URL}/anonymLogin`).then(res => res.data);
const data = await Axios.post(`${API_URL}/anonymLogin`).then(res => res.data);
this.localUser = new LocalUser(data.userUuid, data.authToken);
localUserStore.saveUser(this.localUser);
}

View File

@ -58,7 +58,7 @@ export class GameManager {
return mapUrlStart.substring(startPos, endPos);
}
public async goToStartingMap(scenePlugin: Phaser.Scenes.ScenePlugin) {
public goToStartingMap(scenePlugin: Phaser.Scenes.ScenePlugin) {
console.log('Starting scene '+this.startRoom.url);
scenePlugin.start(this.startRoom.url, {startLayerName: 'global'});
}

View File

@ -258,7 +258,7 @@ export class EnableCameraScene extends Phaser.Scene {
this.soundMeterSprite.setVolume(this.soundMeter.getVolume());
}
private async login(): Promise<void> {
private login(): void {
this.getElementByIdOrFail<HTMLDivElement>('webRtcSetup').style.display = 'none';
this.soundMeter.stop();
window.removeEventListener('resize', this.repositionCallback);

View File

@ -12,11 +12,11 @@ class UrlManager {
//todo: use that to detect if we can find a token in localstorage
public getGameConnexionType(): GameConnexionTypes {
const url = window.location.pathname.toString();
if (url.indexOf('_/') > -1) {
if (url.includes('_/')) {
return GameConnexionTypes.anonymous;
} else if (url.indexOf('@/') > -1) {
} else if (url.includes('@/')) {
return GameConnexionTypes.organization;
} else if(url.indexOf('register/') > -1) {
} else if(url.includes('register/')) {
return GameConnexionTypes.register
} else {
return GameConnexionTypes.unknown