1 #!/usr/bin/haserl --shell=luac --accept-none
2 dofile("/usr/lib/luci-splash/splash.lua")
7 -- Current leases in state files
8 local leases = uci:show("luci_splash").luci_splash
10 -- Convert leasetime to seconds
11 local leasetime = tonumber(uci:get("luci_splash", "general", "leasetime")) * 3600
14 uci:revert("luci_splash")
18 for k, v in pairs(uci:show("luci_splash")) do
19 if v[".type"] == "lease" then
20 if os.difftime(time, tonumber(v.start)) > leasetime then
25 local n = uci:add("luci_splash", "lease")
26 uci:set("luci_splash", n, "mac", v.mac)
27 uci:set("luci_splash", n, "start", v.start)
34 -- Delete rules without state
35 for i, r in ipairs(listrules()) do
36 if not written[r] then