From 787e5f55fc49b1f9fda5a2f676b0cfab61f698a0 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Wed, 13 Nov 2024 22:39:59 -0800 Subject: [PATCH] Add mobile wifi tools (#1691) * Add mobile wifi signal tool * Add mobile wifi scan tool * Enable --- files/app/main/tools/e/traceroute.ut | 4 ++-- files/app/main/tools/e/wifiscan.ut | 12 ++++++++++-- files/app/main/tools/e/wifisignal.ut | 8 ++++++++ files/app/partial/tools.ut | 2 +- files/app/resource/css/mobile.css | 15 ++++++++++----- files/app/resource/css/user.css | 2 +- 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/files/app/main/tools/e/traceroute.ut b/files/app/main/tools/e/traceroute.ut index 2b9f1fd5..a4cbbd04 100755 --- a/files/app/main/tools/e/traceroute.ut +++ b/files/app/main/tools/e/traceroute.ut @@ -144,7 +144,7 @@ const mynode = configuration.getName(); case "CONNECTING": if (line.match(/^traceroute/)) { state = "PRINT"; - out(line); + out(line.replace(".local.mesh", "")); } break; case "PRINT": @@ -159,7 +159,7 @@ const mynode = configuration.getName(); else { const m = line.match(/^[0-9]+ +(.+\.local\.mesh) /); if (m) { - line = line.replace(m[1], `${m[1]}`); + line = line.replace(m[1], `${m[1].replace(".local.mesh", "")}`); } out(line); } diff --git a/files/app/main/tools/e/wifiscan.ut b/files/app/main/tools/e/wifiscan.ut index 389cca02..21e89148 100755 --- a/files/app/main/tools/e/wifiscan.ut +++ b/files/app/main/tools/e/wifiscan.ut @@ -249,15 +249,23 @@ else { + {% if (!request.mobile) { %} + {% } else { %} + + {% } %} {% for (let i = 0; i < length(last_scan); i++) { const s = last_scan[i]; - %} + if (!request.mobile) { + %} - {% } %} + {% } else { %} + + {% } + } %}
SNRSignalChanEncSSIDHostnameBSSID802.11 ModeSignalChanSSIDHostname
{{95 + s.signal}}{{s.signal}}{{s.chan}}-{{s.ssid}}{{s.hostname || s.ip || "-"}}{{s.mac}}{{s.mode}}
{{s.signal}}{{s.chan}}{{s.ssid}}{{s.hostname || s.ip || "-"}}
diff --git a/files/app/main/tools/e/wifisignal.ut b/files/app/main/tools/e/wifisignal.ut index 7d2db707..da5f6ebb 100755 --- a/files/app/main/tools/e/wifisignal.ut +++ b/files/app/main/tools/e/wifisignal.ut @@ -157,6 +157,7 @@ for (let i = 0; i < length(stations); i++) {
Local
Remote
+ {% if (!request.mobile) { %}
@@ -175,6 +176,7 @@ for (let i = 0; i < length(stations); i++) {
+ {% } %}
@@ -225,9 +227,11 @@ for (let i = 0; i < length(stations); i++) { const rbar1 = htmx.find("#wifi-bar .bars:nth-child(2) > div:nth-child(1)"); const rbar2 = htmx.find("#wifi-bar .bars:nth-child(2) > div:nth-child(2)"); const rbar3 = htmx.find("#wifi-bar .bars:nth-child(2) > div:nth-child(3)"); + {% if (!request.mobile) { %} const chart = htmx.find("#wifi-chart svg"); const signal = htmx.find("#wifi-chart svg .signal"); const rsignal = htmx.find("#wifi-chart svg .rsignal"); + {% } %} let oscillator; let gain; @@ -276,8 +280,10 @@ for (let i = 0; i < length(stations); i++) { rbar1.lastElementChild.innerText = ""; rbar2.lastElementChild.innerText = ""; rbar3.lastElementChild.innerText = ""; + {% if (!request.mobile) { %} signal.points.clear(); rsignal.points.clear(); + {% } %} } const timer = setInterval(async _ => { if (!document.contains(target)) { @@ -341,6 +347,7 @@ for (let i = 0; i < length(stations); i++) { bar2.style.height = p(sf); bar2.firstElementChild.innerText = ""; } + {% if (!request.mobile) { %} if (signal.points.length >= maxpoints) { signal.points.removeItem(0); rsignal.points.removeItem(0); @@ -358,6 +365,7 @@ for (let i = 0; i < length(stations); i++) { rpoint.x = 10 + rsignal.points.length / maxpoints * 180; rpoint.y = 90 - 80 * ((rsl > -120 ? rsl : -120) + 120) / 120; rsignal.points.appendItem(rpoint); + {% } %} oscillator.frequency.value = (s - sf) * htmx.find("#wifi-chart input[name=pitch]").value; gain.gain.value = htmx.find("#wifi-chart input[name=volume]").value; }, 1000); diff --git a/files/app/partial/tools.ut b/files/app/partial/tools.ut index 863b0c50..6873a54c 100755 --- a/files/app/partial/tools.ut +++ b/files/app/partial/tools.ut @@ -38,7 +38,7 @@