1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 22:13:53 +01:00

tunnel support, imperial units, admin ui bugfixes

This commit is contained in:
NoobishSVK
2024-09-26 15:07:40 +02:00
parent e0c085b789
commit 431dc7cedf
9 changed files with 124 additions and 64 deletions

View File

@@ -80,6 +80,10 @@ function submitData() {
const fmlistIntegration = $("#fmlist-integration").is(":checked") || false;
const fmlistOmid = $('#fmlist-omid').val();
const tunnelUsername = $('#tunnel-username').val();
const tunnelSubdomain = $('#tunnel-subdomain').val();
const tunnelToken = $('#tunnel-token').val();
const publicTuner = $("#tuner-public").is(":checked");
const lockToAdmin = $("#tuner-lock").is(":checked");
const autoShutdown = $("#shutdown-tuner").is(":checked") || false;
@@ -150,6 +154,13 @@ function submitData() {
fmlistIntegration,
fmlistOmid,
},
tunnel: {
enabled: tunnelEnabled,
username: tunnelUsername,
token: tunnelToken,
lowLatencyMode: tunnelLowLatency,
subdomain: tunnelSubdomain,
},
plugins,
device,
publicTuner,
@@ -315,8 +326,15 @@ function submitData() {
}
}
$("#fmlist-integration").prop("checked", data.extras ? data.extras?.fmlistIntegration : "true");
$("#fmlist-integration").prop("checked", !!(data.extras && data.extras?.fmlistIntegration));
$('#fmlist-omid').val(data.extras?.fmlistOmid);
$("#tunnel-enable").prop("checked", !!(data.tunnel && data.tunnel?.enabled));
$("#tunnel-lowlatency").prop("checked", !!(data.tunnel && data.tunnel?.lowLatencyMode));
console.log((data.tunnel && data.tunnel?.enabled) ? data.tunnel?.enabled : "false");
$('#tunnel-token').val(data.tunnel?.token);
$('#tunnel-subdomain').val(data.tunnel?.subdomain);
$('#tunnel-username').val(data.tunnel?.username);
})
.catch(error => {
console.error('Error fetching data:', error.message);

View File

@@ -1,9 +1,9 @@
var currentDate = new Date('Sep 15, 2024 15:00:00');
var currentDate = new Date('Sep 26, 2024 12:00:00');
var day = currentDate.getDate();
var month = currentDate.getMonth() + 1; // Months are zero-indexed, so add 1
var year = currentDate.getFullYear();
var formattedDate = day + '/' + month + '/' + year;
var currentVersion = 'v1.3.0.1 [' + formattedDate + ']';
var currentVersion = 'v1.3.1 [' + formattedDate + ']';
getInitialSettings();
removeUrlParameters(); // Call this function to remove URL parameters

View File

@@ -676,7 +676,7 @@ async function copyTx() {
const stationErp = $('#data-station-erp').text();
try {
await copyToClipboard(frequency + " - " + pi + " | " + stationName + " [" + stationCity + ", " + stationItu + "] - " + stationDistance + " km | " + stationErp + " kW");
await copyToClipboard(frequency + " - " + pi + " | " + stationName + " [" + stationCity + ", " + stationItu + "] - " + stationDistance + " | " + stationErp + " kW");
} catch (error) {
console.error(error);
}
@@ -878,8 +878,9 @@ const updateDataElements = throttle(function(parsedData) {
updateTextIfChanged($('#data-station-city'), parsedData.txInfo.city);
updateTextIfChanged($('#data-station-itu'), parsedData.txInfo.itu);
updateTextIfChanged($('#data-station-pol'), parsedData.txInfo.pol);
updateTextIfChanged($('#data-station-distance'), parsedData.txInfo.dist);
updateHtmlIfChanged($('#data-station-azimuth'), parsedData.txInfo.azi + '°');
const txDistance = localStorage.getItem('imperialUnits') == "true" ? (Number(parsedData.txInfo.dist) * 0.621371192).toFixed(0) + " mi" : parsedData.txInfo.dist + " km";
updateTextIfChanged($('#data-station-distance'), txDistance);
$dataStationContainer.css('display', 'block');
} else {
$dataStationContainer.removeAttr('style');

View File

@@ -102,7 +102,6 @@ $(document).ready(() => {
$('.logout-link').click(function (event) {
event.preventDefault();
// Perform an AJAX request to the /logout endpoint
$.ajax({
type: 'GET', // Assuming the logout is a GET request, adjust accordingly
url: './logout',
@@ -148,9 +147,19 @@ $(document).ready(() => {
$("#ps-underscores").change(function() {
var isChecked = $(this).is(":checked");
console.log(isChecked);
localStorage.setItem("psUnderscores", isChecked);
});
var imperialUnits = localStorage.getItem("imperialUnits");
if (imperialUnits) {
$("#imperial-units").prop("checked", JSON.parse(imperialUnits));
localStorage.setItem("imperialUnits", imperialUnits);
}
$("#imperial-units").change(function() {
var isChecked = $(this).is(":checked");
localStorage.setItem("imperialUnits", isChecked);
});
$('.version-string').text(currentVersion);