diff --git a/files/usr/lib/lua/aredn/html.lua b/files/usr/lib/lua/aredn/html.lua index 4fe47daf..55f272cc 100644 --- a/files/usr/lib/lua/aredn/html.lua +++ b/files/usr/lib/lua/aredn/html.lua @@ -158,18 +158,23 @@ function html.navbar_admin(selected) html.print("
") end -function html.wait_for_reboot(delay, countdown) +function html.wait_for_reboot(delay, countdown, address) + if address then + address = [["http://]] .. address .. [[/cgi-bin/status"]] + else + address = [[window.origin + "/cgi-bin/status"]] + end html.print([[
") html.print("

" .. node .. " is rebooting


") html.print("

The LAN subnet has changed. You will need to acquire a new DHCP lease
") html.print("and reset any name service caches you may be using.


") html.print("

When the node reboots you get your new DHCP lease and reconnect with
") html.print("http://localnode.local.mesh:8080/
or
") html.print("http://" .. node .. ".local.mesh:8080/

") + html.print("

") else html.header(node .. " rebooting", false) html.wait_for_reboot(20, 120) diff --git a/files/usr/lib/lua/aredn/http.lua b/files/usr/lib/lua/aredn/http.lua index c04addc2..b685fdf2 100755 --- a/files/usr/lib/lua/aredn/http.lua +++ b/files/usr/lib/lua/aredn/http.lua @@ -49,6 +49,7 @@ http_output = nil function http_header(disable_compression) print "Content-type: text/html\r" print "Cache-Control: no-store\r" + print("Access-Control-Allow-Origin: *\r") if not disable_compression then local encoding = os.getenv("HTTP_ACCEPT_ENCODING") if encoding and encoding:match("gzip") then diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index 07fe5f1f..4222381c 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -447,10 +447,23 @@ if fw_install and nixio.fs.stat(tmpdir .. "/firmware") then end nixio.fs.symlink("/www/aredn.css", "/tmp/web/style.css") end + -- Show a different reload address if we're running on the ramdisk + local displayaddress = "192.168.1.1" + local waitaddress = displayaddress + if parms.checkbox_keep_settings then + for line in io.lines("/proc/mounts") + do + if line:match("overlay") or line:match("ext4") then + displayaddress = node .. ".local.mesh" + waitaddress = nil + break + end + end + end html.print("") - html.wait_for_reboot(120, 300) + html.wait_for_reboot(120, 300, waitaddress) html.print("") html.print("
") html.print("

The firmware is being updated.

") @@ -483,15 +496,6 @@ if fw_install and nixio.fs.stat(tmpdir .. "/firmware") then aredn.info.set_nvram("nodeupgraded", "0") os.execute("reboot >/dev/null 2>&1") else - -- Show a different reload address if we're running on the ramdisk - local hostname = "192.168.1.1" - for line in io.lines("/proc/mounts") - do - if line:match("overlay") or line:match("ext4") then - hostname = node .. ".local.mesh" - break - end - end html.print([[

Firmware will be written in the background.

If your computer is connected to the LAN of this node you may need to acquire
@@ -499,7 +503,7 @@ if fw_install and nixio.fs.stat(tmpdir .. "/firmware") then

The node will reboot twice while the configuration is applied
When the node has finished booting you should ensure your computer has
received a new IP address and reconnect with
- http://]] .. hostname .. [[:8080/
+ http://]] .. displayaddress .. [[:8080/
This page will automatically reload once the upgrade has completed