luci-app-simple-adblock: bugfix for service start/stop 1597/head
authorStan Grishin <stangri@melmac.net>
Thu, 25 Jan 2018 23:05:28 +0000 (15:05 -0800)
committerStan Grishin <stangri@melmac.net>
Fri, 26 Jan 2018 03:51:03 +0000 (19:51 -0800)
Signed-off-by: Stan Grishin <stangri@melmac.net>
applications/luci-app-simple-adblock/luasrc/model/cbi/simpleadblock.lua
applications/luci-app-simple-adblock/po/templates/simple-adblock.pot

index e80cfb3..2267212 100644 (file)
@@ -2,20 +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.init.enable("simple-adblock")
-               luci.sys.init.start("simple-adblock")
-       else
+       if value ~= "1" then
                luci.sys.init.stop("simple-adblock")
-               luci.sys.init.disable("simple-adblock")
        end
        return Flag.write(self, section, value)
 end
@@ -33,7 +24,6 @@ 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
@@ -50,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"))
index 4cfff96..1a71cae 100644 (file)
@@ -13,9 +13,6 @@ msgstr ""
 msgid "Controls system log and console output verbosity"
 msgstr ""
 
-msgid "Enable/start service"
-msgstr ""
-
 msgid "Force Router DNS"
 msgstr ""
 
@@ -52,6 +49,9 @@ msgstr ""
 msgid "Some output"
 msgstr ""
 
+msgid "Start Simple Adblock service"
+msgstr ""
+
 msgid "Suppress output"
 msgstr ""