Merge branch 'develop' of github.com:thecodingmachine/workadventure into feat/follow-woka
This commit is contained in:
commit
368a115b4c
93 changed files with 4017 additions and 2405 deletions
|
@ -6,6 +6,7 @@ import { AuthTokenData, jwtTokenManager } from "../Services/JWTTokenManager";
|
|||
import { parse } from "query-string";
|
||||
import { openIDClient } from "../Services/OpenIDClient";
|
||||
import { DISABLE_ANONYMOUS, FRONT_URL } from "../Enum/EnvironmentVariable";
|
||||
import { RegisterData } from "../Messages/JsonMessages/RegisterData";
|
||||
|
||||
export interface TokenInterface {
|
||||
userUuid: string;
|
||||
|
@ -83,7 +84,7 @@ export class AuthenticateController extends BaseController {
|
|||
console.error("Token cannot to be check on OpenId provider");
|
||||
res.writeStatus("500");
|
||||
res.writeHeader("Access-Control-Allow-Origin", FRONT_URL);
|
||||
res.end("User cannot to be connected on openid provier");
|
||||
res.end("User cannot to be connected on openid provider");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -105,7 +106,7 @@ export class AuthenticateController extends BaseController {
|
|||
console.error("User cannot to be connected on OpenId provider => ", err);
|
||||
res.writeStatus("500");
|
||||
res.writeHeader("Access-Control-Allow-Origin", FRONT_URL);
|
||||
res.end("User cannot to be connected on openid provier");
|
||||
res.end("User cannot to be connected on openid provider");
|
||||
return;
|
||||
}
|
||||
const email = userInfo.email || userInfo.sub;
|
||||
|
@ -191,7 +192,7 @@ export class AuthenticateController extends BaseController {
|
|||
mapUrlStart,
|
||||
organizationMemberToken,
|
||||
textures,
|
||||
})
|
||||
} as RegisterData)
|
||||
);
|
||||
} catch (e) {
|
||||
console.error("register => ERROR", e);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { CharacterLayer, ExSocketInterface } from "../Model/Websocket/ExSocketInterface"; //TODO fix import by "_Model/.."
|
||||
import { GameRoomPolicyTypes } from "../Model/PusherRoom";
|
||||
import { GameRoomPolicyTypes, PusherRoom } from "../Model/PusherRoom";
|
||||
import { PointInterface } from "../Model/Websocket/PointInterface";
|
||||
import {
|
||||
SetPlayerDetailsMessage,
|
||||
|
@ -32,7 +32,7 @@ import { emitInBatch } from "../Services/IoSocketHelpers";
|
|||
import { ADMIN_API_URL, DISABLE_ANONYMOUS, SOCKET_IDLE_TIMER } from "../Enum/EnvironmentVariable";
|
||||
import { Zone } from "_Model/Zone";
|
||||
import { ExAdminSocketInterface } from "_Model/Websocket/ExAdminSocketInterface";
|
||||
import { CharacterTexture } from "../Services/AdminApi/CharacterTexture";
|
||||
import { CharacterTexture } from "../Messages/JsonMessages/CharacterTexture";
|
||||
import { isAdminMessageInterface } from "../Model/Websocket/Admin/AdminMessages";
|
||||
import Axios from "axios";
|
||||
import { InvalidTokenError } from "../Controller/InvalidTokenError";
|
||||
|
@ -276,6 +276,7 @@ export class IoSocketController {
|
|||
rejected: true,
|
||||
message: err?.response?.data.message,
|
||||
status: err?.response?.status,
|
||||
roomId,
|
||||
},
|
||||
websocketKey,
|
||||
websocketProtocol,
|
||||
|
@ -370,6 +371,7 @@ export class IoSocketController {
|
|||
rejected: true,
|
||||
reason: e instanceof InvalidTokenError ? tokenInvalidException : null,
|
||||
message: e.message,
|
||||
roomId,
|
||||
},
|
||||
websocketKey,
|
||||
websocketProtocol,
|
||||
|
@ -382,6 +384,7 @@ export class IoSocketController {
|
|||
rejected: true,
|
||||
reason: null,
|
||||
message: "500 Internal Server Error",
|
||||
roomId,
|
||||
},
|
||||
websocketKey,
|
||||
websocketProtocol,
|
||||
|
@ -395,6 +398,11 @@ export class IoSocketController {
|
|||
/* Handlers */
|
||||
open: (ws) => {
|
||||
if (ws.rejected === true) {
|
||||
// If there is a room in the error, let's check if we need to clean it.
|
||||
if (ws.roomId) {
|
||||
socketManager.deleteRoomIfEmptyFromId(ws.roomId as string);
|
||||
}
|
||||
|
||||
//FIX ME to use status code
|
||||
if (ws.reason === tokenInvalidException) {
|
||||
socketManager.emitTokenExpiredMessage(ws);
|
||||
|
|
|
@ -4,7 +4,7 @@ import { parse } from "query-string";
|
|||
import { adminApi } from "../Services/AdminApi";
|
||||
import { ADMIN_API_URL, DISABLE_ANONYMOUS, FRONT_URL } from "../Enum/EnvironmentVariable";
|
||||
import { GameRoomPolicyTypes } from "../Model/PusherRoom";
|
||||
import { isMapDetailsData, MapDetailsData } from "../Services/AdminApi/MapDetailsData";
|
||||
import { isMapDetailsData, MapDetailsData } from "../Messages/JsonMessages/MapDetailsData";
|
||||
import { socketManager } from "../Services/SocketManager";
|
||||
import { AuthTokenData, jwtTokenManager } from "../Services/JWTTokenManager";
|
||||
import { v4 } from "uuid";
|
||||
|
@ -59,11 +59,11 @@ export class MapController extends BaseController {
|
|||
JSON.stringify({
|
||||
mapUrl,
|
||||
policy_type: GameRoomPolicyTypes.ANONYMOUS_POLICY,
|
||||
roomSlug: "", // Deprecated
|
||||
roomSlug: null, // Deprecated
|
||||
group: null,
|
||||
tags: [],
|
||||
textures: [],
|
||||
contactPage: undefined,
|
||||
contactPage: null,
|
||||
authenticationMandatory: DISABLE_ANONYMOUS,
|
||||
} as MapDetailsData)
|
||||
);
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import { App } from "../Server/sifrr.server";
|
||||
import { HttpRequest, HttpResponse } from "uWebSockets.js";
|
||||
const register = require("prom-client").register;
|
||||
const collectDefaultMetrics = require("prom-client").collectDefaultMetrics;
|
||||
import { register, collectDefaultMetrics } from "prom-client";
|
||||
|
||||
export class PrometheusController {
|
||||
constructor(private App: App) {
|
||||
collectDefaultMetrics({
|
||||
timeout: 10000,
|
||||
gcDurationBuckets: [0.001, 0.01, 0.1, 1, 2, 5], // These are the default buckets.
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue