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:
parent
f1fb3073d2
commit
d90ef540f9
@ -54,7 +54,10 @@ export class AudioManager {
|
||||
|
||||
constructor() {
|
||||
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) => {
|
||||
|
||||
@ -5,11 +5,6 @@ export interface OlympusConfig {
|
||||
/* Set by user */
|
||||
frontend: {
|
||||
port: number;
|
||||
customAuthHeaders: {
|
||||
enabled: boolean;
|
||||
username: string;
|
||||
group: string;
|
||||
};
|
||||
elevationProvider: {
|
||||
provider: string;
|
||||
username: string | null;
|
||||
@ -26,23 +21,30 @@ export interface OlympusConfig {
|
||||
mapMirrors: {
|
||||
[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;
|
||||
WSPort?: number;
|
||||
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 };
|
||||
authentication?: {
|
||||
|
||||
/* Set by server */
|
||||
local?: boolean;
|
||||
authentication?: { // Only sent when in localhost mode for autologin
|
||||
gameMasterPassword: string;
|
||||
blueCommanderPasword: string;
|
||||
redCommanderPassword: string;
|
||||
};
|
||||
|
||||
/* Set by server */
|
||||
local: boolean;
|
||||
}
|
||||
|
||||
export interface SessionData {
|
||||
|
||||
@ -172,7 +172,7 @@ export class OlympusApp {
|
||||
})
|
||||
.then(([result, headers]) => {
|
||||
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)) {
|
||||
this.getServerManager().setUsername(headers.get(this.#config.frontend.customAuthHeaders.username));
|
||||
this.setState(OlympusState.LOGIN, LoginSubState.COMMAND_MODE);
|
||||
|
||||
@ -186,8 +186,12 @@ class DCSInstance {
|
||||
this.backendPort = config["backend"]["port"];
|
||||
this.backendAddress = config["backend"]["address"];
|
||||
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.blueCommanderPasswordEdited = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user