apply textures on openid login, fix pusher errors on woka list (#1961)
* apply textures on openid login, fix pusher errors on woka list * remove logging * Returning a HTTP 400 id roomUrl parameter not set Co-authored-by: David Négrier <d.negrier@thecodingmachine.com>
This commit is contained in:
parent
6f4c3a89cd
commit
55db6a9b12
@ -330,9 +330,12 @@ class ConnectionManager {
|
|||||||
throw new Error("No Auth code provided");
|
throw new Error("No Auth code provided");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const { authToken, userUuid, email, username, locale } = await Axios.get(`${PUSHER_URL}/login-callback`, {
|
const { authToken, userUuid, email, username, locale, textures } = await Axios.get(
|
||||||
params: { code, nonce, token, playUri: this.currentRoom?.key },
|
`${PUSHER_URL}/login-callback`,
|
||||||
}).then((res) => {
|
{
|
||||||
|
params: { code, nonce, token, playUri: this.currentRoom?.key },
|
||||||
|
}
|
||||||
|
).then((res) => {
|
||||||
return res.data;
|
return res.data;
|
||||||
});
|
});
|
||||||
localUserStore.setAuthToken(authToken);
|
localUserStore.setAuthToken(authToken);
|
||||||
@ -361,6 +364,18 @@ class ConnectionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (textures) {
|
||||||
|
const layers: string[] = [];
|
||||||
|
for (const texture of textures) {
|
||||||
|
if (texture !== undefined) {
|
||||||
|
layers.push(texture.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (layers.length > 0) {
|
||||||
|
gameManager.setCharacterLayers(layers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//user connected, set connected store for menu at true
|
//user connected, set connected store for menu at true
|
||||||
userIsConnected.set(true);
|
userIsConnected.set(true);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ export class CustomizeScene extends AbstractCharacterScene {
|
|||||||
// FIXME: window.location.href is wrong. We need the URL of the main room (so we need to apply any redirect before!)
|
// FIXME: window.location.href is wrong. We need the URL of the main room (so we need to apply any redirect before!)
|
||||||
this.load.json(
|
this.load.json(
|
||||||
wokaMetadataKey,
|
wokaMetadataKey,
|
||||||
`${PUSHER_URL}/woka/list/` + encodeURIComponent(window.location.href),
|
`${PUSHER_URL}/woka/list?roomUrl=` + encodeURIComponent(window.location.href),
|
||||||
undefined,
|
undefined,
|
||||||
{
|
{
|
||||||
responseType: "text",
|
responseType: "text",
|
||||||
|
@ -50,7 +50,7 @@ export class SelectCharacterScene extends AbstractCharacterScene {
|
|||||||
// FIXME: window.location.href is wrong. We need the URL of the main room (so we need to apply any redirect before!)
|
// FIXME: window.location.href is wrong. We need the URL of the main room (so we need to apply any redirect before!)
|
||||||
this.load.json(
|
this.load.json(
|
||||||
wokaMetadataKey,
|
wokaMetadataKey,
|
||||||
`${PUSHER_URL}/woka/list/` + encodeURIComponent(window.location.href),
|
`${PUSHER_URL}/woka/list?roomUrl=` + encodeURIComponent(window.location.href),
|
||||||
undefined,
|
undefined,
|
||||||
{
|
{
|
||||||
responseType: "text",
|
responseType: "text",
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import { BaseHttpController } from "./BaseHttpController";
|
import { BaseHttpController } from "./BaseHttpController";
|
||||||
|
import { parse } from "query-string";
|
||||||
import { wokaService } from "../Services/WokaService";
|
import { wokaService } from "../Services/WokaService";
|
||||||
import * as tg from "generic-type-guard";
|
|
||||||
import { jwtTokenManager } from "../Services/JWTTokenManager";
|
import { jwtTokenManager } from "../Services/JWTTokenManager";
|
||||||
|
|
||||||
export class WokaListController extends BaseHttpController {
|
export class WokaListController extends BaseHttpController {
|
||||||
routes() {
|
routes() {
|
||||||
this.app.options("/woka/list/:roomUrl", {}, (req, res) => {
|
this.app.options("/woka/list", {}, (req, res) => {
|
||||||
res.status(200).send("");
|
res.status(200).send("");
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
// 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");
|
const token = req.header("Authorization");
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
@ -29,17 +29,13 @@ export class WokaListController extends BaseHttpController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isParameters = new tg.IsInterface()
|
let { roomUrl } = parse(req.path_query);
|
||||||
.withProperties({
|
|
||||||
roomUrl: tg.isString,
|
|
||||||
})
|
|
||||||
.get();
|
|
||||||
|
|
||||||
if (!isParameters(req.path_parameters)) {
|
if (typeof roomUrl !== "string") {
|
||||||
return res.status(400).send("Unknown parameters");
|
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"]);
|
const wokaList = await wokaService.getWokaList(roomUrl, req.params["uuid"]);
|
||||||
|
|
||||||
if (!wokaList) {
|
if (!wokaList) {
|
||||||
|
Loading…
Reference in New Issue
Block a user