Previously, the config-mode was responsible for generating the fastd
secret. This patch sets the default secret to "generate" causing a
secret to be generated on its first use (e.g. show_key or start).
This also changes the info page (in Expert Mode) to show "n/a" when the
public key is not yet available.
An undocumented feature of uci:get_first() is to cast the returned value
to the same type as the default argument. Thus, supplying a default
value ot type number makes string.format superfluous.
Display the correct hostname on the final page of configmode.
Previously, this page used to simply call luci.sys.hostname() which
would return the current hostname. However, when the configmode changes
the hostname luci.sys.hostname() will not reflect this. This patch
fetches the hostname directly from the UCI system config.
This adds a variable called 'hostname' which may be used in site.conf at
config_mode.msg_reboot and .msg_pubkey.
The reboot page should be delayed a little to give the browser time for
fetching assets (like the stylesheet). This adds a two second delay.
Unfortunately, I couldn't think of a sane way to do this within a luci
controller.
This patch forks the process. The parent will continue rendering the
page for the browser while the child will sleep and then reboot the
device. For this to work reliable the child needs to close stdout before
sleeping so the webserver closes the connection to the browser. This,
again, required a hack as lua does not allow closing std filehandles,
when prevented using luci.reboot() which was calling os.execute() and
that function will not work with stdout closed.
Due to my previous two commits configmode was broken when either meshvpn
or bandwidth limit was disabled. This fixes it but there may be a
cleaner solution provided by luci.