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:
parent
16e77087f5
commit
42cfb36c04
@ -2,6 +2,7 @@ import { LatLng } from "leaflet";
|
||||
import { Coalition, MapOptions } from "./types/types";
|
||||
|
||||
export interface OlympusConfig {
|
||||
/* Set by user */
|
||||
frontend: {
|
||||
port: number;
|
||||
customAuthHeaders: {
|
||||
@ -33,13 +34,15 @@ export interface OlympusConfig {
|
||||
WSEndpoint?: string;
|
||||
};
|
||||
controllers: [{ type: string; coalition: Coalition; frequency: number; modulation: number; callsign: string }];
|
||||
local: boolean;
|
||||
profiles?: { [key: string]: ProfileOptions };
|
||||
authentication?: {
|
||||
gameMasterPassword: string;
|
||||
blueCommanderPasword: string;
|
||||
redCommanderPassword: string;
|
||||
};
|
||||
|
||||
/* Set by server */
|
||||
local: boolean;
|
||||
}
|
||||
|
||||
export interface SessionData {
|
||||
|
||||
@ -80,6 +80,13 @@
|
||||
title="Install the camera control plugin, which allows direct control of the DCS camera from Olympus. It is necessary even to control the camera even if Olympus is being used remotely using a browser.">
|
||||
</span>
|
||||
</div>
|
||||
<div class="input-group autoconnect">
|
||||
<span onclick="signal('onEnableAutoconnectClicked')">
|
||||
<div class="checkbox"></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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -36,5 +36,12 @@
|
||||
<div class="<%= state !== 'INSTALL'? '': 'hide' %>" style="color: var(--offwhite); font-size: var(--normal); color: var(--lightgray);">
|
||||
Note: to keep the old passwords, click <b>Next</b> without editing any value.
|
||||
</div>
|
||||
<div class="input-group autoconnect">
|
||||
<span onclick="signal('onEnableAutoconnectClicked')">
|
||||
<div class="checkbox 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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user