splash.lua 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. -- Licensed to the public under the Apache License 2.0.
  2. require("luci.model.uci")
  3. m = Map("luci_splash", translate("Client-Splash"), translate("Client-Splash is a hotspot authentification system for wireless mesh networks."))
  4. s = m:section(NamedSection, "general", "core", translate("General"))
  5. s.addremove = false
  6. s:option(Value, "leasetime", translate("Clearance time"), translate("Clients that have accepted the splash are allowed to use the network for that many hours."))
  7. 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."))
  8. redir.rmempty = true
  9. s:option(Value, "limit_up", translate("Upload limit"), translate("Clients upload speed is limited to this value (kbyte/s)"))
  10. s:option(Value, "limit_down", translate("Download limit"), translate("Clients download speed is limited to this value (kbyte/s)"))
  11. s:option(DummyValue, "_tmp", "",
  12. translate("Bandwidth limit for clients is only activated when both up- and download limit are set. " ..
  13. "Use a value of 0 here to completely disable this limitation. Whitelisted clients are not limited."))
  14. s = m:section(TypedSection, "iface", translate("Interfaces"), translate("Interfaces that are used for Splash."))
  15. s.template = "cbi/tblsection"
  16. s.addremove = true
  17. s.anonymous = true
  18. local uci = luci.model.uci.cursor()
  19. zone = s:option(ListValue, "zone", translate("Firewall zone"),
  20. translate("Splash rules are integrated in this firewall zone"))
  21. uci:foreach("firewall", "zone",
  22. function (section)
  23. zone:value(section.name)
  24. end)
  25. iface = s:option(ListValue, "network", translate("Network"),
  26. translate("Intercept client traffic on this Interface"))
  27. uci:foreach("network", "interface",
  28. function (section)
  29. if section[".name"] ~= "loopback" then
  30. iface:value(section[".name"])
  31. end
  32. end)
  33. uci:foreach("network", "alias",
  34. function (section)
  35. iface:value(section[".name"])
  36. end)
  37. s = m:section(TypedSection, "whitelist", translate("Whitelist"),
  38. translate("MAC addresses of whitelisted clients. These do not need to accept the splash and are not bandwidth limited."))
  39. s.template = "cbi/tblsection"
  40. s.addremove = true
  41. s.anonymous = true
  42. s:option(Value, "mac", translate ("MAC Address"))
  43. s = m:section(TypedSection, "blacklist", translate("Blacklist"),
  44. translate("MAC addresses in this list are blocked."))
  45. s.template = "cbi/tblsection"
  46. s.addremove = true
  47. s.anonymous = true
  48. s:option(Value, "mac", translate ("MAC Address"))
  49. s = m:section(TypedSection, "subnet", translate("Allowed hosts/subnets"),
  50. translate("Destination hosts and networks that are excluded from splashing, i.e. they are always allowed."))
  51. s.template = "cbi/tblsection"
  52. s.addremove = true
  53. s.anonymous = true
  54. s:option(Value, "ipaddr", translate("IP Address"))
  55. s:option(Value, "netmask", translate("Netmask"), translate("optional when using host addresses")).rmempty = true
  56. return m