1 m = Map("simple-adblock", translate("Simple AdBlock Settings"))
2 s = m:section(NamedSection, "config", "simple-adblock")
5 e = s:option(Flag, "enabled", translate("Enable/start service"))
8 function e.cfgvalue(self, section)
9 return self.map:get(section, "enabled") == "1" and luci.sys.init.enabled("simple-adblock") and self.enabled or self.disabled
12 function e.write(self, section, value)
14 luci.sys.call("/etc/init.d/simple-adblock enable >/dev/null")
15 luci.sys.call("/etc/init.d/simple-adblock start >/dev/null")
17 luci.sys.call("/etc/init.d/simple-adblock stop >/dev/null")
19 return Flag.write(self, section, value)
22 o2 = s:option(ListValue, "verbosity", translate("Output Verbosity Setting"),translate("Controls system log and console output verbosity"))
23 o2:value("0", translate("Suppress output"))
24 o2:value("1", translate("Some output"))
25 o2:value("2", translate("Verbose output"))
29 o3 = s:option(ListValue, "force_dns", translate("Force Router DNS"), translate("Forces Router DNS use on local devices, also known as DNS Hijacking"))
30 o3:value("0", translate("Let local devices use their own DNS servers if set"))
31 o3:value("1", translate("Force Router DNS server to all local devices"))
36 local sysfs_path = "/sys/class/leds/"
38 if nixio.fs.access(sysfs_path) then
39 leds = nixio.util.consume((nixio.fs.dir(sysfs_path)))
42 o3 = s:option(Value, "led", translate("LED to indicate status"), translate("Pick the LED not already used in")
43 .. [[ <a href="]] .. luci.dispatcher.build_url("admin/system/leds") .. [[">]]
44 .. translate("System LED Configuration") .. [[</a>]])
46 o3:value("", translate("none"))
47 for k, v in ipairs(leds) do
53 s2 = m:section(NamedSection, "config", "simple-adblock")
54 -- Whitelisted Domains
55 d1 = s2:option(DynamicList, "whitelist_domain", translate("Whitelisted Domains"), translate("Individual domains to be whitelisted"))
59 -- Blacklisted Domains
60 d3 = s2:option(DynamicList, "blacklist_domain", translate("Blacklisted Domains"), translate("Individual domains to be blacklisted"))
64 -- Whitelisted Domains URLs
65 d2 = s2:option(DynamicList, "whitelist_domains_url", translate("Whitelisted Domain URLs"), translate("URLs to lists of domains to be whitelisted"))
69 -- Blacklisted Domains URLs
70 d4 = s2:option(DynamicList, "blacklist_domains_url", translate("Blacklisted Domain URLs"), translate("URLs to lists of domains to be blacklisted"))
74 -- Blacklisted Hosts URLs
75 d5 = s2:option(DynamicList, "blacklist_hosts_url", translate("Blacklisted Hosts URLs"), translate("URLs to lists of hosts to be blacklisted"))