group Mesh RF info if wifi_enabled (#551)

This commit is contained in:
Steve 2022-11-19 10:38:30 -07:00 committed by GitHub
parent aff1cad02d
commit cf2497b346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 21 deletions

View File

@ -271,7 +271,7 @@ if config == "mesh" then
html.print("<button type=button onClick='window.location=\"scan\"' title='See what wireless networks are nearby'>WiFi Scan</button>") html.print("<button type=button onClick='window.location=\"scan\"' title='See what wireless networks are nearby'>WiFi Scan</button>")
end end
end end
html.print("&nbsp;&nbsp") html.print("&nbsp;&nbsp;")
html.print("<button type=button onClick='window.location=\"setup\"' title='Configure this node'>Setup</button>") html.print("<button type=button onClick='window.location=\"setup\"' title='Configure this node'>Setup</button>")
html.print("&nbsp;&nbsp;") html.print("&nbsp;&nbsp;")
html.print("<select name=\"css\" size=\"1\" onChange=\"form.submit()\" >") html.print("<select name=\"css\" size=\"1\" onChange=\"form.submit()\" >")
@ -286,7 +286,7 @@ if config == "not set" then
html.print("Go to the setup page and set your node name and password.<br>") html.print("Go to the setup page and set your node name and password.<br>")
html.print("Click Save Changes, <u>even if you didn't make any changes</u>, then the node will reboot.</b>") html.print("Click Save Changes, <u>even if you didn't make any changes</u>, then the node will reboot.</b>")
html.print("<br><br>") html.print("<br><br>")
html.print("<div style=\"max-width: 540px\; text-align: left\">") html.print("<div style='max-width:540px; text-align:left'>")
html.print("<p>This device can be configured to either permit or prohibit known encrypted traffic on its RF link. It is up to the user to decide which is appropriate based on how it will be used and the license under which it will be operated. These rules vary by country, frequency, and intended use. You are encouraged to read and understand these rules before going further.</p>") html.print("<p>This device can be configured to either permit or prohibit known encrypted traffic on its RF link. It is up to the user to decide which is appropriate based on how it will be used and the license under which it will be operated. These rules vary by country, frequency, and intended use. You are encouraged to read and understand these rules before going further.</p>")
html.print("<p>This device is pre-configured with no restrictions as to the type of data being passed.</p>") html.print("<p>This device is pre-configured with no restrictions as to the type of data being passed.</p>")
html.print("<p>Follow these steps if <span style=\"text-decoration: underline\">you wish to prohibit</span> known encrypted traffic on the RF link. These instructions will disappear, so copy them for your reference:</p>") html.print("<p>Follow these steps if <span style=\"text-decoration: underline\">you wish to prohibit</span> known encrypted traffic on the RF link. These instructions will disappear, so copy them for your reference:</p>")
@ -311,9 +311,9 @@ local col2 = {}
local ip = cursor:get("network", "wifi", "ipaddr") local ip = cursor:get("network", "wifi", "ipaddr")
local cidr = netmask_to_cidr(cursor:get("network", "wifi", "netmask")) local cidr = netmask_to_cidr(cursor:get("network", "wifi", "netmask"))
if wifi_disabled then if wifi_disabled then
col1[#col1 + 1] = "<th align=right><nobr>Primary address</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>" col1[#col1 + 1] = "<th align=right><nobr>primary address:</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>"
else else
col1[#col1 + 1] = "<th align=right><nobr>Wifi address</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>" col1[#col1 + 1] = "<th align=right><nobr>mesh RF address:</nobr><br>SSID:<br>channel:<br><nobr>channel width:</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>" .. wifi_ssid .. "<br>" .. wifi_channel .. "<br>" .. wifi_chanbw .. " MHz</td>"
end end
ip = cursor:get("network", "lan", "ipaddr") ip = cursor:get("network", "lan", "ipaddr")
@ -333,7 +333,7 @@ end
if ip:match("^10%.") or not hide_local then if ip:match("^10%.") or not hide_local then
cidr = netmask_to_cidr(mask) cidr = netmask_to_cidr(mask)
col1[#col1 + 1] = "<th align=right><nobr>LAN address</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>" col1[#col1 + 1] = "<th align=right><nobr>LAN address:</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>"
end end
local wan_iface = aredn.hardware.get_iface_name("wan") local wan_iface = aredn.hardware.get_iface_name("wan")
@ -345,15 +345,15 @@ if not hide_local and wan_iface then
end end
if ip then if ip then
cidr = netmask_to_cidr(mask) cidr = netmask_to_cidr(mask)
col1[#col1 + 1] = "<th align=right><nobr>" .. wprefix .. "WAN address</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>" col1[#col1 + 1] = "<th align=right><nobr>" .. wprefix .. "WAN address:</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>"
else else
col1[#col1 + 1] = "<th align=right><nobr>" .. wprefix .. "WAN address</nobr></th><td>none</small><br>" col1[#col1 + 1] = "<th align=right><nobr>" .. wprefix .. "WAN address:</nobr></th><td>none</small><br>"
end end
end end
ip = get_default_gw() ip = get_default_gw()
if ip:match("^10%.") or not hide_local then if ip:match("^10%.") or not hide_local then
col1[#col1 + 1] = "<th align=right><nobr>default gateway</nobr></th><td>" .. ip col1[#col1 + 1] = "<th align=right valign=top><nobr>default gateway:</nobr></th><td>" .. ip
if ip:match("^10%.") then if ip:match("^10%.") then
col1[#col1] = col1[#col1] .. "<br><nobr>" .. mesh_ip_to_hostnames(ip) .. "</nobr>" col1[#col1] = col1[#col1] .. "<br><nobr>" .. mesh_ip_to_hostnames(ip) .. "</nobr>"
end end
@ -361,29 +361,24 @@ if ip:match("^10%.") or not hide_local then
end end
if browser_ip then if browser_ip then
col1[#col1 + 1] = "<th align=right><nobr>your address</nobr></th><td>" .. browser_ip .. "<br><nobr>" .. mesh_ip_to_hostnames(browser_ip) .. "</nobr></td>" col1[#col1 + 1] = "<th align=right><nobr>your address:</nobr></th><td>" .. browser_ip .. "<br><nobr>" .. mesh_ip_to_hostnames(browser_ip) .. "</nobr></td>"
end end
if not wifi_disabled then
col1[#col1 + 1] = "<th align=right><nobr>SSID</nobr></th><td>" .. wifi_ssid .. "</td>"
col1[#col1 + 1] = "<th align=right><nobr>Channel</nobr></th><td>" .. wifi_channel .. "</td>"
col1[#col1 + 1] = "<th align=right><nobr>Bandwidth</nobr></th><td>" .. wifi_chanbw .. " MHz</td>"
end
-- right column - system info -- right column - system info
if config == "mesh" and not wifi_disabled then if config == "mesh" and not wifi_disabled then
col2[#col2 + 1] = "<th align=right valign=middle><nobr>Signal/Noise/Ratio</nobr></th><td valign=middle><nobr>" col2[#col2 + 1] = "<th align=right valign=middle><nobr>signal / noise / ratio:</nobr></th><td valign=middle><nobr>"
local s, n = get_wifi_signal(wifi_iface) local s, n = get_wifi_signal(wifi_iface)
if s == "N/A" then if s == "N/A" then
col2[#col2] = col2[#col2] .. "N/A" col2[#col2] = col2[#col2] .. "no RF links"
else else
col2[#col2] = col2[#col2] .. "<big><b>" .. s .. " / " .. n .. " / " .. math.abs(s - n) .. " dB</b></big>" col2[#col2] = col2[#col2] .. "<big><b>" .. s .. " / " .. n .. " / " .. math.abs(s - n) .. " dB</b></big>"
col2[#col2] = col2[#col2] .. "&nbsp;&nbsp;&nbsp;<button type=button onClick='window.location=\"signal?realtime=1\"' title='Display continuous or archived signal strength on a chart'>Charts</button></nobr></td>"
end end
col2[#col2] = col2[#col2] .. "&nbsp;&nbsp;&nbsp;<button type=button onClick='window.location=\"signal?realtime=1\"' title='Display continuous or archived signal strength on a chart'>Charts</button></nobr></td>"
end end
col2[#col2 + 1] = "<th align=right><nobr>firmware version</nobr><br><nobr>model</nobr></th><td>" .. read_all("/etc/mesh-release") .. "<br>" .. (aredn.hardware.get_radio() or { name = "unknown" }).name .. "</td>"; col2[#col2 + 1] = "<th align=right><nobr>firmware version:</nobr><br><nobr>model:</nobr></th><td>" .. read_all("/etc/mesh-release") .. "<br>" .. (aredn.hardware.get_radio() or { name = "unknown" }).name .. "</td>"
local sysinfo = nixio.sysinfo() local sysinfo = nixio.sysinfo()
local uptime = string.format("%d:%02d", math.floor(sysinfo.uptime / 3600) % 24, math.floor(sysinfo.uptime / 60) % 60) local uptime = string.format("%d:%02d", math.floor(sysinfo.uptime / 3600) % 24, math.floor(sysinfo.uptime / 60) % 60)
@ -392,7 +387,7 @@ if sysinfo.uptime >= 172800 then
elseif sysinfo.uptime >= 86400 then elseif sysinfo.uptime >= 86400 then
uptime = "1 day, " .. uptime uptime = "1 day, " .. uptime
end end
col2[#col2 + 1] = "<th align=right><nobr>system time</nobr><br>uptime</th><td>" .. os.date("%a %b %e %Y") .. "&nbsp;" .. os.date("%T %Z") .. "<br>" .. uptime .. "</td>"; col2[#col2 + 1] = "<th align=right><nobr>system time:</nobr><br>uptime:</th><td>" .. os.date("%a %b %e %Y") .. "&nbsp;" .. os.date("%T %Z") .. "<br>" .. uptime .. "</td>"
local vfs = nixio.fs.statvfs("/overlay") local vfs = nixio.fs.statvfs("/overlay")
local fspace = vfs.bfree * vfs.bsize / 1024 local fspace = vfs.bfree * vfs.bsize / 1024
@ -414,8 +409,8 @@ else
rspace = rspace .. " KB" rspace = rspace .. " KB"
end end
col2[#col2 + 1] = "<th align=right valign=top><nobr>load average</nobr><br><nobr>available space</nobr></th><td>" .. string.format("%.2f, %.2f, %.2f", sysinfo.loads[1], sysinfo.loads[2], sysinfo.loads[3]) .. "<br><nobr>flash = " .. fspace .. "</nobr><br><nobr>memory = " .. rspace .. "</nobr></td>"; col2[#col2 + 1] = "<th align=right valign=top><nobr>load average:</nobr><br><nobr>available space:</nobr></th><td>" .. string.format("%.2f, %.2f, %.2f", sysinfo.loads[1], sysinfo.loads[2], sysinfo.loads[3]) .. "<br><nobr><em>flash</em> = " .. fspace .. "</nobr><br><nobr><em>memory</em> = " .. rspace .. "</nobr></td>"
col2[#col2 + 1] = "<th align=right valign=top>Host Entries</th><td><nobr>Total = " .. host_total .. "</nobr><br><nobr>Nodes = " .. host_nodes .. "<nobr></td>" col2[#col2 + 1] = "<th align=right valign=top><nobr>host entries:</nobr></th><td><b>" .. host_nodes .. "</b> nodes / <b>" .. host_total .. "</b> total devices</td>"
-- now print the tables -- now print the tables