From 91fe80044754b13c84a85d22d1e74fed9f0e49d6 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Wed, 20 Nov 2024 11:23:30 -0800 Subject: [PATCH] Improve display of blocked neighbors (#1709) --- .../app/partial/local-and-neighbor-devices.ut | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/files/app/partial/local-and-neighbor-devices.ut b/files/app/partial/local-and-neighbor-devices.ut index 25e6e26d..f435b6e3 100755 --- a/files/app/partial/local-and-neighbor-devices.ut +++ b/files/app/partial/local-and-neighbor-devices.ut @@ -139,6 +139,17 @@ else { push(nlist, { name: (tracker && tracker.hostname) || `|${link.remoteIP}`, tracker: tracker, link: link }); } + delete trackers[link.remoteIP]; + } + for (let remoteIP in trackers) + { + const tracker = trackers[remoteIP]; + if (tracker.type == "DtD" && tracker.distance < 100) { + push(llist, { name: tracker.hostname || `|${remoteIP}`, tracker: tracker, link: null }); + } + else { + push(nlist, { name: tracker.hostname || `|${remoteIP}`, tracker: tracker, link: null }); + } } if (length(llist) > 0) { sort(llist, (a, b) => a.name == b.name ? 0 : a.name < b.name ? -1 : 1); @@ -153,8 +164,8 @@ else { print(`
`); } - const lq = link.lossMultiplier ? (min(100, int(100 * link.linkQuality * 65536 / link.lossMultiplier)) + "%") : "-"; - const nlq = link.lossMultiplier ? (min(100, int(100 * link.neighborLinkQuality * 65536 / link.lossMultiplier)) + "%") : "-"; + const lq = link && link.lossMultiplier ? (min(100, int(100 * link.linkQuality * 65536 / link.lossMultiplier)) + "%") : "-"; + const nlq = link && link.lossMultiplier ? (min(100, int(100 * link.neighborLinkQuality * 65536 / link.lossMultiplier)) + "%") : "-"; if (substr(entry.name, 0, 1) !== "|") { print(``); } @@ -195,8 +206,8 @@ else { print(`
`); } - const lq = link.lossMultiplier ? (min(100, int(100 * link.linkQuality * 65536 / link.lossMultiplier)) + "%") : "-"; - const nlq = link.lossMultiplier ? (min(100, int(100 * link.neighborLinkQuality * 65536 / link.lossMultiplier)) + "%") : "-"; + const lq = link && link.lossMultiplier ? (min(100, int(100 * link.linkQuality * 65536 / link.lossMultiplier)) + "%") : "-"; + const nlq = link && link.lossMultiplier ? (min(100, int(100 * link.neighborLinkQuality * 65536 / link.lossMultiplier)) + "%") : "-"; let icon = ""; let title = ""; switch (tracker && tracker.type || "Unknown") {