merge with master

This commit is contained in:
simplonco
2023-01-03 19:54:53 +01:00
10 changed files with 109 additions and 56 deletions

View File

@@ -37,10 +37,10 @@ export class AuthenticationController {
const user : User = request.user
if (user.isEnabledTwoFactorAuth === false || user.isTwoFactorAuthenticated === true){
console.log('ON VA VERS PROFILE');
return response.status(200).redirect('http://transcendance:8080/#/profile');
return response.status(200).redirect('http://' + process.env.WEBSITE_HOST + ':' + process.env.WEBSITE_PORT + '/#/profile');
}
console.log('ON VA VERS 2FA')
return response.status(200).redirect('http://transcendance:8080/#/2fa');
return response.status(200).redirect('http://' + process.env.WEBSITE_HOST + ':' + process.env.WEBSITE_PORT + '/#/2fa');
}
/**
@@ -83,6 +83,6 @@ export class AuthenticationController {
throw new UnauthorizedException('Wrong Code.');
await this.userService.authenticateUserWith2FA(request.user.id);
console.log('ON REDIRIGE');
return response.status(200).redirect('http://transcendance:8080/#/profile');
return response.status(200).redirect('http://' + process.env.WEBSITE_HOST + ':' + process.env.WEBSITE_PORT + '/#/profile');
}
}

View File

@@ -8,7 +8,7 @@ import * as connectRedis from 'connect-redis';
async function bootstrap() {
const app = await NestFactory.create(AppModule, { cors: true });
const port = process.env.PORT || 3001;
const port = process.env.PORT || 3000;
const client = redis.createClient(
{
socket: { host: process.env.REDIS_HOST, port: parseInt(process.env.REDIS_PORT) },
@@ -50,6 +50,6 @@ async function bootstrap() {
);
app.use(passport.initialize());
app.use(passport.session());
await app.listen(port, () => { console.log(`Listening on port ${port}`); });
await app.listen(port, () => { console.log(`Listening on port ${process.env.WEBSITE_HOST}:${process.env.WEBSITE_PORT}}`); });
}
bootstrap();

View File

@@ -1,7 +1,6 @@
server {
listen 8080 default_server;
listen [::]:8080 default_server;
listen 8080;
listen [::]:8080;
server_name transcendance;
location /api/v2 {
@@ -17,7 +16,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Connection "Upgrade";
proxy_pass http://backend_dev:5000/chat;
}
@@ -43,7 +42,6 @@ server {
}
server {
listen 35729 default_server;
listen [::]:35729 default_server;
server_name transcendance;

View File

@@ -17368,10 +17368,10 @@ var app = (function () {
// export const soundPongArr: HTMLAudioElement[] = [];
const soundPongArr = [
new Audio("http://transcendance:8080/sound/pong/" + 1 + ".ogg"),
new Audio("http://transcendance:8080/sound/pong/" + 2 + ".ogg")
new Audio("http://" + 'transcendance' + ":" + '8080' + "/sound/pong/" + 1 + ".ogg"),
new Audio("http://" + 'transcendance' + ":" + '8080' + "/sound/pong/" + 2 + ".ogg")
];
const soundRoblox = new Audio("http://transcendance:8080/sound/roblox-oof.ogg");
const soundRoblox = new Audio("http://" + 'transcendance' + ":" + '8080' + "/sound/roblox-oof.ogg");
function initAudio(sound) {
let muteFlag;
if (sound === "on") {
@@ -17380,11 +17380,6 @@ var app = (function () {
else {
muteFlag = true;
}
/* for (let i = 0; i <= 32; i++) {
soundPongArr.push(new Audio("http://transcendance:8080/sound/pong/"+i+".ogg"));
soundPongArr[i].volume = c.soundPongVolume;
soundPongArr[i].muted = muteFlag;
} */
soundPongArr.forEach((value) => {
value.volume = soundRobloxVolume;
value.muted = muteFlag;
@@ -17466,7 +17461,7 @@ var app = (function () {
}
class ClientInfoSpectator {
}
const wsUrl = "ws://transcendance:8080/pong";
const wsUrl = "ws://" + 'transcendance' + ":" + '8080' + "/pong";
let socket; /* TODO: A way to still use "const" not "let" ? */
const clientInfo = new ClientInfo();
const clientInfoSpectator = new ClientInfoSpectator(); // WIP, could refactor this
@@ -21304,7 +21299,7 @@ var app = (function () {
component: ProfilePage,
conditions: [
async(detail) => {
const user = await fetch('http://transcendance:8080/api/v2/user')
const user = await fetch('http://' + 'transcendance' + ":" + '8080' + '/api/v2/user')
.then((resp) => resp.json());
console.log('in /profile what is in user');
@@ -21321,7 +21316,7 @@ var app = (function () {
component: ProfilePage,
conditions: [
async(detail) => {
const user = await fetch('http://transcendance:8080/api/v2/user')
const user = await fetch('http://' + 'transcendance' + ":" + '8080' + '/api/v2/user')
.then((resp) => resp.json());
console.log('in /profile/* what is in user');

File diff suppressed because one or more lines are too long

View File

@@ -3,10 +3,10 @@ import * as c from "./constants.js"
// export const soundPongArr: HTMLAudioElement[] = [];
export const soundPongArr: HTMLAudioElement[] = [
new Audio("http://transcendance:8080/sound/pong/"+1+".ogg"),
new Audio("http://transcendance:8080/sound/pong/"+2+".ogg")
new Audio("http://" + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + "/sound/pong/"+1+".ogg"),
new Audio("http://" + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + "/sound/pong/"+2+".ogg")
];
export const soundRoblox = new Audio("http://transcendance:8080/sound/roblox-oof.ogg");
export const soundRoblox = new Audio("http://" + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + "/sound/roblox-oof.ogg");
export function initAudio(sound: string)
{
@@ -18,11 +18,6 @@ export function initAudio(sound: string)
muteFlag = true;
}
/* for (let i = 0; i <= 32; i++) {
soundPongArr.push(new Audio("http://transcendance:8080/sound/pong/"+i+".ogg"));
soundPongArr[i].volume = c.soundPongVolume;
soundPongArr[i].muted = muteFlag;
} */
soundPongArr.forEach((value) => {
value.volume = c.soundRobloxVolume;
value.muted = muteFlag;

View File

@@ -35,7 +35,7 @@ class ClientInfoSpectator {
playerRightNextPos: VectorInteger;
}
const wsUrl = "ws://transcendance:8080/pong";
const wsUrl = "ws://" + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + "/pong";
export let socket: WebSocket; /* TODO: A way to still use "const" not "let" ? */
export const clientInfo = new ClientInfo();
export const clientInfoSpectator = new ClientInfoSpectator(); // WIP, could refactor this

View File

@@ -21,7 +21,7 @@ export const primaryRoutes = {
component: ProfilePage,
conditions: [
async(detail) => {
const user = await fetch('http://transcendance:8080/api/v2/user')
const user = await fetch('http://' + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + '/api/v2/user')
.then((resp) => resp.json())
console.log('in /profile what is in user')
@@ -38,7 +38,7 @@ export const primaryRoutes = {
component: ProfilePage,
conditions: [
async(detail) => {
const user = await fetch('http://transcendance:8080/api/v2/user')
const user = await fetch('http://' + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + '/api/v2/user')
.then((resp) => resp.json())
console.log('in /profile/* what is in user')