X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=applications%2Fluci-app-simple-adblock%2Fluasrc%2Fmodel%2Fcbi%2Fsimpleadblock.lua;h=22672124fc9856c75dd590a1133b162d297dcc5f;hb=870c176ca705b92a286e0bb7bb0d9a761c662c13;hp=214f298292b0938851b4c7ce9981ca546bedd177;hpb=dbc156f40ad5fc7294be7b78cc6eb8a59857197f;p=project%2Fluci.git diff --git a/applications/luci-app-simple-adblock/luasrc/model/cbi/simpleadblock.lua b/applications/luci-app-simple-adblock/luasrc/model/cbi/simpleadblock.lua index 214f29829..22672124f 100644 --- a/applications/luci-app-simple-adblock/luasrc/model/cbi/simpleadblock.lua +++ b/applications/luci-app-simple-adblock/luasrc/model/cbi/simpleadblock.lua @@ -2,19 +2,11 @@ m = Map("simple-adblock", translate("Simple AdBlock Settings")) s = m:section(NamedSection, "config", "simple-adblock") -- General options -e = s:option(Flag, "enabled", translate("Enable/start service")) +e = s:option(Flag, "enabled", translate("Start Simple Adblock service")) e.rmempty = false - -function e.cfgvalue(self, section) - return self.map:get(section, "enabled") == "1" and luci.sys.init.enabled("simple-adblock") and self.enabled or self.disabled -end - function e.write(self, section, value) - if value == "1" then - luci.sys.call("/etc/init.d/simple-adblock enable >/dev/null") - luci.sys.call("/etc/init.d/simple-adblock start >/dev/null") - else - luci.sys.call("/etc/init.d/simple-adblock stop >/dev/null") + if value ~= "1" then + luci.sys.init.stop("simple-adblock") end return Flag.write(self, section, value) end @@ -32,15 +24,14 @@ o3:value("1", translate("Force Router DNS server to all local devices")) o3.rmempty = false o3.default = 1 - local sysfs_path = "/sys/class/leds/" local leds = {} if nixio.fs.access(sysfs_path) then leds = nixio.util.consume((nixio.fs.dir(sysfs_path))) end if #leds ~= 0 then - o3 = s:option(Value, "led", translate("LED to indicate status"), translate("Pick the LED not already used in ") - .. [[]] + o3 = s:option(Value, "led", translate("LED to indicate status"), translate("Pick the LED not already used in") + .. [[ ]] .. translate("System LED Configuration") .. [[]]) o3.rmempty = true o3:value("", translate("none")) @@ -49,7 +40,6 @@ if #leds ~= 0 then end end - s2 = m:section(NamedSection, "config", "simple-adblock") -- Whitelisted Domains d1 = s2:option(DynamicList, "whitelist_domain", translate("Whitelisted Domains"), translate("Individual domains to be whitelisted"))