mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
chore: switched all urls to relative paths
This commit is contained in:
@@ -44,7 +44,6 @@ export class AudioManager {
|
||||
/* The audio backend must be manually started so that the browser can detect the user is enabling audio.
|
||||
Otherwise, no playback will be performed. */
|
||||
#running: boolean = false;
|
||||
#address: string = "localhost";
|
||||
#port: number;
|
||||
#endpoint: string;
|
||||
#socket: WebSocket | null = null;
|
||||
@@ -90,10 +89,10 @@ export class AudioManager {
|
||||
this.#playbackPipeline = new PlaybackPipeline();
|
||||
|
||||
/* Connect the audio websocket */
|
||||
let res = this.#address.match(/(?:http|https):\/\/(.+):/);
|
||||
if (res === null) res = this.#address.match(/(?:http|https):\/\/(.+)/);
|
||||
let res = location.toString().match(/(?:http|https):\/\/(.+):/);
|
||||
if (res === null) res = location.toString().match(/(?:http|https):\/\/(.+)/);
|
||||
|
||||
let wsAddress = res ? res[1] : this.#address;
|
||||
let wsAddress = res ? res[1] : location.toString();
|
||||
if (this.#endpoint) this.#socket = new WebSocket(`wss://${wsAddress}/${this.#endpoint}`);
|
||||
else if (this.#port) this.#socket = new WebSocket(`ws://${wsAddress}:${this.#port}`);
|
||||
else console.error("The audio backend was enabled but no port/endpoint was provided in the configuration");
|
||||
@@ -229,10 +228,6 @@ export class AudioManager {
|
||||
AudioManagerStateChangedEvent.dispatch(this.#running);
|
||||
}
|
||||
|
||||
setAddress(address) {
|
||||
this.#address = address;
|
||||
}
|
||||
|
||||
setPort(port) {
|
||||
this.#port = port;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export class SpeechController {
|
||||
body: JSON.stringify({ data: base64 }), // Send the data in blob format
|
||||
};
|
||||
|
||||
fetch(getApp().getExpressAddress() + `/api/speech/recognize`, requestOptions)
|
||||
fetch(`./api/speech/recognize`, requestOptions)
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
console.log(`Speech recognized correctly`);
|
||||
|
||||
@@ -30,7 +30,7 @@ export class TextToSpeechSource extends AudioSource {
|
||||
|
||||
this.#loading = true;
|
||||
|
||||
fetch(getApp().getExpressAddress() + `/api/speech/generate`, requestOptions)
|
||||
fetch(`./api/speech/generate`, requestOptions)
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
console.log(`Text to speech generate correctly`);
|
||||
|
||||
Reference in New Issue
Block a user