You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
mobile panel, UI bugfixes, security improvements
This commit is contained in:
@@ -62,7 +62,7 @@ router.get('/', (req, res) => {
|
||||
tunerLock: serverConfig.lockToAdmin,
|
||||
publicTuner: serverConfig.publicTuner,
|
||||
ownerContact: serverConfig.identification.contact,
|
||||
antennas: serverConfig.antennas ? serverConfig.antennas : {},
|
||||
antennas: serverConfig.antennas,
|
||||
tuningLimit: serverConfig.webserver.tuningLimit,
|
||||
tuningLowerLimit: serverConfig.webserver.tuningLowerLimit,
|
||||
tuningUpperLimit: serverConfig.webserver.tuningUpperLimit,
|
||||
@@ -70,8 +70,9 @@ router.get('/', (req, res) => {
|
||||
device: serverConfig.device,
|
||||
noPlugins,
|
||||
plugins: serverConfig.plugins,
|
||||
fmlist_integration: typeof(serverConfig.extras?.fmlistIntegration) !== undefined ? serverConfig.extras?.fmlistIntegration : true,
|
||||
bwSwitch: serverConfig.bwSwitch ? serverConfig.bwSwitch : false
|
||||
fmlist_integration: serverConfig.extras.fmlistIntegration,
|
||||
fmlist_adminOnly: serverConfig.extras.fmlistAdminOnly,
|
||||
bwSwitch: serverConfig.bwSwitch
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -380,15 +381,14 @@ router.get('/log_fmlist', (req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (serverConfig.extras?.fmlistIntegration === false) {
|
||||
res.status(500).send('FMLIST Integration is not enabled on this server.');
|
||||
if (serverConfig.extras.fmlistIntegration === false || serverConfig.extras.fmlistAdminOnly && !isTuneAuthenticated) {
|
||||
res.status(500).send('FMLIST Integration is not available.');
|
||||
return;
|
||||
}
|
||||
|
||||
const clientIp = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
||||
const txId = dataHandler.dataToSend.txInfo.id; // Extract the ID
|
||||
|
||||
// Check if the ID can be logged (i.e., not logged within the last 60 minutes)
|
||||
if (!canLog(txId)) {
|
||||
res.status(429).send(`ID ${txId} was already logged recently. Please wait before logging again.`);
|
||||
return;
|
||||
|
||||
@@ -187,7 +187,7 @@ if (serverConfig.xdrd.wirelessConnection === false) {
|
||||
serialport.write('A0\n');
|
||||
serialport.write('F-1\n');
|
||||
serialport.write('W0\n');
|
||||
serialport.write('D0\n');
|
||||
serverConfig.webserver.rdsMode ? serialport.write('D1\n') : serialport.write('D0\n');
|
||||
serialport.write('G00\n');
|
||||
serverConfig.audio.startupVolume
|
||||
? serialport.write('Y' + (serverConfig.audio.startupVolume * 100).toFixed(0) + '\n')
|
||||
@@ -271,6 +271,7 @@ function connectToXdrd() {
|
||||
dataHandler.dataToSend.freq = serverConfig.defaultFreq && serverConfig.enableDefaultFreq === true ? Number(serverConfig.defaultFreq).toFixed(3) : (87.5).toFixed(3);
|
||||
client.write('A0\n');
|
||||
client.write(serverConfig.audio.startupVolume ? 'Y' + (serverConfig.audio.startupVolume * 100).toFixed(0) + '\n' : 'Y100\n');
|
||||
serverConfig.webserver.rdsMode ? client.write('D1\n') : client.write('D0\n');
|
||||
client.off('data', authDataHandler);
|
||||
return;
|
||||
}
|
||||
@@ -484,6 +485,8 @@ wss.on('connection', (ws, request) => {
|
||||
|
||||
if (currentUsers === 0) {
|
||||
storage.connectedUsers = [];
|
||||
output.write('W0\n');
|
||||
output.write('B0\n');
|
||||
}
|
||||
|
||||
if (tunerLockTracker.has(ws)) {
|
||||
|
||||
@@ -85,6 +85,7 @@ let serverConfig = {
|
||||
},
|
||||
extras: {
|
||||
fmlistIntegration: true,
|
||||
fmlistAdminOnly: false,
|
||||
fmlistOmid: "",
|
||||
},
|
||||
tunnel: {
|
||||
|
||||
@@ -208,7 +208,9 @@ async function processData(data, piCode, rdsPs) {
|
||||
|
||||
if (matchingStation) {
|
||||
return {
|
||||
station: detectedByPireg ? matchingStation.station.replace("R.", "Radio ") + ' ' + matchingStation.regname : matchingStation.station.replace("R.", "Radio "),
|
||||
station: detectedByPireg
|
||||
? `${matchingStation.station.replace("R.", "Radio ")}${matchingStation.regname ? ' ' + matchingStation.regname : ''}`
|
||||
: matchingStation.station.replace("R.", "Radio "),
|
||||
pol: matchingStation.pol.toUpperCase(),
|
||||
erp: matchingStation.erp && matchingStation.erp > 0 ? matchingStation.erp : '?',
|
||||
city: matchingCity.name,
|
||||
|
||||
Reference in New Issue
Block a user