Fix prettier and change last use of adminAPI to Service way
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { v4 } from "uuid";
|
import { v4 } from "uuid";
|
||||||
import { BaseHttpController } from "./BaseHttpController";
|
import { BaseHttpController } from "./BaseHttpController";
|
||||||
import { adminApi, FetchMemberDataByUuidResponse } from "../Services/AdminApi";
|
import { FetchMemberDataByUuidResponse } from "../Services/AdminApi";
|
||||||
import { AuthTokenData, jwtTokenManager } from "../Services/JWTTokenManager";
|
import { AuthTokenData, jwtTokenManager } from "../Services/JWTTokenManager";
|
||||||
import { parse } from "query-string";
|
import { parse } from "query-string";
|
||||||
import { openIDClient } from "../Services/OpenIDClient";
|
import { openIDClient } from "../Services/OpenIDClient";
|
||||||
@@ -508,7 +508,7 @@ export class AuthenticateController extends BaseHttpController {
|
|||||||
userRoomToken: undefined,
|
userRoomToken: undefined,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
data = await adminApi.fetchMemberDataByUuid(email, playUri, IPAddress, []);
|
data = await adminService.fetchMemberDataByUuid(email, playUri, IPAddress, []);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("openIDCallback => fetchMemberDataByUuid", err);
|
console.error("openIDCallback => fetchMemberDataByUuid", err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ class AdminApi implements AdminInterface {
|
|||||||
console.info("JWT expire, but decoded", userId);
|
console.info("JWT expire, but decoded", userId);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof InvalidTokenError) {
|
if (e instanceof InvalidTokenError) {
|
||||||
throw new Error('Token decrypted error');
|
throw new Error("Token decrypted error");
|
||||||
// The token was not good, redirect user on login page
|
// The token was not good, redirect user on login page
|
||||||
//res.status(401);
|
//res.status(401);
|
||||||
//res.send("Token decrypted error");
|
//res.send("Token decrypted error");
|
||||||
//return;
|
//return;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Error on decryption of token :' + e);
|
throw new Error("Error on decryption of token :" + e);
|
||||||
//this.castErrorToResponse(e, res);
|
//this.castErrorToResponse(e, res);
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,20 +25,14 @@ export interface AdminInterface {
|
|||||||
* @var userId: can to be undefined or email or uuid
|
* @var userId: can to be undefined or email or uuid
|
||||||
* @return MapDetailsData|RoomRedirect
|
* @return MapDetailsData|RoomRedirect
|
||||||
*/
|
*/
|
||||||
fetchMapDetails(
|
fetchMapDetails(playUri: string, authToken?: string): Promise<MapDetailsData | RoomRedirect>;
|
||||||
playUri: string,
|
|
||||||
authToken?: string
|
|
||||||
): Promise<MapDetailsData | RoomRedirect>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param organizationMemberToken
|
* @param organizationMemberToken
|
||||||
* @param playUri
|
* @param playUri
|
||||||
* @return AdminApiData
|
* @return AdminApiData
|
||||||
*/
|
*/
|
||||||
fetchMemberDataByToken(
|
fetchMemberDataByToken(organizationMemberToken: string, playUri: string | null): Promise<AdminApiData>;
|
||||||
organizationMemberToken: string,
|
|
||||||
playUri: string | null
|
|
||||||
): Promise<AdminApiData>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param reportedUserUuid
|
* @param reportedUserUuid
|
||||||
@@ -59,32 +53,22 @@ export interface AdminInterface {
|
|||||||
* @param roomUrl
|
* @param roomUrl
|
||||||
* @return AdminBannedData
|
* @return AdminBannedData
|
||||||
*/
|
*/
|
||||||
verifyBanUser(
|
verifyBanUser(userUuid: string, ipAddress: string, roomUrl: string): Promise<AdminBannedData>;
|
||||||
userUuid: string,
|
|
||||||
ipAddress: string,
|
|
||||||
roomUrl: string
|
|
||||||
): Promise<AdminBannedData>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param roomUrl
|
* @param roomUrl
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
getUrlRoomsFromSameWorld(
|
getUrlRoomsFromSameWorld(roomUrl: string): Promise<string[]>;
|
||||||
roomUrl: string
|
|
||||||
): Promise<string[]>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param accessToken
|
* @param accessToken
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
getProfileUrl(
|
getProfileUrl(accessToken: string): string;
|
||||||
accessToken: string
|
|
||||||
): string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param token
|
* @param token
|
||||||
*/
|
*/
|
||||||
logoutOauth(
|
logoutOauth(token: string): Promise<void>;
|
||||||
token: string
|
|
||||||
): Promise<void>;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ import {AdminInterface} from "./AdminInterface";
|
|||||||
import { MapDetailsData } from "../Messages/JsonMessages/MapDetailsData";
|
import { MapDetailsData } from "../Messages/JsonMessages/MapDetailsData";
|
||||||
import { RoomRedirect } from "../Messages/JsonMessages/RoomRedirect";
|
import { RoomRedirect } from "../Messages/JsonMessages/RoomRedirect";
|
||||||
import { GameRoomPolicyTypes } from "../Model/PusherRoom";
|
import { GameRoomPolicyTypes } from "../Model/PusherRoom";
|
||||||
import {ADMIN_API_URL, DISABLE_ANONYMOUS, OPID_PROFILE_SCREEN_PROVIDER} from "../Enum/EnvironmentVariable";
|
import { DISABLE_ANONYMOUS } from "../Enum/EnvironmentVariable";
|
||||||
import { AdminApiData } from "../Messages/JsonMessages/AdminApiData";
|
import { AdminApiData } from "../Messages/JsonMessages/AdminApiData";
|
||||||
import Axios from "axios";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A local class mocking a real admin if no admin is configured.
|
* A local class mocking a real admin if no admin is configured.
|
||||||
@@ -38,7 +37,6 @@ class LocalAdmin implements AdminInterface {
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
authToken?: string
|
authToken?: string
|
||||||
): Promise<MapDetailsData | RoomRedirect> {
|
): Promise<MapDetailsData | RoomRedirect> {
|
||||||
|
|
||||||
const roomUrl = new URL(playUri);
|
const roomUrl = new URL(playUri);
|
||||||
|
|
||||||
const match = /\/_\/[^/]+\/(.+)/.exec(roomUrl.pathname);
|
const match = /\/_\/[^/]+\/(.+)/.exec(roomUrl.pathname);
|
||||||
@@ -58,7 +56,7 @@ class LocalAdmin implements AdminInterface {
|
|||||||
group: null,
|
group: null,
|
||||||
iframeAuthentication: null,
|
iframeAuthentication: null,
|
||||||
loadingLogo: null,
|
loadingLogo: null,
|
||||||
loginSceneLogo: null
|
loginSceneLogo: null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user