2015-01-16 23:38:38 +01:00
-- Licensed to the public under the Apache License 2.0.
2011-10-18 09:23:27 +00:00
2008-05-25 17:00:30 +00:00
require ( " luci.model.uci " )
2008-04-26 17:55:16 +00:00
2018-08-18 12:21:21 +08:00
m = Map ( " luci_splash " , translate ( " Client-Splash " ) , translate ( " Client-Splash is a hotspot authentication system for wireless mesh networks. " ) )
2008-04-26 17:55:16 +00:00
2011-10-18 09:23:27 +00:00
s = m : section ( NamedSection , " general " , " core " , translate ( " General " ) )
2009-11-25 02:20:09 +00:00
s.addremove = false
2011-10-18 09:23:27 +00:00
s : option ( Value , " leasetime " , translate ( " Clearance time " ) , translate ( " Clients that have accepted the splash are allowed to use the network for that many hours. " ) )
2013-08-18 20:37:35 +00:00
local redir = s : option ( Value , " redirect_url " , translate ( " Redirect target " ) , translate ( " Clients are redirected to this page after they have accepted the splash. If this is left empty they are redirected to the page they had requested. " ) )
redir.rmempty = true
2008-04-26 21:29:14 +00:00
2011-10-18 09:23:27 +00:00
s : option ( Value , " limit_up " , translate ( " Upload limit " ) , translate ( " Clients upload speed is limited to this value (kbyte/s) " ) )
s : option ( Value , " limit_down " , translate ( " Download limit " ) , translate ( " Clients download speed is limited to this value (kbyte/s) " ) )
2009-06-10 23:39:40 +00:00
s : option ( DummyValue , " _tmp " , " " ,
2011-10-18 09:23:27 +00:00
translate ( " Bandwidth limit for clients is only activated when both up- and download limit are set. " ..
" Use a value of 0 here to completely disable this limitation. Whitelisted clients are not limited. " ) )
2009-06-10 23:39:40 +00:00
2011-10-18 09:23:27 +00:00
s = m : section ( TypedSection , " iface " , translate ( " Interfaces " ) , translate ( " Interfaces that are used for Splash. " ) )
2009-06-16 21:41:29 +00:00
2008-07-25 22:15:18 +00:00
s.template = " cbi/tblsection "
2008-04-26 17:55:16 +00:00
s.addremove = true
s.anonymous = true
2008-08-26 23:00:44 +00:00
local uci = luci.model . uci.cursor ( )
2011-10-18 09:23:27 +00:00
zone = s : option ( ListValue , " zone " , translate ( " Firewall zone " ) ,
translate ( " Splash rules are integrated in this firewall zone " ) )
2009-06-16 21:41:29 +00:00
2008-08-26 23:00:44 +00:00
uci : foreach ( " firewall " , " zone " ,
2008-06-05 19:16:38 +00:00
function ( section )
2008-08-07 20:21:38 +00:00
zone : value ( section.name )
2008-06-05 19:16:38 +00:00
end )
2008-08-05 12:58:20 +00:00
2011-10-18 09:23:27 +00:00
iface = s : option ( ListValue , " network " , translate ( " Network " ) ,
translate ( " Intercept client traffic on this Interface " ) )
2009-06-16 21:41:29 +00:00
2008-08-26 23:00:44 +00:00
uci : foreach ( " network " , " interface " ,
2008-08-07 20:21:38 +00:00
function ( section )
if section [ " .name " ] ~= " loopback " then
iface : value ( section [ " .name " ] )
end
end )
2008-08-26 23:00:44 +00:00
uci : foreach ( " network " , " alias " ,
2008-08-07 20:21:38 +00:00
function ( section )
iface : value ( section [ " .name " ] )
end )
2008-04-26 17:55:16 +00:00
2009-06-16 21:41:29 +00:00
2011-10-18 09:23:27 +00:00
s = m : section ( TypedSection , " whitelist " , translate ( " Whitelist " ) ,
2011-10-18 17:42:26 +00:00
translate ( " MAC addresses of whitelisted clients. These do not need to accept the splash and are not bandwidth limited. " ) )
2009-06-16 21:41:29 +00:00
2008-07-25 22:15:18 +00:00
s.template = " cbi/tblsection "
2008-04-26 17:55:16 +00:00
s.addremove = true
s.anonymous = true
2011-10-18 09:23:27 +00:00
s : option ( Value , " mac " , translate ( " MAC Address " ) )
2008-04-26 17:55:16 +00:00
2009-06-16 21:41:29 +00:00
2011-10-18 09:23:27 +00:00
s = m : section ( TypedSection , " blacklist " , translate ( " Blacklist " ) ,
translate ( " MAC addresses in this list are blocked. " ) )
2009-06-16 21:41:29 +00:00
2008-07-25 22:15:18 +00:00
s.template = " cbi/tblsection "
2008-04-26 17:55:16 +00:00
s.addremove = true
s.anonymous = true
2011-10-18 09:23:27 +00:00
s : option ( Value , " mac " , translate ( " MAC Address " ) )
2009-06-16 21:41:29 +00:00
2011-10-18 09:23:27 +00:00
s = m : section ( TypedSection , " subnet " , translate ( " Allowed hosts/subnets " ) ,
2013-08-18 20:37:35 +00:00
translate ( " Destination hosts and networks that are excluded from splashing, i.e. they are always allowed. " ) )
2009-06-16 21:41:29 +00:00
s.template = " cbi/tblsection "
s.addremove = true
s.anonymous = true
2011-10-18 09:23:27 +00:00
s : option ( Value , " ipaddr " , translate ( " IP Address " ) )
s : option ( Value , " netmask " , translate ( " Netmask " ) , translate ( " optional when using host addresses " ) ) . rmempty = true
2008-04-26 17:55:16 +00:00
2009-06-10 23:39:40 +00:00
return m