restrict msg banner to nonprotected pages (#384)

* restrict aredn messages to non-protected pages

* fix typo
This commit is contained in:
Steve AB7PA 2022-06-07 19:30:27 -07:00 committed by GitHub
parent bf8c6ee093
commit c4bd018a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -67,12 +67,8 @@ function html.footer()
end
function html.alert_banner()
local aredn_message = read_all("/tmp/aredn_message")
local local_message = read_all("/tmp/local_message")
html.print("<div class=\"TopBanner\">")
html.print("<div class=\"LogoDiv\"><a href=\"http://localnode.local.mesh:8080\" title=\"Go to localnode\"><img src=\"/AREDN.png\" class=\"AREDNLogo\"></img></a></div>")
local supported = aredn.hardware.supported()
if supported == 0 then
html.print("<div style=\"padding:5px;background-color:#FF4719;color:black;border:1px solid #ccc;width:600px;\"><a href=\"/cgi-bin/sysinfo\">!!!! UNSUPPORTED DEVICE !!!!</a></div>")
@ -81,14 +77,19 @@ function html.alert_banner()
elseif supported ~= 1 then
html.print("<div style=\"padding:5px;background-color:yellow;color:black;border:1px solid #ccc;width:600px;\"><a href=\"/cgi-bin/sysinfo\">!!!! UNTESTED HARDWARE !!!!</a></div>")
end
html.print("</div>")
end
function html.msg_banner()
html.print("<div class=\"TopBanner\">")
local aredn_message = read_all("/tmp/aredn_message")
local local_message = read_all("/tmp/local_message")
if aredn_message and #aredn_message > 0 then
html.print("<div style=\"padding:5px;background-color:#fff380;color:black;border:1px solid #ccc;width:600px;\"><strong>AREDN Alert(s):</strong><br /><div style=\"text-align:left;\">" .. aredn_message .. "</div></div>")
html.print("<div style=\"padding:5px;background-color:#fff380;color:black;border:1px solid #ccc;width:600px;\"><strong>AREDN Messages:</strong><br /><div style=\"text-align:left;\">" .. aredn_message .. "</div></div>")
end
if local_message and #local_message > 0 then
html.print("<div style=\"padding:5px;background-color:#fff380;color:black;border:1px solid #ccc;width:600px;\"><strong>Local Alert(s):</strong><br /><div style=\"text-align:left;\">" .. local_message .. "</div></div>")
html.print("<div style=\"padding:5px;background-color:#fff380;color:black;border:1px solid #ccc;width:600px;\"><strong>Local Messages:</strong><br /><div style=\"text-align:left;\">" .. local_message .. "</div></div>")
end
html.print("</div>")
end

View File

@ -419,6 +419,7 @@ html.print("<input type=hidden name=reload value=1>")
html.print("<center>")
html.alert_banner()
html.msg_banner()
html.print("<h1>" .. node .. " mesh status</h1>")

View File

@ -221,6 +221,7 @@ html.print("<body><form method='post' action='/cgi-bin/status' enctype='multipar
html.print("<center>")
html.alert_banner()
html.msg_banner()
-- page header
html.print("<h1><big>" .. node)