From 57b276e136b7afcde6b59e38eedc3fad36387282 Mon Sep 17 00:00:00 2001 From: NoobishSVK Date: Sat, 4 May 2024 00:36:49 +0200 Subject: [PATCH] bugfixes, design changes --- package.json | 2 +- server/datahandler.js | 4 ++ server/fmdx_list.js | 2 +- web/css/helpers.css | 4 ++ web/css/main.css | 14 +++--- web/index.ejs | 105 +++++++++++++++++++++++++----------------- web/js/chat.js | 2 +- web/js/dropdown.js | 7 ++- web/js/init.js | 4 +- web/js/main.js | 21 ++++++++- web/setup.ejs | 6 +-- web/wizard.ejs | 4 +- 12 files changed, 114 insertions(+), 61 deletions(-) diff --git a/package.json b/package.json index ad308c0..266673a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fm-dx-webserver", - "version": "1.2.0", + "version": "1.2.1", "description": "FM DX Webserver", "main": "index.js", "scripts": { diff --git a/server/datahandler.js b/server/datahandler.js index 96029ee..43e950f 100644 --- a/server/datahandler.js +++ b/server/datahandler.js @@ -261,6 +261,10 @@ function handleData(ws, receivedData) { for (const receivedLine of receivedLines) { switch (true) { + case receivedLine.startsWith('F'): // Bandwidth + initialData.bw = receivedLine.substring(1); + dataToSend.bw = receivedLine.substring(1); + break; case receivedLine.startsWith('P'): // PI Code modifiedData = receivedLine.slice(1); legacyRdsPiBuffer = modifiedData; diff --git a/server/fmdx_list.js b/server/fmdx_list.js index f422eba..977d7ea 100644 --- a/server/fmdx_list.js +++ b/server/fmdx_list.js @@ -67,7 +67,7 @@ function sendUpdate() { } const request = { - status: (serverConfig.lockToAdmin ? 2 : 1), + status: ((serverConfig.lockToAdmin == 'true' || serverConfig.publicTuner == 'false') ? 2 : 1), coords: [serverConfig.identification.lat, serverConfig.identification.lon], name: serverConfig.identification.tunerName, desc: serverConfig.identification.tunerDesc, diff --git a/web/css/helpers.css b/web/css/helpers.css index caa0ae3..701c78b 100644 --- a/web/css/helpers.css +++ b/web/css/helpers.css @@ -190,6 +190,10 @@ padding: 10px; } +.p-left-10 { + padding-left: 10px; +} + .p-bottom-20 { padding-bottom: 20px; } diff --git a/web/css/main.css b/web/css/main.css index df73890..f1bb68c 100644 --- a/web/css/main.css +++ b/web/css/main.css @@ -81,38 +81,38 @@ hr { color: var(--color-4); } -table { +.table-big { border-radius: 30px; background-color: var(--color-2); padding: 20px; margin: auto; } -table th { +.table-big th { padding: 8px 20px; outline: 1px solid var(--color-3); background-color: var(--color-3); } -table td { +.table-big td { padding: 8px 20px; } -table td:nth-child(1) { +.table-big td:nth-child(1) { text-align: left; } -table td:nth-child(2) { +.table-big td:nth-child(2) { color: var(--color-main-bright); text-align: left; } -table th:nth-child(1) { +.table-big th:nth-child(1) { border-radius: 30px 0px 0px 30px; } -table th:nth-last-child(1){ +.table-big th:nth-last-child(1){ border-radius: 0px 30px 30px 0px; } diff --git a/web/index.ejs b/web/index.ejs index 6b37885..fa47a86 100644 --- a/web/index.ejs +++ b/web/index.ejs @@ -188,35 +188,35 @@ <% } %> @@ -401,20 +401,42 @@ <% } %>
- -

Time

-

Server:

-

Local:

- -

-
-

FM-DX WebServer
by Noobish, kkonradpl & the OpenRadio community.

+
- <% if (device == 'tef') { %>

Device: TEF668x

<% } %> - <% if (device == 'xdr') { %>

Device: Sony XDR

<% } %> - <% if (device == 'sdr') { %>

Device: SDR

<% } %> -
+ + + + + + + + + + + + + +
Device: + <% if (device == 'tef') { %>TEF668x<% } %> + <% if (device == 'xdr') { %>Sony XDR<% } %> + <% if (device == 'sdr') { %>SDR<% } %> +
Server Time:
Local Time:
+ + + + + + + + +
P1: 87.5P2: P3: P4:
+ +
+

+ FM-DX Webserver +

+

by Noobish, kkonradpl & the OpenRadio community.

[Receiver Map]

@@ -422,6 +444,7 @@ Owner contact:
<%= ownerContact %> <% } %> +

diff --git a/web/js/chat.js b/web/js/chat.js index a2e5358..c076ef3 100644 --- a/web/js/chat.js +++ b/web/js/chat.js @@ -14,7 +14,7 @@ $(document).ready(function() { const isAdmin = messageData.admin ? '[ADMIN]' : ''; if (messageData.type === 'clientIp') { - chatIdentityNickname.html(isAdmin + " " + (savedNickname.length > 0 ? savedNickname : 'Anonymous User')); + chatIdentityNickname.html(isAdmin + " " + (savedNickname?.length > 0 ? savedNickname : 'Anonymous User')); chatIdentityNickname.attr('title', messageData.ip); } else { const chatMessage = ` diff --git a/web/js/dropdown.js b/web/js/dropdown.js index 0be1700..b4ac1ba 100644 --- a/web/js/dropdown.js +++ b/web/js/dropdown.js @@ -25,7 +25,12 @@ const selectOption = (event) => { tuneTo(getCurrentFreq()); //Reset RDS when change antenna input break; case 'data-bw': - socket.send("W" + $(event.currentTarget).attr('data-value')); + if($(event.currentTarget).attr('data-value') > 500) { + socket.send("F" + $(event.currentTarget).attr('data-value')); + } else { + socket.send("W" + $(event.currentTarget).attr('data-value')); + } + $currentDropdown.find('input').val($(event.currentTarget).text()); break; default: diff --git a/web/js/init.js b/web/js/init.js index 80abd8c..beaaf40 100644 --- a/web/js/init.js +++ b/web/js/init.js @@ -1,9 +1,9 @@ -var currentDate = new Date('April 25, 2024 22:00:00'); +var currentDate = new Date('May 4, 2024 01: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.2.0 [' + formattedDate + ']'; +var currentVersion = 'v1.2.1 [' + formattedDate + ']'; getInitialSettings(); diff --git a/web/js/main.js b/web/js/main.js index 36870fa..fb150f2 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -49,6 +49,7 @@ $(document).ready(function () { // Start updating the canvas initCanvas(); + fillPresets(); signalToggle.on("change", function () { const signalText = localStorage.getItem('signalUnit'); @@ -150,6 +151,10 @@ $(document).ready(function () { toggleButtonState("ims"); }); + $("#volumeSlider").on('mouseup', function() { + $('#volumeSlider').blur(); + }) + $(freqUpButton).on("click", tuneUp); $(freqDownButton).on("click", tuneDown); $(psContainer).on("click", copyPs); @@ -421,11 +426,13 @@ function getCurrentFreq() { function checkKey(e) { e = e || window.event; - if ($('#password:focus').length > 0 || $('#chat-send-message:focus').length > 0) { + if ($('#password:focus').length > 0 + || $('#chat-send-message:focus').length > 0 + || $('#volumeSlider:focus').length > 0 + || $('#chat-nickname:focus').length > 0) { return; } - $('#volumeSlider').blur(); getCurrentFreq(); if (socket.readyState === WebSocket.OPEN) { @@ -893,3 +900,13 @@ function initTooltips() { $('.tooltiptext').css({ top: posY, left: posX }); }); } + +function fillPresets() { + for (let i = 1; i <= 4; i++) { + let presetText = localStorage.getItem(`preset${i}`); + $(`#preset${i}`).text(presetText); + $(`#preset${i}`).click(function() { + tuneTo(Number(presetText)); + }); + } +} diff --git a/web/setup.ejs b/web/setup.ejs index 4e7029d..c68a6bb 100644 --- a/web/setup.ejs +++ b/web/setup.ejs @@ -54,7 +54,7 @@

Current users

- +
@@ -131,8 +131,8 @@ - USB Cable - Wireless + Direct + TCP/IP diff --git a/web/wizard.ejs b/web/wizard.ejs index 7c4bf85..9639c16 100644 --- a/web/wizard.ejs +++ b/web/wizard.ejs @@ -72,8 +72,8 @@ - USB Cable - Wireless + Direct + TCP/IP
IP Address