1 #!/usr/bin/haserl --shell=luac
2 package.path = "/usr/lib/lua/?.lua;/usr/lib/lua/?/init.lua;" .. package.path
3 package.cpath = "/usr/lib/lua/?.so;" .. package.cpath
7 require("ffluci.model.uci")
10 local ip = ffluci.http.remote_addr()
11 for k, v in pairs(ffluci.model.uci.show("network").network) do
12 if v[".type"] == "interface" and v.ipaddr then
13 local p = ffluci.sys.net.mask4prefix(v.netmask)
14 if ffluci.sys.net.belongs(ip, v.ipaddr, p) then
22 ffluci.http.textheader()
23 return print("Unable to detect network settings!")
26 local action = "splash"
28 local mac = ffluci.sys.net.ip4mac(ip)
33 local status = ffluci.sys.exec("luci-splash status "..mac)
35 if status == "whitelisted" or status == "lease" then
39 ffluci.http.redirect("http://" .. srv .. "/cgi-bin/luci-splash/" .. action)