Glonal en/disabling of whitelist

This commit is contained in:
2025-04-11 08:36:24 +00:00
parent c60764fa66
commit 21af41467e

View File

@@ -41,7 +41,7 @@ mqttC.on('message', function (topic, message) { // Handler, wenn mqtt-message ko
} else { } else {
msg.content=message.toString(); // Ist nix json? dann ab in "content" damit msg.content=message.toString(); // Ist nix json? dann ab in "content" damit
} }
if (whitelist.whitelist.includes(msg.content.user_name)) { if (!(config.whitelist_enabled) || (whitelist.whitelist.includes(msg.content.user_name))) {
if (topic.startsWith('wavelog/qso/logged')) { if (topic.startsWith('wavelog/qso/logged')) {
tobrowser=parse_qso_msg(msg.content); tobrowser=parse_qso_msg(msg.content);
if (tobrowser.qso_time) { if (tobrowser.qso_time) {
@@ -81,6 +81,7 @@ function parse_cat_msg(topic,msg) {
} }
async function getWhitelist() { async function getWhitelist() {
if (config.whitelist_enabled) {
try { try {
const response = await fetch(config.whitelist_url); const response = await fetch(config.whitelist_url);
if (!response.ok) { if (!response.ok) {
@@ -92,6 +93,7 @@ async function getWhitelist() {
console.error('Error fetching JSON data:', error); console.error('Error fetching JSON data:', error);
} }
} }
}
function parse_qso_msg(msg) { function parse_qso_msg(msg) {
let retmsg={}; let retmsg={};
@@ -117,6 +119,7 @@ function startup() {
http.listen(8000,'127.0.0.1', () => { // Webserver starten http.listen(8000,'127.0.0.1', () => { // Webserver starten
console.log(`Socket.IO server running at http://localhost:8000/`); // debug console.log(`Socket.IO server running at http://localhost:8000/`); // debug
}); });
const intervalID = setInterval(getWhitelist,5*60*1000);
} }
startup(); startup();