fix: Fixed manager not respecting autoconnectwhentrue and srsport settings

This commit is contained in:
Davide Passoni
2025-03-26 11:40:02 +01:00
parent 3d61b7e1a7
commit 49990e01ee
8 changed files with 102 additions and 62 deletions

View File

@@ -53,7 +53,7 @@
</div>
<div class="input-group autoconnect">
<span onclick="signal('onEnableAutoconnectClicked')">
<div class="checkbox <%= activeInstance['installationType'] === 'multiplayer'? '': 'checked' %>"></div> Autoconnect when local
<div class="checkbox <%= activeInstance['autoconnectWhenLocal'] ? 'checked': '' %>"></div> Autoconnect when local
<img src="./icons/circle-info-solid.svg"
title="Autoconnect as Game Master when running Olympus on the same computer as DCS.">
</span>

View File

@@ -192,7 +192,7 @@ class DCSInstance {
/* 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)
if (config["audio"] !== undefined && config["audio"]["SRSPort"] !== undefined)
this.SRSPort = config["audio"]["SRSPort"];
this.gameMasterPasswordEdited = false;

View File

@@ -175,8 +175,10 @@ class Manager {
/* Reset default radio buttons */
this.typePage.options.onShow = () => {
if (this.getActiveInstance())
if (this.getActiveInstance()) {
this.getActiveInstance().installationType = 'singleplayer';
this.getActiveInstance().autoconnectWhenLocal = true;
}
else {
showErrorPopup(`<div class='main-message'>A critical error occurred! </div><div class='sub-message'> Check ${this.getLogLocation()} for more info. </div>`);
}
@@ -335,7 +337,7 @@ class Manager {
this.typePage.getElement().querySelector(`.multiplayer`).classList.toggle("selected", type === 'multiplayer');
if (this.getActiveInstance()) {
this.getActiveInstance().installationType = type;
this.getActiveInstance().autoconnectWhenLocal = type === 'singleplayer';
this.getActiveInstance().autoconnectWhenLocal = (type === 'singleplayer');
}
else {
showErrorPopup(`<div class='main-message'>A critical error occurred! </div><div class='sub-message'> Check ${this.getLogLocation()} for more info. </div>`);
@@ -570,7 +572,11 @@ class Manager {
} else {
this.getActiveInstance().autoconnectWhenLocal = true;
}
this.expertSettingsPage.getElement().querySelector(".autoconnect .checkbox").classList.toggle("checked", this.getActiveInstance().autoconnectWhenLocal)
if (this.getMode() === 'basic') {
this.passwordsPage.getElement().querySelector(".autoconnect .checkbox").classList.toggle("checked", this.getActiveInstance().autoconnectWhenLocal);
} else {
this.expertSettingsPage.getElement().querySelector(".autoconnect .checkbox").classList.toggle("checked", this.getActiveInstance().autoconnectWhenLocal);
}
} else {
showErrorPopup(`<div class='main-message'>A critical error occurred! </div><div class='sub-message'> Check ${this.getLogLocation()} for more info. </div>`)
}