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
bugfixes / sporadic e logging
This commit is contained in:
@@ -401,7 +401,7 @@ function handleData(wss, receivedData, rdsWss) {
|
||||
// Get the received TX info
|
||||
fetchTx(parseFloat(dataToSend.freq).toFixed(1), dataToSend.pi, dataToSend.ps)
|
||||
.then((currentTx) => {
|
||||
if (currentTx && currentTx.station !== undefined) {
|
||||
if (currentTx && currentTx.station !== undefined && parseInt(currentTx.distance) < 4000) {
|
||||
dataToSend.txInfo = {
|
||||
tx: currentTx.station,
|
||||
pol: currentTx.pol,
|
||||
|
||||
@@ -21,11 +21,13 @@ router.get('/', (req, res) => {
|
||||
let requestIp = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
||||
|
||||
const normalizedIp = requestIp?.replace(/^::ffff:/, '');
|
||||
const isBanned = serverConfig.webserver.banlist.some(banEntry => banEntry[0] === normalizedIp);
|
||||
|
||||
const ipList = normalizedIp.split(',').map(ip => ip.trim()); // in case there are multiple IPs (proxy), we need to check all of them
|
||||
|
||||
const isBanned = ipList.some(ip => serverConfig.webserver.banlist.some(banEntry => banEntry[0] === ip));
|
||||
|
||||
if (isBanned) {
|
||||
res.render('403');
|
||||
logInfo(`Web client (${requestIp}) is banned`);
|
||||
logInfo(`Web client (${normalizedIp}) is banned`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -391,7 +393,8 @@ router.get('/log_fmlist', (req, res) => {
|
||||
client: {
|
||||
request_ip: clientIp
|
||||
},
|
||||
log_msg: "Logged PS: " + dataHandler.dataToSend.ps.replace(/\s+/g, '_') + ", PI: " + dataHandler.dataToSend.pi + ", Signal: " + dataHandler.dataToSend.sig.toFixed(0) + " dBf",
|
||||
type: req.query.type ? req.query.type : 'tropo',
|
||||
log_msg: "Logged PS: " + dataHandler.dataToSend.ps.replace(/\s+/g, '_') + ", PI: " + dataHandler.dataToSend.pi + ", Signal: " + (dataHandler.dataToSend.sig - 11.25).toFixed(0) + " dBµV",
|
||||
});
|
||||
|
||||
const options = {
|
||||
|
||||
@@ -108,7 +108,7 @@ async function processData(data, piCode, rdsPs) {
|
||||
weightDistance = Math.abs(distance.distanceKm - 1500);
|
||||
}
|
||||
let erp = station.erp && station.erp > 0 ? station.erp : 1;
|
||||
let extraWeight = erp > 10 && distance.distanceKm <= 2500 ? 0.3 : 0;
|
||||
let extraWeight = erp >= 10 && distance.distanceKm <= 2500 ? 0.5 : 0;
|
||||
const score = ((10 * Math.log10(erp * 1000)) / weightDistance) + extraWeight;
|
||||
if (score > maxScore) {
|
||||
maxScore = score;
|
||||
|
||||
Reference in New Issue
Block a user