diff --git a/.gitignore b/.gitignore index aa29cb0..eb22715 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules/ /*.json /serverlog.txt /web/js/plugins/ +/libraries/** /plugins/* !/plugins/example/frontend.js !/plugins/example.js \ No newline at end of file diff --git a/package.json b/package.json index e84400e..def6567 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fm-dx-webserver", - "version": "1.3.0.1", + "version": "1.3.1", "description": "FM DX Webserver", "main": "index.js", "scripts": { diff --git a/web/css/dropdown.css b/web/css/dropdown.css index b527652..f6eef26 100644 --- a/web/css/dropdown.css +++ b/web/css/dropdown.css @@ -3,7 +3,7 @@ height: 48px; background: var(--color-4); position: relative; - margin-right: 20px; + margin: auto; border-radius: 15px; /*border-bottom: 4px solid var(--color-2);*/ } @@ -34,7 +34,7 @@ .dropdown input { width: 100%; height: 100%; - padding: 10px; + padding: 10px 20px 10px 10px; cursor: pointer; border: none; user-select: none; diff --git a/web/index.ejs b/web/index.ejs index 6736dd1..0a885c7 100644 --- a/web/index.ejs +++ b/web/index.ejs @@ -92,7 +92,7 @@
-

PI CODE

+

PI CODE

 
@@ -139,7 +139,7 @@ <% } %>
- <% if (device == 'tef') { %><% } %> + <% if (device == 'tef') { %><% } %> <% if (device == 'xdr') { %><% } %>
@@ -165,21 +165,21 @@
  • Auto
  • -
  • 56 KHz
  • -
  • 64 KHz
  • -
  • 72 KHz
  • -
  • 84 KHz
  • -
  • 97 KHz
  • -
  • 114 KHz
  • -
  • 133 KHz
  • -
  • 151 KHz
  • -
  • 184 KHz
  • -
  • 200 KHz
  • -
  • 217 KHz
  • -
  • 236 KHz
  • -
  • 254 KHz
  • -
  • 287 KHz
  • -
  • 311 KHz
  • +
  • 56 kHz
  • +
  • 64 kHz
  • +
  • 72 kHz
  • +
  • 84 kHz
  • +
  • 97 kHz
  • +
  • 114 kHz
  • +
  • 133 kHz
  • +
  • 151 kHz
  • +
  • 184 kHz
  • +
  • 200 kHz
  • +
  • 217 kHz
  • +
  • 236 kHz
  • +
  • 254 kHz
  • +
  • 287 kHz
  • +
  • 311 kHz
<% } %> @@ -189,22 +189,22 @@
<% } %> @@ -214,19 +214,19 @@
<% } %> @@ -260,7 +260,7 @@ [] - kW [] km + kW [] @@ -362,6 +362,10 @@ +
+ + +
@@ -461,7 +465,7 @@ Support the developer!
- Join our OpenRadio Discord community! + Join our FMDX.org Discord community!
diff --git a/web/js/confighandler.js b/web/js/confighandler.js index 481cf4e..66dfcd4 100644 --- a/web/js/confighandler.js +++ b/web/js/confighandler.js @@ -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); diff --git a/web/js/init.js b/web/js/init.js index 1ca3395..e65497b 100644 --- a/web/js/init.js +++ b/web/js/init.js @@ -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 diff --git a/web/js/main.js b/web/js/main.js index f9463b0..0e68981 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -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'); diff --git a/web/js/settings.js b/web/js/settings.js index 882c2ee..fd70beb 100644 --- a/web/js/settings.js +++ b/web/js/settings.js @@ -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); diff --git a/web/setup.ejs b/web/setup.ejs index fad5ac0..1391a9a 100644 --- a/web/setup.ejs +++ b/web/setup.ejs @@ -83,7 +83,7 @@
-
+

Current users

@@ -164,7 +164,7 @@ This is where your tuner is plugged in.

-