diff --git a/package.json b/package.json index 266673a..aee9f75 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fm-dx-webserver", - "version": "1.2.1", + "version": "1.2.2", "description": "FM DX Webserver", "main": "index.js", "scripts": { diff --git a/server/endpoints.js b/server/endpoints.js index 758e41a..2a588b6 100644 --- a/server/endpoints.js +++ b/server/endpoints.js @@ -160,6 +160,7 @@ router.get('/logout', (req, res) => { router.get('/kick', (req, res) => { const ipAddress = req.query.ip; // Extract the IP address parameter from the query string // Terminate the WebSocket connection for the specified IP address + console.log(ipAddress); if(req.session.isAdminAuthenticated) { helpers.kickClient(ipAddress); } diff --git a/server/helpers.js b/server/helpers.js index 6c27aa9..8709173 100644 --- a/server/helpers.js +++ b/server/helpers.js @@ -84,6 +84,7 @@ function resolveDataBuffer(data, wss) { function kickClient(ipAddress) { // Find the entry in connectedClients associated with the provided IP address const targetClient = storage.connectedUsers.find(client => client.ip === ipAddress); + console.log(storage.connectedUsers); if (targetClient && targetClient.instance) { // Send a termination message to the client targetClient.instance.send('KICK'); diff --git a/server/index.js b/server/index.js index 782abb1..c803fe5 100644 --- a/server/index.js +++ b/server/index.js @@ -259,7 +259,7 @@ wss.on('connection', (ws, request) => { logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]\x1b[0m`); } else { const userLocation = `${locationInfo.city}, ${locationInfo.region}, ${locationInfo.country}`; - const userData = { ip: clientIp, location: userLocation, time: connectionTime }; + const userData = { ip: clientIp, location: userLocation, time: connectionTime, instance: ws }; storage.connectedUsers.push(userData); logInfo(`Web client \x1b[32mconnected\x1b[0m (${clientIp}) \x1b[90m[${currentUsers}]\x1b[0m Location: ${locationInfo.city}, ${locationInfo.region}, ${locationInfo.country}`); } @@ -338,6 +338,10 @@ wss.on('connection', (ws, request) => { storage.connectedUsers.splice(index, 1); // Remove the user's data from storage.connectedUsers array } + if(currentUsers === 0) { + storage.connectedUsers = []; + } + if (currentUsers === 0 && serverConfig.enableDefaultFreq === true && serverConfig.autoShutdown !== true && serverConfig.xdrd.wirelessConnection === true) { setTimeout(function() { if(currentUsers === 0) { diff --git a/web/css/panels.css b/web/css/panels.css index 0993861..455dff4 100644 --- a/web/css/panels.css +++ b/web/css/panels.css @@ -29,13 +29,10 @@ width: 88%; } - .panel-100 { width: 98%; } - - @media only screen and (max-width: 768px) { .panel-75 { width: 90%; diff --git a/web/index.ejs b/web/index.ejs index fa47a86..b8ef67b 100644 --- a/web/index.ejs +++ b/web/index.ejs @@ -39,8 +39,8 @@

<%= tunerName %> - <% if (!publicTuner) { %> - <% } if (tunerLock) { %> + <% if (!publicTuner) { %> + <% } if (tunerLock) { %> <% } %>

@@ -60,7 +60,7 @@

- +
@@ -143,9 +143,9 @@
- + - +
@@ -163,7 +163,7 @@ @@ -469,7 +469,7 @@
-
-
+

Dashboard

-
+

Connection settings

You can set up your connection settings here. Changing these settings requires a server restart.

Tuner connection:

@@ -182,7 +198,7 @@
-
+

Audio settings

You can set up your audio settings here. Changing these settings requires a server restart.

@@ -244,7 +260,7 @@
-
+

Webserver settings

@@ -403,7 +419,7 @@
-
+

Plugins

Any compatible .js plugin, which is in the "plugins" folder, will be listed here.
Click on the individual plugins to enable/disable them.

@@ -418,7 +434,7 @@
-
+

Tuner Specific Settings

@@ -449,7 +465,7 @@
-
+

Identification & Map