Webserver can be accessed (sometimes... when no Wifi is found, or clock is newly setup

This commit is contained in:
ollo 2016-06-19 18:09:33 +02:00
parent 499cbcbbc5
commit b1f702df75
2 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@ function sendWebPage(conn,answertype)
buf = buf .."<tr><th>SNTP Server</th><td><input id=\"sntpserver\" name=\"sntpserver\" value=\"" .. sntpserverhostname .. "\"></td><td>Server to sync the time with. Only one ntp server is allowed.</tr>" buf = buf .."<tr><th>SNTP Server</th><td><input id=\"sntpserver\" name=\"sntpserver\" value=\"" .. sntpserverhostname .. "\"></td><td>Server to sync the time with. Only one ntp server is allowed.</tr>"
buf = buf .."<tr><th>Offset to UTC time</th><td><input id=\"timezoneoffset\" name=\"timezoneoffset\" value=\"" .. timezoneoffset .. "\"></td><td>Define the offset to UTC time in hours. For example +1 hour for Germany</tr>" buf = buf .."<tr><th>Offset to UTC time</th><td><input id=\"timezoneoffset\" name=\"timezoneoffset\" value=\"" .. timezoneoffset .. "\"></td><td>Define the offset to UTC time in hours. For example +1 hour for Germany</tr>"
buf = buf .. "<tr><td colspan=\"3\"><div align=\"center\"><input type=\"submit\" value=\"Save Configuration\" onclick=\"this.value='Submitting ..';this.disabled='disabled'; this.form.submit();\"></div></td></tr>" buf = buf .. "<tr><td colspan=\"3\"><div align=\"center\"><input type=\"submit\" value=\"Save Configuration\" onclick=\"this.value='Submitting ..';this.disabled='disabled'; this.form.submit();\"></div></td></tr>"
buf = buf .. "<tr><td colspan=\"3\"><div align=\"center\"><input type=\"submit\" name=\"action\" value=\"Reboot\"></div></td></tr>"
buf = buf .."</table></form>" buf = buf .."</table></form>"
if answertype==2 then if answertype==2 then
buf = buf .. "<h2><font color=\"green\">New configuration saved</font></h2\n>" buf = buf .. "<h2><font color=\"green\">New configuration saved</font></h2\n>"

View File

@ -39,6 +39,10 @@ function startWebServer()
end end
postRequestData=nil postRequestData=nil
--- Do the magic!
if (_POST.action ~= nil and _POST.action == "Reboot") then
node.restart()
end
print("Inform user via Web") print("Inform user via Web")
if (sendWebPage == nil) then if (sendWebPage == nil) then