mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-07-30 16:59:15 +02:00
credit?
This commit is contained in:
+6
-6
@@ -26,7 +26,7 @@ const pluginsApi = require('./plugins_api');
|
|||||||
const pjson = require('../package.json');
|
const pjson = require('../package.json');
|
||||||
|
|
||||||
const client = new net.Socket();
|
const client = new net.Socket();
|
||||||
const wss = new WebSocket.Server({ noServer: true, perMessageDeflate: true });
|
const wss = new WebSocket.Server({ noServer: true });
|
||||||
const rdsWss = new WebSocket.Server({ noServer: true });
|
const rdsWss = new WebSocket.Server({ noServer: true });
|
||||||
const pluginsWss = new WebSocket.Server({ noServer: true, perMessageDeflate: true });
|
const pluginsWss = new WebSocket.Server({ noServer: true, perMessageDeflate: true });
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ const terminalWidth = readline.createInterface({
|
|||||||
}).output.columns;
|
}).output.columns;
|
||||||
|
|
||||||
console.log('\x1b[32m' + figlet.textSync("FM-DX Webserver"));
|
console.log('\x1b[32m' + figlet.textSync("FM-DX Webserver"));
|
||||||
console.log('\x1b[32m\x1b[2mby Noobish @ \x1b[4mFMDX.org\x1b[0m');
|
console.log('\x1b[32m\x1b[2mby Noobish @ \x1b[4mFMDX.org + KubaPro010\x1b[0m');
|
||||||
console.log("v" + pjson.version)
|
console.log("v" + pjson.version)
|
||||||
console.log('\x1b[90m' + '─'.repeat(terminalWidth - 1) + '\x1b[0m');
|
console.log('\x1b[90m' + '─'.repeat(terminalWidth - 1) + '\x1b[0m');
|
||||||
|
|
||||||
@@ -458,10 +458,10 @@ wss.on('connection', (ws, request) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tunerLockTracker.has(ws)) {
|
if (tunerLockTracker.has(ws)) {
|
||||||
logInfo(`User who locked the tuner left. Unlocking the tuner.`);
|
logInfo(`User who locked the tuner left. Unlocking the tuner.`);
|
||||||
output.write('wT0\n')
|
output.write('wT0\n')
|
||||||
tunerLockTracker.delete(ws);
|
tunerLockTracker.delete(ws);
|
||||||
serverConfig.publicTuner = true;
|
serverConfig.publicTuner = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentUsers === 0 && serverConfig.enableDefaultFreq === true &&
|
if (currentUsers === 0 && serverConfig.enableDefaultFreq === true &&
|
||||||
|
|||||||
+10
-10
@@ -182,7 +182,7 @@ function getStateForCoordinates(lat, lon) {
|
|||||||
*/
|
*/
|
||||||
function validPsCompare(rdsPs, stationPs) {
|
function validPsCompare(rdsPs, stationPs) {
|
||||||
if (typeof stationPs !== 'string' || typeof rdsPs !== 'string') {
|
if (typeof stationPs !== 'string' || typeof rdsPs !== 'string') {
|
||||||
consoleCmd.logError(`Invalid TX values. stationPs: ${stationPs}, rdsPs: ${rdsPs}`);
|
consoleCmd.logDebug(`Invalid TX values. stationPs: ${stationPs}, rdsPs: ${rdsPs}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,15 +257,6 @@ async function fetchTx(freq, piCode, rdsPs) {
|
|||||||
stations: [station]
|
stations: [station]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (filteredLocations.length > 1) {
|
|
||||||
const extraFilteredLocations = filteredLocations.map(locData => ({
|
|
||||||
...locData,
|
|
||||||
stations: locData.stations.filter(station => (station.ps.toLowerCase() === rdsPs.replace(/ /g, '_').toLowerCase()))
|
|
||||||
})).filter(locData => locData.stations.length > 0);
|
|
||||||
|
|
||||||
if (extraFilteredLocations.length > 0) filteredLocations = extraFilteredLocations;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only check PS if we have more than one match.
|
// Only check PS if we have more than one match.
|
||||||
if (filteredLocations.length > 1) {
|
if (filteredLocations.length > 1) {
|
||||||
filteredLocations = filteredLocations.map(locData => ({
|
filteredLocations = filteredLocations.map(locData => ({
|
||||||
@@ -274,6 +265,15 @@ async function fetchTx(freq, piCode, rdsPs) {
|
|||||||
})).filter(locData => locData.stations.length > 0);
|
})).filter(locData => locData.stations.length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filteredLocations.length > 1) {
|
||||||
|
const extraFilteredLocations = filteredLocations.map(locData => ({
|
||||||
|
...locData,
|
||||||
|
stations: locData.stations.filter(station => (station.ps?.toLowerCase() === rdsPs.replace(/ /g, '_').toLowerCase()))
|
||||||
|
})).filter(locData => locData.stations.length > 0);
|
||||||
|
|
||||||
|
if (extraFilteredLocations.length > 0) filteredLocations = extraFilteredLocations;
|
||||||
|
}
|
||||||
|
|
||||||
for (let loc of filteredLocations) {
|
for (let loc of filteredLocations) {
|
||||||
loc = Object.assign(loc, loc.stations[0]);
|
loc = Object.assign(loc, loc.stations[0]);
|
||||||
delete loc.stations;
|
delete loc.stations;
|
||||||
|
|||||||
Reference in New Issue
Block a user