mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
fix: added compatibility checks with v1.0.4
This commit is contained in:
@@ -54,7 +54,10 @@ export class AudioManager {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
ConfigLoadedEvent.on((config: OlympusConfig) => {
|
ConfigLoadedEvent.on((config: OlympusConfig) => {
|
||||||
config.audio.WSPort ? this.setPort(config.audio.WSPort) : this.setEndpoint(config.audio.WSEndpoint);
|
if (config.audio)
|
||||||
|
config.audio.WSPort ? this.setPort(config.audio.WSPort) : this.setEndpoint(config.audio.WSEndpoint);
|
||||||
|
else
|
||||||
|
console.error("No audio configuration found in the Olympus configuration file");
|
||||||
});
|
});
|
||||||
|
|
||||||
CommandModeOptionsChangedEvent.on((options: CommandModeOptions) => {
|
CommandModeOptionsChangedEvent.on((options: CommandModeOptions) => {
|
||||||
|
|||||||
@@ -5,11 +5,6 @@ export interface OlympusConfig {
|
|||||||
/* Set by user */
|
/* Set by user */
|
||||||
frontend: {
|
frontend: {
|
||||||
port: number;
|
port: number;
|
||||||
customAuthHeaders: {
|
|
||||||
enabled: boolean;
|
|
||||||
username: string;
|
|
||||||
group: string;
|
|
||||||
};
|
|
||||||
elevationProvider: {
|
elevationProvider: {
|
||||||
provider: string;
|
provider: string;
|
||||||
username: string | null;
|
username: string | null;
|
||||||
@@ -26,23 +21,30 @@ export interface OlympusConfig {
|
|||||||
mapMirrors: {
|
mapMirrors: {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
autoconnectWhenLocal: boolean;
|
/* New with v2.0.0 */
|
||||||
|
customAuthHeaders?: {
|
||||||
|
enabled: boolean;
|
||||||
|
username: string;
|
||||||
|
group: string;
|
||||||
|
};
|
||||||
|
autoconnectWhenLocal?: boolean;
|
||||||
};
|
};
|
||||||
audio: {
|
/* New with v2.0.0 */
|
||||||
|
audio?: {
|
||||||
SRSPort: number;
|
SRSPort: number;
|
||||||
WSPort?: number;
|
WSPort?: number;
|
||||||
WSEndpoint?: string;
|
WSEndpoint?: string;
|
||||||
};
|
};
|
||||||
controllers: [{ type: string; coalition: Coalition; frequency: number; modulation: number; callsign: string }];
|
controllers?: [{ type: string; coalition: Coalition; frequency: number; modulation: number; callsign: string }];
|
||||||
profiles?: { [key: string]: ProfileOptions };
|
profiles?: { [key: string]: ProfileOptions };
|
||||||
authentication?: {
|
|
||||||
|
/* Set by server */
|
||||||
|
local?: boolean;
|
||||||
|
authentication?: { // Only sent when in localhost mode for autologin
|
||||||
gameMasterPassword: string;
|
gameMasterPassword: string;
|
||||||
blueCommanderPasword: string;
|
blueCommanderPasword: string;
|
||||||
redCommanderPassword: string;
|
redCommanderPassword: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Set by server */
|
|
||||||
local: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SessionData {
|
export interface SessionData {
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export class OlympusApp {
|
|||||||
})
|
})
|
||||||
.then(([result, headers]) => {
|
.then(([result, headers]) => {
|
||||||
this.#config = result;
|
this.#config = result;
|
||||||
if (this.#config.frontend.customAuthHeaders.enabled) {
|
if (this.#config.frontend.customAuthHeaders?.enabled) {
|
||||||
if (headers.has(this.#config.frontend.customAuthHeaders.username) && headers.has(this.#config.frontend.customAuthHeaders.group)) {
|
if (headers.has(this.#config.frontend.customAuthHeaders.username) && headers.has(this.#config.frontend.customAuthHeaders.group)) {
|
||||||
this.getServerManager().setUsername(headers.get(this.#config.frontend.customAuthHeaders.username));
|
this.getServerManager().setUsername(headers.get(this.#config.frontend.customAuthHeaders.username));
|
||||||
this.setState(OlympusState.LOGIN, LoginSubState.COMMAND_MODE);
|
this.setState(OlympusState.LOGIN, LoginSubState.COMMAND_MODE);
|
||||||
|
|||||||
@@ -186,8 +186,12 @@ class DCSInstance {
|
|||||||
this.backendPort = config["backend"]["port"];
|
this.backendPort = config["backend"]["port"];
|
||||||
this.backendAddress = config["backend"]["address"];
|
this.backendAddress = config["backend"]["address"];
|
||||||
this.gameMasterPasswordHash = config["authentication"]["gameMasterPassword"];
|
this.gameMasterPasswordHash = config["authentication"]["gameMasterPassword"];
|
||||||
this.autoconnectWhenLocal = config["frontend"]["autoconnectWhenLocal"];
|
|
||||||
this.SRSPort = config["audio"]["SRSPort"];
|
/* Read the new configurations added in v2.0.0 */
|
||||||
|
if ( config["frontend"]["autoconnectWhenLocal"] !== undefined)
|
||||||
|
this.autoconnectWhenLocal = config["frontend"]["autoconnectWhenLocal"];
|
||||||
|
if (config["frontend"]["audio"] !== undefined && config["frontend"]["audio"]["SRSPort"] !== undefined)
|
||||||
|
this.SRSPort = config["audio"]["SRSPort"];
|
||||||
|
|
||||||
this.gameMasterPasswordEdited = false;
|
this.gameMasterPasswordEdited = false;
|
||||||
this.blueCommanderPasswordEdited = false;
|
this.blueCommanderPasswordEdited = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user