From b3f8eb96ad6a25ca0bf212ac96c380a701667ad5 Mon Sep 17 00:00:00 2001 From: Davide Passoni Date: Fri, 28 Jun 2024 11:29:44 +0200 Subject: [PATCH] Added automatic removal of vite proxy --- frontend/react/src/olympusapp.ts | 4 ++-- frontend/react/src/server/servermanager.ts | 2 +- frontend/react/src/unit/databases/aircraftdatabase.ts | 2 +- frontend/react/src/unit/databases/groundunitdatabase.ts | 2 +- frontend/react/src/unit/databases/helicopterdatabase.ts | 2 +- frontend/react/src/unit/databases/navyunitdatabase.ts | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/react/src/olympusapp.ts b/frontend/react/src/olympusapp.ts index d47e4ec6..f60dc723 100644 --- a/frontend/react/src/olympusapp.ts +++ b/frontend/react/src/olympusapp.ts @@ -158,7 +158,7 @@ export class OlympusApp { this.#weaponsManager = new WeaponsManager(); /* Set the address of the server */ - this.getServerManager().setAddress(window.location.href.split('?')[0]); + this.getServerManager().setAddress(window.location.href.split('?')[0].replace("vite/", "")); /* Setup all global events */ this.#setupEvents(); @@ -181,7 +181,7 @@ export class OlympusApp { }) /* Load the config file from the server */ - const configRequest = new Request(window.location.href.split('?')[0] + "resources/config"); + const configRequest = new Request(window.location.href.split('?')[0].replace("vite/", "") + "resources/config"); fetch(configRequest).then((response) => { if (response.status === 200) { return response.json(); diff --git a/frontend/react/src/server/servermanager.ts b/frontend/react/src/server/servermanager.ts index 0c981854..263dbea1 100644 --- a/frontend/react/src/server/servermanager.ts +++ b/frontend/react/src/server/servermanager.ts @@ -117,7 +117,7 @@ export class ServerManager { getConfig(callback: CallableFunction) { var xmlHttp = new XMLHttpRequest(); - xmlHttp.open("GET", window.location.href.split('?')[0] + "config", true); + xmlHttp.open("GET", window.location.href.split('?')[0].replace("vite/", "") + "config", true); xmlHttp.onload = function (e) { var data = JSON.parse(xmlHttp.responseText); callback(data); diff --git a/frontend/react/src/unit/databases/aircraftdatabase.ts b/frontend/react/src/unit/databases/aircraftdatabase.ts index 6a2088d5..9346821d 100644 --- a/frontend/react/src/unit/databases/aircraftdatabase.ts +++ b/frontend/react/src/unit/databases/aircraftdatabase.ts @@ -4,7 +4,7 @@ import { UnitDatabase } from "./unitdatabase" export class AircraftDatabase extends UnitDatabase { constructor() { - super(window.location.href.split('?')[0] + 'api/databases/units/aircraftdatabase'); + super(window.location.href.split('?')[0].replace("vite/", "") + 'api/databases/units/aircraftdatabase'); } getCategory() { diff --git a/frontend/react/src/unit/databases/groundunitdatabase.ts b/frontend/react/src/unit/databases/groundunitdatabase.ts index dbdccacf..0b5d692d 100644 --- a/frontend/react/src/unit/databases/groundunitdatabase.ts +++ b/frontend/react/src/unit/databases/groundunitdatabase.ts @@ -4,7 +4,7 @@ import { UnitDatabase } from "./unitdatabase" export class GroundUnitDatabase extends UnitDatabase { constructor() { - super(window.location.href.split('?')[0] + 'api/databases/units/groundunitdatabase'); + super(window.location.href.split('?')[0].replace("vite/", "") + 'api/databases/units/groundunitdatabase'); } getSpawnPointsByName(name: string) { diff --git a/frontend/react/src/unit/databases/helicopterdatabase.ts b/frontend/react/src/unit/databases/helicopterdatabase.ts index e24c2a34..87e63ed5 100644 --- a/frontend/react/src/unit/databases/helicopterdatabase.ts +++ b/frontend/react/src/unit/databases/helicopterdatabase.ts @@ -4,7 +4,7 @@ import { UnitDatabase } from "./unitdatabase" export class HelicopterDatabase extends UnitDatabase { constructor() { - super(window.location.href.split('?')[0] + 'api/databases/units/helicopterdatabase'); + super(window.location.href.split('?')[0].replace("vite/", "") + 'api/databases/units/helicopterdatabase'); } getSpawnPointsByName(name: string) { diff --git a/frontend/react/src/unit/databases/navyunitdatabase.ts b/frontend/react/src/unit/databases/navyunitdatabase.ts index 7d22332d..c8f1e475 100644 --- a/frontend/react/src/unit/databases/navyunitdatabase.ts +++ b/frontend/react/src/unit/databases/navyunitdatabase.ts @@ -4,7 +4,7 @@ import { UnitDatabase } from "./unitdatabase" export class NavyUnitDatabase extends UnitDatabase { constructor() { - super(window.location.href.split('?')[0] + 'api/databases/units/navyunitdatabase'); + super(window.location.href.split('?')[0].replace("vite/", "") + 'api/databases/units/navyunitdatabase'); } getSpawnPointsByName(name: string) {