From d8c29d60e92c2962ac23dfb67c6473e28767028f Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Sun, 31 Mar 2024 22:14:49 -0700 Subject: [PATCH] Use per-page scan rather than per node (#1145) Similar fix that was recently added to the mesh page --- files/www/cgi-bin/scan | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/files/www/cgi-bin/scan b/files/www/cgi-bin/scan index 044b96f0..8e156535 100755 --- a/files/www/cgi-bin/scan +++ b/files/www/cgi-bin/scan @@ -55,10 +55,6 @@ if board_type:match("^ubnt,") and board_type:match("ac") then ubnt_ac = true end -if not nixio.fs.stat("/tmp/web") then - nixio.fs.mkdir("/tmp/web") -end - local channels = aredn.hardware.get_rfchannels(wifiiface) local scan_list = "" for _, channel in ipairs(channels) @@ -178,31 +174,12 @@ end -- scan end -if os.getenv("REQUEST_METHOD") == "POST" then - require('luci.http') - local request = luci.http.Request(nixio.getenv(), - function() - local v = io.read(1024) - if not v then - io.close() - end - return v - end - ) - if request:formvalue("auto") then - io.open("/tmp/web/autoscan", "w"):close() - end - if request:formvalue("stop") then - os.remove("/tmp/web/autoscan") - end -end - -- generate page http_header() html.header(node .. " WiFi scan", false) -local autoscan = nixio.fs.stat("/tmp/web/autoscan"); +local autoscan = string.find((nixio.getenv("QUERY_STRING") or ""):lower(),"autoscan=1") if autoscan then - html.print("") + html.print("") end html.print([[ @@ -226,11 +203,11 @@ html.alert_banner() html.print("

" .. node .. " WiFi scan


") if autoscan then - html.print("") + html.print("") else html.print("") html.print("   ") - html.print("") + html.print([[]]) end html.print("   ")