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.init.enable("simple-adblock")
15 luci.sys.init.start("simple-adblock")
17 luci.sys.init.stop("simple-adblock")
18 luci.sys.init.disable("simple-adblock")
20 return Flag.write(self, section, value)
23 o2 = s:option(ListValue, "verbosity", translate("Output Verbosity Setting"),translate("Controls system log and console output verbosity"))
24 o2:value("0", translate("Suppress output"))
25 o2:value("1", translate("Some output"))
26 o2:value("2", translate("Verbose output"))
30 o3 = s:option(ListValue, "force_dns", translate("Force Router DNS"), translate("Forces Router DNS use on local devices, also known as DNS Hijacking"))
31 o3:value("0", translate("Let local devices use their own DNS servers if set"))
32 o3:value("1", translate("Force Router DNS server to all local devices"))
37 local sysfs_path = "/sys/class/leds/"
39 if nixio.fs.access(sysfs_path) then
40 leds = nixio.util.consume((nixio.fs.dir(sysfs_path)))
43 o3 = s:option(Value, "led", translate("LED to indicate status"), translate("Pick the LED not already used in")
44 .. [[ <a href="]] .. luci.dispatcher.build_url("admin/system/leds") .. [[">]]
45 .. translate("System LED Configuration") .. [[</a>]])
47 o3:value("", translate("none"))
48 for k, v in ipairs(leds) do
54 s2 = m:section(NamedSection, "config", "simple-adblock")
55 -- Whitelisted Domains
56 d1 = s2:option(DynamicList, "whitelist_domain", translate("Whitelisted Domains"), translate("Individual domains to be whitelisted"))
60 -- Blacklisted Domains
61 d3 = s2:option(DynamicList, "blacklist_domain", translate("Blacklisted Domains"), translate("Individual domains to be blacklisted"))
65 -- Whitelisted Domains URLs
66 d2 = s2:option(DynamicList, "whitelist_domains_url", translate("Whitelisted Domain URLs"), translate("URLs to lists of domains to be whitelisted"))
70 -- Blacklisted Domains URLs
71 d4 = s2:option(DynamicList, "blacklist_domains_url", translate("Blacklisted Domain URLs"), translate("URLs to lists of domains to be blacklisted"))
75 -- Blacklisted Hosts URLs
76 d5 = s2:option(DynamicList, "blacklist_hosts_url", translate("Blacklisted Hosts URLs"), translate("URLs to lists of hosts to be blacklisted"))