mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added checkbox for autoconnection when local
This commit is contained in:
@@ -149,6 +149,7 @@ class DCSInstance {
|
||||
gameMasterPasswordEdited = false;
|
||||
blueCommanderPasswordEdited = false;
|
||||
redCommanderPasswordEdited = false;
|
||||
autoconnectWhenLocal = false;
|
||||
|
||||
constructor(folder) {
|
||||
this.folder = folder;
|
||||
@@ -184,6 +185,7 @@ class DCSInstance {
|
||||
this.backendPort = config["backend"]["port"];
|
||||
this.backendAddress = config["backend"]["address"];
|
||||
this.gameMasterPasswordHash = config["authentication"]["gameMasterPassword"];
|
||||
this.autoconnectWhenLocal = config["frontend"]["autoconnectWhenLocal"];
|
||||
|
||||
this.gameMasterPasswordEdited = false;
|
||||
this.blueCommanderPasswordEdited = false;
|
||||
|
||||
@@ -161,6 +161,7 @@ async function applyConfiguration(folder, instance) {
|
||||
|
||||
/* Apply the configuration */
|
||||
config["frontend"]["port"] = instance.frontendPort;
|
||||
config["frontend"]["autoconnectWhenLocal"] = instance.autoconnectWhenLocal;
|
||||
config["backend"]["port"] = instance.backendPort;
|
||||
config["backend"]["address"] = instance.backendAddress;
|
||||
|
||||
|
||||
@@ -332,8 +332,10 @@ class Manager {
|
||||
async onInstallTypeClicked(type) {
|
||||
this.typePage.getElement().querySelector(`.singleplayer`).classList.toggle("selected", type === 'singleplayer');
|
||||
this.typePage.getElement().querySelector(`.multiplayer`).classList.toggle("selected", type === 'multiplayer');
|
||||
if (this.getActiveInstance())
|
||||
if (this.getActiveInstance()) {
|
||||
this.getActiveInstance().installationType = type;
|
||||
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>`);
|
||||
}
|
||||
@@ -399,6 +401,7 @@ class Manager {
|
||||
this.activePage.hide();
|
||||
this.connectionsPage.show();
|
||||
(this.getMode() === 'basic' ? this.connectionsPage : this.expertSettingsPage).getElement().querySelector(".backend-address .checkbox").classList.toggle("checked", this.getActiveInstance().backendAddress === '*')
|
||||
(this.getMode() === 'basic' ? this.passwordsPage : 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>`)
|
||||
@@ -547,6 +550,19 @@ class Manager {
|
||||
}
|
||||
}
|
||||
|
||||
async onEnableAutoconnectClicked() {
|
||||
if (this.getActiveInstance()) {
|
||||
if (this.getActiveInstance().autoconnectWhenLocal) {
|
||||
this.getActiveInstance().autoconnectWhenLocal = false;
|
||||
} else {
|
||||
this.getActiveInstance().autoconnectWhenLocal = true;
|
||||
}
|
||||
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>`)
|
||||
}
|
||||
}
|
||||
|
||||
/* When the "Return to manager" button is pressed */
|
||||
async onReturnClicked() {
|
||||
await this.reload();
|
||||
|
||||
Reference in New Issue
Block a user