Added automatic removal of vite proxy

This commit is contained in:
Davide Passoni 2024-06-28 11:29:44 +02:00
parent 36478f26d5
commit b3f8eb96ad
6 changed files with 7 additions and 7 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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() {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {