Merge pull request #1818 from dibdot/lxc_fix
[project/luci.git] / applications / luci-app-simple-adblock / luasrc / model / cbi / simpleadblock.lua
1 m = Map("simple-adblock", translate("Simple AdBlock Settings"))
2 s = m:section(NamedSection, "config", "simple-adblock")
3
4 -- General options
5 e = s:option(Flag, "enabled", translate("Start Simple Adblock service"))
6 e.rmempty  = false
7 function e.write(self, section, value)
8         if value ~= "1" then
9                 luci.sys.init.stop("simple-adblock")
10         end
11         return Flag.write(self, section, value)
12 end
13
14 o2 = s:option(ListValue, "verbosity", translate("Output Verbosity Setting"),translate("Controls system log and console output verbosity"))
15 o2:value("0", translate("Suppress output"))
16 o2:value("1", translate("Some output"))
17 o2:value("2", translate("Verbose output"))
18 o2.rmempty = false
19 o2.default = 2
20
21 o3 = s:option(ListValue, "force_dns", translate("Force Router DNS"), translate("Forces Router DNS use on local devices, also known as DNS Hijacking"))
22 o3:value("0", translate("Let local devices use their own DNS servers if set"))
23 o3:value("1", translate("Force Router DNS server to all local devices"))
24 o3.rmempty = false
25 o3.default = 1
26
27 local sysfs_path = "/sys/class/leds/"
28 local leds = {}
29 if nixio.fs.access(sysfs_path) then
30         leds = nixio.util.consume((nixio.fs.dir(sysfs_path)))
31 end
32 if #leds ~= 0 then
33         o3 = s:option(Value, "led", translate("LED to indicate status"), translate("Pick the LED not already used in")
34                 .. [[ <a href="]] .. luci.dispatcher.build_url("admin/system/leds") .. [[">]]
35                 .. translate("System LED Configuration") .. [[</a>]])
36         o3.rmempty = true
37         o3:value("", translate("none"))
38         for k, v in ipairs(leds) do
39                 o3:value(v)
40         end
41 end
42
43 s2 = m:section(NamedSection, "config", "simple-adblock")
44 -- Whitelisted Domains
45 d1 = s2:option(DynamicList, "whitelist_domain", translate("Whitelisted Domains"), translate("Individual domains to be whitelisted"))
46 d1.addremove = false
47 d1.optional = false
48
49 -- Blacklisted Domains
50 d3 = s2:option(DynamicList, "blacklist_domain", translate("Blacklisted Domains"), translate("Individual domains to be blacklisted"))
51 d3.addremove = false
52 d3.optional = false
53
54 -- Whitelisted Domains URLs
55 d2 = s2:option(DynamicList, "whitelist_domains_url", translate("Whitelisted Domain URLs"), translate("URLs to lists of domains to be whitelisted"))
56 d2.addremove = false
57 d2.optional = false
58
59 -- Blacklisted Domains URLs
60 d4 = s2:option(DynamicList, "blacklist_domains_url", translate("Blacklisted Domain URLs"), translate("URLs to lists of domains to be blacklisted"))
61 d4.addremove = false
62 d4.optional = false
63
64 -- Blacklisted Hosts URLs
65 d5 = s2:option(DynamicList, "blacklist_hosts_url", translate("Blacklisted Hosts URLs"), translate("URLs to lists of hosts to be blacklisted"))
66 d5.addremove = false
67 d5.optional = false
68
69 return m