fixed json parsing bug
This commit is contained in:
parent
5a7f5e7076
commit
4e30ce31d1
5
main.js
5
main.js
@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user