1 #!/usr/bin/haserl --shell=luac
2 dofile("/usr/lib/luci-splash/splash.lua")
5 local ip = ffluci.http.remote_addr()
6 for k, v in pairs(uci:show("network").network) do
7 if v[".type"] == "interface" then
8 local p = ffluci.sys.net.mask4prefix(v.netmask)
9 if ffluci.sys.net.belongs(ip, v.ipaddr, p) then
16 ffluci.http.textheader()
17 return print("Unable to detect network settings!")
20 local action = "splash"
22 local mac = ip4mac(ip)
27 if iswhitelisted(mac) or haslease(mac) then
31 ffluci.http.redirect("http://" .. srv .. "/cgi-bin/luci-splash/" .. action)