1
0
mirror of https://github.com/DigitalDevices/octonet.git synced 2023-10-10 13:36:52 +02:00
octonet/octoserve/var/www/beta.lua
mvoelkel 73bf0bd413 Webserver javascripts updates
Replaces DOM based dynamic jscript elements with XMLHttpRequests
and JSON replies.
Not yet on all pages.
2015-09-06 22:06:38 +02:00

32 lines
731 B
Lua

#!/usr/bin/lua
local host = os.getenv("HTTP_HOST")
local proto = os.getenv("SERVER_PROTOCOL")
local query = os.getenv("QUERY_STRING")
function http_print(s)
if s then
io.stdout:write(tostring(s).."\r\n")
else
io.stdout:write("\r\n")
end
end
local userver = "download.digital-devices.de/download/linux"
if query == "set=beta" then
local file = io.open("/config/updateserver","w")
if file then
file:write(userver.."/beta".."\n")
file:close()
end
elseif query == "set=std" then
os.remove("/config/updateserver")
os.execute("rm -f /config/octonet.*.img")
os.execute("rm -f /config/octonet.*.sha")
end
http_print(proto.." 303")
http_print("Location: http://"..host.."/update.html")
http_print("")