mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Fixed error in express address
This commit is contained in:
parent
53237c6197
commit
b97713f8cc
@ -248,7 +248,7 @@ export class MissionManager {
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", getApp().getExpressAddress() + `api/airbases/${this.#theatre.toLowerCase()}/${callsign}`, true);
|
||||
xhr.open("GET", getApp().getExpressAddress() + `/api/airbases/${this.#theatre.toLowerCase()}/${callsign}`, true);
|
||||
xhr.responseType = "json";
|
||||
xhr.onload = () => {
|
||||
var status = xhr.status;
|
||||
|
||||
@ -136,7 +136,7 @@ export class OlympusApp {
|
||||
});
|
||||
|
||||
/* Load the config file from the server */
|
||||
const configRequest = new Request(this.getExpressAddress() + "resources/config");
|
||||
const configRequest = new Request(this.getExpressAddress() + "/resources/config");
|
||||
fetch(configRequest)
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
@ -172,7 +172,7 @@ export class OlympusApp {
|
||||
body: JSON.stringify(profile), // Send the data in JSON format
|
||||
};
|
||||
|
||||
fetch(this.getExpressAddress() + `resources/profile/${this.#profileName}`, requestOptions)
|
||||
fetch(this.getExpressAddress() + `/resources/profile/${this.#profileName}`, requestOptions)
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
console.log(`Profile ${this.#profileName} saved correctly`);
|
||||
|
||||
@ -6,6 +6,7 @@ import { DateAndTime, UnitBlueprint } from "../interfaces";
|
||||
import { Converter } from "usng";
|
||||
import { MGRS } from "../types/types";
|
||||
import { featureCollection } from "turf";
|
||||
import { getApp } from "../olympusapp";
|
||||
|
||||
export function bearing(lat1: number, lon1: number, lat2: number, lon2: number) {
|
||||
const φ1 = deg2rad(lat1); // φ, λ in radians
|
||||
@ -291,7 +292,7 @@ export function convertDateAndTimeToDate(dateAndTime: DateAndTime) {
|
||||
export function getGroundElevation(latlng: LatLng, callback: CallableFunction) {
|
||||
/* Get the ground elevation from the server endpoint */
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", getApp().getExpressAddress() + `api/elevation/${latlng.lat}/${latlng.lng}`, true);
|
||||
xhr.open("GET", getApp().getExpressAddress() + `/api/elevation/${latlng.lat}/${latlng.lng}`, true);
|
||||
xhr.timeout = 500; // ms
|
||||
xhr.responseType = "json";
|
||||
xhr.onload = () => {
|
||||
|
||||
@ -138,7 +138,7 @@ export class ServerManager {
|
||||
|
||||
getConfig(callback: CallableFunction) {
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.open("GET", getApp().getExpressAddress() + "config", true);
|
||||
xmlHttp.open("GET", getApp().getExpressAddress() + "/config", true);
|
||||
xmlHttp.onload = function (e) {
|
||||
var data = JSON.parse(xmlHttp.responseText);
|
||||
callback(data);
|
||||
@ -150,7 +150,7 @@ export class ServerManager {
|
||||
}
|
||||
|
||||
setAddress(address: string) {
|
||||
this.#REST_ADDRESS = `${address.replace("vite/", "").replace("vite", "")}olympus`;
|
||||
this.#REST_ADDRESS = address;
|
||||
|
||||
console.log(`Setting REST address to ${this.#REST_ADDRESS}`);
|
||||
}
|
||||
|
||||
@ -56,10 +56,10 @@ export class UnitsManager {
|
||||
|
||||
constructor() {
|
||||
this.#unitDatabase = new UnitDatabase();
|
||||
this.#unitDatabase.load(getApp().getExpressAddress() + "api/databases/units/aircraftdatabase", "aircraft");
|
||||
this.#unitDatabase.load(getApp().getExpressAddress() + "api/databases/units/helicopterdatabase", "helicopter");
|
||||
this.#unitDatabase.load(getApp().getExpressAddress() + "api/databases/units/groundunitdatabase", "groundunit");
|
||||
this.#unitDatabase.load(getApp().getExpressAddress() + "api/databases/units/navyunitdatabase", "navyunit");
|
||||
this.#unitDatabase.load(getApp().getExpressAddress() + "/api/databases/units/aircraftdatabase", "aircraft");
|
||||
this.#unitDatabase.load(getApp().getExpressAddress() + "/api/databases/units/helicopterdatabase", "helicopter");
|
||||
this.#unitDatabase.load(getApp().getExpressAddress() + "/api/databases/units/groundunitdatabase", "groundunit");
|
||||
this.#unitDatabase.load(getApp().getExpressAddress() + "/api/databases/units/navyunitdatabase", "navyunit");
|
||||
|
||||
CommandModeOptionsChangedEvent.on(() => {
|
||||
Object.values(this.#units).forEach((unit: Unit) => unit.updateVisibility());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user