feat: added ability to change and check SRS port in manager

This commit is contained in:
Davide Passoni 2025-03-07 16:14:42 +01:00
parent 42cfb36c04
commit be879e3660
6 changed files with 32 additions and 0 deletions

View File

@ -44,6 +44,16 @@
</div>
</div>
</div>
<div class="input-group srs-port port-input">
<span>SRS port
<img src="./icons/circle-info-solid.svg"
title="This port is used by Olympus to communicate with SRS server. Unless you run multiple servers, the default value should be ok, otherwise edit it to be equal to your SRS server port.">
</span>
<div>
<input type="number" min="1024" max="65535" value="<%= activeInstance["SRSPort"] %>"
onchange="signal('onSRSPortChanged', this.value)">
</div>
</div>
<div class="input-group backend-address">
<span onclick="signal('onEnableAPIClicked')">
<div class="checkbox"></div> Enable direct backend API connection

View File

@ -66,6 +66,16 @@
</div>
</div>
</div>
<div class="input-group srs-port port-input">
<span>SRS port
<img src="./icons/circle-info-solid.svg"
title="This port is used by Olympus to communicate with SRS server. Unless you run multiple servers, the default value should be ok, otherwise edit it to be equal to your SRS server port.">
</span>
<div>
<input type="number" min="1024" max="65535" value="<%= activeInstance["SRSPort"] %>"
onchange="signal('onSRSPortChanged', this.value)">
</div>
</div>
<div class="input-group backend-address">
<span onclick="signal('onEnableAPIClicked')">
<div class="checkbox"></div> Enable direct backend API connection

View File

@ -92,6 +92,10 @@
<div>Backend address</div>
<div> <%= instances[i].installed? instances[i].backendAddress: "N/A" %> </div>
</div>
<div class="info">
<div>SRS port</div>
<div> <%= instances[i].installed? instances[i].SRSPort: "N/A" %> </div>
</div>
</div>
</div>
<div class="instance-buttons">

View File

@ -150,6 +150,7 @@ class DCSInstance {
blueCommanderPasswordEdited = false;
redCommanderPasswordEdited = false;
autoconnectWhenLocal = false;
SRSPort = 5002;
constructor(folder) {
this.folder = folder;
@ -186,6 +187,7 @@ class DCSInstance {
this.backendAddress = config["backend"]["address"];
this.gameMasterPasswordHash = config["authentication"]["gameMasterPassword"];
this.autoconnectWhenLocal = config["frontend"]["autoconnectWhenLocal"];
this.SRSPort = config["audio"]["SRSPort"];
this.gameMasterPasswordEdited = false;
this.blueCommanderPasswordEdited = false;

View File

@ -164,6 +164,7 @@ async function applyConfiguration(folder, instance) {
config["frontend"]["autoconnectWhenLocal"] = instance.autoconnectWhenLocal;
config["backend"]["port"] = instance.backendPort;
config["backend"]["address"] = instance.backendAddress;
config["audio"]["SRSPort"] = instance.SRSPort;
if (instance.gameMasterPassword !== "")
config["authentication"]["gameMasterPassword"] = sha256(instance.gameMasterPassword);

View File

@ -517,6 +517,11 @@ class Manager {
this.setPort('backend', Number(value));
}
/* When the srs port input value is changed */
async onSRSPortChanged(value) {
this.getActiveInstance().SRSPort = Number(value);
}
/* When the "Enable API connection" checkbox is clicked */
async onEnableAPIClicked() {
if (this.getActiveInstance()) {