summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-splash/luasrc/model/cbi/splash/splash.lua
blob: bd88e8a6e274570a5672276900397d60e77a2629 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
-- Licensed to the public under the Apache License 2.0.

require("luci.model.uci")

m = Map("luci_splash", translate("Client-Splash"), translate("Client-Splash is a hotspot authentication system for wireless mesh networks."))

s = m:section(NamedSection, "general", "core", translate("General"))
s.addremove = false

s:option(Value, "leasetime", translate("Clearance time"), translate("Clients that have accepted the splash are allowed to use the network for that many hours."))
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

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)"))

s:option(DummyValue, "_tmp", "",
	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."))

s = m:section(TypedSection, "iface", translate("Interfaces"), translate("Interfaces that are used for Splash."))

s.template = "cbi/tblsection"
s.addremove = true
s.anonymous = true

local uci = luci.model.uci.cursor()

zone = s:option(ListValue, "zone", translate("Firewall zone"),
	translate("Splash rules are integrated in this firewall zone"))

uci:foreach("firewall", "zone",
	function (section)
		zone:value(section.name)
	end)
	
iface = s:option(ListValue, "network", translate("Network"),
	translate("Intercept client traffic on this Interface"))

uci:foreach("network", "interface",
	function (section)
		if section[".name"] ~= "loopback" then
			iface:value(section[".name"])
		end
	end)
	
uci:foreach("network", "alias",
	function (section)
		iface:value(section[".name"])
	end)


s = m:section(TypedSection, "whitelist", translate("Whitelist"),
	translate("MAC addresses of whitelisted clients. These do not need to accept the splash and are not bandwidth limited."))

s.template = "cbi/tblsection"
s.addremove = true
s.anonymous = true
s:option(Value, "mac", translate ("MAC Address"))


s = m:section(TypedSection, "blacklist", translate("Blacklist"),
	translate("MAC addresses in this list are blocked."))

s.template = "cbi/tblsection"
s.addremove = true
s.anonymous = true
s:option(Value, "mac", translate ("MAC Address"))

s = m:section(TypedSection, "subnet", translate("Allowed hosts/subnets"),
	translate("Destination hosts and networks that are excluded from splashing, i.e. they are always allowed."))

s.template = "cbi/tblsection"
s.addremove = true
s.anonymous = true
s:option(Value, "ipaddr", translate("IP Address"))
s:option(Value, "netmask", translate("Netmask"), translate("optional when using host addresses")).rmempty = true
	
return m