merged develop

This commit is contained in:
Piotr 'pwh' Hanusiak
2022-03-24 14:56:42 +01:00
137 changed files with 1628 additions and 1402 deletions
+296 -296
View File
File diff suppressed because it is too large Load Diff
+56 -11
View File
@@ -84,30 +84,75 @@ export class AuthenticateController extends BaseHttpController {
* get:
* description: TODO
* parameters:
* - name: "code"
* in: "query"
* description: "todo"
* required: false
* type: "string"
* - name: "nonce"
* in: "query"
* description: "todo"
* required: true
* required: false
* type: "string"
* - name: "state"
* - name: "token"
* in: "query"
* description: "todo"
* required: true
* required: false
* type: "string"
* - name: "playUri"
* in: "query"
* description: "todo"
* required: false
* type: "string"
* - name: "redirect"
* in: "query"
* description: "todo"
* required: false
* required: true
* type: "string"
* responses:
* 200:
* description: TODO
*
* description: NOTE - THERE ARE ADDITIONAL PROPERTIES NOT DISPLAYED HERE. THEY COME FROM THE CALL TO openIDClient.checkTokenAuth
* content:
* application/json:
* schema:
* type: object
* properties:
* authToken:
* type: string
* description: A new JWT token (if no token was passed in parameter), or returns the token that was passed in parameter if one was supplied
* username:
* type: string|undefined
* description: Contains the username stored in the JWT token passed in parameter. If no token was passed, contains the data from OpenID.
* example: John Doe
* locale:
* type: string|undefined
* description: Contains the locale stored in the JWT token passed in parameter. If no token was passed, contains the data from OpenID.
* example: fr_FR
* email:
* type: string
* description: TODO
* example: TODO
* userUuid:
* type: string
* description: TODO
* example: TODO
* visitCardUrl:
* type: string|null
* description: TODO
* example: TODO
* tags:
* type: array
* description: The list of tags of the user
* items:
* type: string
* example: speaker
* textures:
* type: array
* description: The list of textures of the user
* items:
* type: TODO
* example: TODO
* messages:
* type: array
* description: The list of messages to be displayed to the user
* items:
* type: TODO
* example: TODO
*/
//eslint-disable-next-line @typescript-eslint/no-misused-promises
this.app.get("/login-callback", async (req, res) => {
+1 -1
View File
@@ -37,7 +37,7 @@ import { InvalidTokenError } from "../Controller/InvalidTokenError";
import HyperExpress from "hyper-express";
import { localWokaService } from "../Services/LocalWokaService";
import { WebSocket } from "uWebSockets.js";
import { WokaDetail } from "../Enum/PlayerTextures";
import { WokaDetail } from "../Messages/JsonMessages/PlayerTextures";
/**
* The object passed between the "open" and the "upgrade" methods when opening a websocket
+8
View File
@@ -88,6 +88,14 @@ export class MapController extends BaseHttpController {
* type: boolean|undefined
* description: Whether the "report" feature is enabled or not on this room
* example: true
* loadingLogo:
* type: string
* description: The URL of the image to be used on the loading page
* example: https://example.com/logo.png
* loginSceneLogo:
* type: string
* description: The URL of the image to be used on the LoginScene
* example: https://example.com/logo_login.png
*
*/
this.app.get("/map", (req, res) => {
+7 -11
View File
@@ -1,17 +1,17 @@
import { BaseHttpController } from "./BaseHttpController";
import { parse } from "query-string";
import { wokaService } from "../Services/WokaService";
import * as tg from "generic-type-guard";
import { jwtTokenManager } from "../Services/JWTTokenManager";
export class WokaListController extends BaseHttpController {
routes() {
this.app.options("/woka/list/:roomUrl", {}, (req, res) => {
this.app.options("/woka/list", {}, (req, res) => {
res.status(200).send("");
return;
});
// eslint-disable-next-line @typescript-eslint/no-misused-promises
this.app.get("/woka/list/:roomUrl", {}, async (req, res) => {
this.app.get("/woka/list", {}, async (req, res) => {
const token = req.header("Authorization");
if (!token) {
@@ -29,17 +29,13 @@ export class WokaListController extends BaseHttpController {
return;
}
const isParameters = new tg.IsInterface()
.withProperties({
roomUrl: tg.isString,
})
.get();
let { roomUrl } = parse(req.path_query);
if (!isParameters(req.path_parameters)) {
return res.status(400).send("Unknown parameters");
if (typeof roomUrl !== "string") {
return res.status(400).send("missing roomUrl URL parameter");
}
const roomUrl = decodeURIComponent(req.path_parameters.roomUrl);
roomUrl = decodeURIComponent(roomUrl);
const wokaList = await wokaService.getWokaList(roomUrl, req.params["uuid"]);
if (!wokaList) {
+4 -2
View File
@@ -92,8 +92,10 @@ export class PositionDispatcher {
public removeViewport(socket: ExSocketInterface): void {
// Also, let's stop listening on viewports
for (const zone of socket.listenedZones) {
this.stopListening(zone, socket);
if (socket.listenedZones) {
for (const zone of socket.listenedZones) {
this.stopListening(zone, socket);
}
}
}
@@ -11,7 +11,7 @@ import {
import { ClientDuplexStream } from "grpc";
import { Zone } from "_Model/Zone";
import { compressors } from "hyper-express";
import { WokaDetail } from "_Enum/PlayerTextures";
import { WokaDetail } from "../../Messages/JsonMessages/PlayerTextures";
export type BackConnection = ClientDuplexStream<PusherToBackMessage, ServerToClientMessage>;
+1 -1
View File
@@ -9,7 +9,7 @@ import { ExSocketInterface } from "_Model/Websocket/ExSocketInterface";
import Direction = PositionMessage.Direction;
import { ItemEventMessageInterface } from "_Model/Websocket/ItemEventMessage";
import { PositionInterface } from "_Model/PositionInterface";
import { WokaDetail } from "_Enum/PlayerTextures";
import { WokaDetail } from "../../Messages/JsonMessages/PlayerTextures";
export class ProtobufUtils {
public static toPositionMessage(point: PointInterface): PositionMessage {
+10 -4
View File
@@ -1,11 +1,11 @@
import { ADMIN_API_TOKEN, ADMIN_API_URL, ADMIN_URL, OPID_PROFILE_SCREEN_PROVIDER } from "../Enum/EnvironmentVariable";
import Axios, { AxiosResponse } from "axios";
import { MapDetailsData } from "../Messages/JsonMessages/MapDetailsData";
import { RoomRedirect } from "../Messages/JsonMessages/RoomRedirect";
import { isMapDetailsData, MapDetailsData } from "../Messages/JsonMessages/MapDetailsData";
import { isRoomRedirect, RoomRedirect } from "../Messages/JsonMessages/RoomRedirect";
import { AdminApiData, isAdminApiData } from "../Messages/JsonMessages/AdminApiData";
import * as tg from "generic-type-guard";
import { isNumber } from "generic-type-guard";
import { isWokaDetail } from "../Enum/PlayerTextures";
import { isWokaDetail } from "../Messages/JsonMessages/PlayerTextures";
import qs from "qs";
export interface AdminBannedData {
@@ -46,10 +46,16 @@ class AdminApi {
userId,
};
const res = await Axios.get(ADMIN_API_URL + "/api/map", {
const res = await Axios.get<unknown, AxiosResponse<unknown>>(ADMIN_API_URL + "/api/map", {
headers: { Authorization: `${ADMIN_API_TOKEN}` },
params,
});
if (!isMapDetailsData(res.data) && !isRoomRedirect(res.data)) {
throw new Error(
"Invalid answer received from the admin for the /api/map endpoint. Received: " +
JSON.stringify(res.data)
);
}
return res.data;
}
+1 -1
View File
@@ -1,6 +1,6 @@
import axios, { AxiosResponse } from "axios";
import { ADMIN_API_TOKEN, ADMIN_API_URL } from "../Enum/EnvironmentVariable";
import { wokaList, WokaList } from "../Enum/PlayerTextures";
import { wokaList, WokaList } from "../Messages/JsonMessages/PlayerTextures";
import { WokaServiceInterface } from "./WokaServiceInterface";
class AdminWokaService implements WokaServiceInterface {
+1 -1
View File
@@ -1,4 +1,4 @@
import { WokaDetail, WokaDetailsResult, WokaList, wokaPartNames } from "../Enum/PlayerTextures";
import { WokaDetail, WokaDetailsResult, WokaList, wokaPartNames } from "../Messages/JsonMessages/PlayerTextures";
import { WokaServiceInterface } from "./WokaServiceInterface";
class LocalWokaService implements WokaServiceInterface {
+1 -1
View File
@@ -1,4 +1,4 @@
import { WokaDetailsResult, WokaList } from "../Enum/PlayerTextures";
import { WokaList } from "../Messages/JsonMessages/PlayerTextures";
export interface WokaServiceInterface {
/**