summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.net>2020-04-03 12:25:17 +0000
committerStan Grishin <stangri@melmac.net>2020-04-03 12:25:17 +0000
commita339b8b649405819a8838cf2dd6e0cad813f89e6 (patch)
tree808fb6fc293353051bbd6bcc7b402a75fd22af17 /applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua
parent015712bba0fe4b036b4d12235a7b664d5b4cf3fe (diff)
luci-app-simple-adblock: better service control & buttons styling
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua')
-rw-r--r--applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua b/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua
index ce5626f8e6..15e757cf41 100644
--- a/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua
+++ b/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua
@@ -49,13 +49,12 @@ elseif targetDNS == "unbound.adb_list" then
outputGzip="/etc/" .. packageName .. ".unbound.gz"
end
-local tmpfs
+local tmpfs, tmpfsMessage, tmpfsError, tmpfsStats
+local tmpfsVersion, tmpfsStatus = "", "Stopped"
if fs.access("/var/run/" .. packageName .. ".json") then
tmpfs = jsonc.parse(util.trim(sys.exec("cat /var/run/" .. packageName .. ".json")))
end
-local tmpfsVersion, tmpfsStatus = "", "Stopped"
-local tmpfsMessage, tmpfsError, tmpfsStats
if tmpfs and tmpfs['data'] then
if tmpfs['data']['status'] and tmpfs['data']['status'] ~= "" then
tmpfsStatus = tmpfs['data']['status']
@@ -109,7 +108,7 @@ errorTable["errorParsingList"] = translate("failed to parse")
m = Map("simple-adblock", translate("Simple AdBlock Settings"))
m.apply_on_parse = true
m.on_after_apply = function(self)
- sys.call("/etc/init.d/simple-adblock restart")
+ sys.call("/etc/init.d/simple-adblock restart")
end
h = m:section(NamedSection, "config", "simple-adblock", translate("Service Status") .. " [" .. tmpfsVersion .. "]")
@@ -144,7 +143,6 @@ else
ss = h:option(DummyValue, "_dummy", translate("Service Status"))
ss.template = "simple-adblock/status"
if tmpfsStatus == "statusSuccess" then
--- ss.value = tmpfsStats
ss.value = tmpfsVersion .. " " .. translate("is blocking") ..
" " .. util.trim(sys.exec("wc -l < " .. outputFile)) ..
" " .. translate("domains") .. " (" .. translate("with") ..
@@ -172,8 +170,10 @@ else
end
end
end
- buttons = h:option(DummyValue, "_dummy")
- buttons.template = "simple-adblock/buttons"
+ if tmpfsVersion ~= "" then
+ buttons = h:option(DummyValue, "_dummy")
+ buttons.template = packageName .. "/buttons"
+ end
end
s = m:section(NamedSection, "config", "simple-adblock", translate("Configuration"))