fixed json parsing bug

This commit is contained in:
git 2025-06-16 16:53:12 +01:00
parent 5a7f5e7076
commit 4e30ce31d1

View File

@ -231,11 +231,12 @@ async function fetchRemoteDevicesData() {
} }
else if (Type === 'PTR') { else if (Type === 'PTR') {
if (!db.remote.PTR[Name]) db.remote.PTR[Name] = []; if (!db.remote.PTR[Name]) db.remote.PTR[Name] = [];
if (!db.remote.PTR[Name].includes(Data)) db.remote.PTR[Name].push(Data); if (!db.remote.PTR[Name].includes(Data))
db.remote.PTR[Name].push((["[","{"].includes(Data.substr(0,1))?JSON.parse(Data):Data));
} }
else if (['TXT', 'SRV'].includes(Type)) { else if (['TXT', 'SRV'].includes(Type)) {
if (!db.remote.services[Name]) db.remote.services[Name] = { TXT: null, SRV: null }; if (!db.remote.services[Name]) db.remote.services[Name] = { TXT: null, SRV: null };
db.remote.services[Name][Type] = (Data.substr(0,1)=="{"?JSON.parse(Data):Data); db.remote.services[Name][Type] = (["[","{"].includes(Data.substr(0,1))?JSON.parse(Data):Data);
} }
}); });