Merge pull request #1597 from stangri/luci-app-simple-adblock
luci-app-simple-adblock: Better logic to start/stop/reload from Web UI
This commit is contained in:
commit
5e59ba3e0d
3 changed files with 9 additions and 18 deletions
|
@ -7,9 +7,10 @@ PKG_LICENSE:=GPL-3.0+
|
||||||
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
|
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
|
||||||
|
|
||||||
LUCI_TITLE:=Simple Adblock Web UI
|
LUCI_TITLE:=Simple Adblock Web UI
|
||||||
LUCI_DEPENDS:=+simple-adblock
|
LUCI_DESCRIPTION:=Provides Web UI for simple-adblock service.
|
||||||
|
LUCI_DEPENDS:=+luci +simple-adblock
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=5
|
||||||
|
|
||||||
include ../../luci.mk
|
include ../../luci.mk
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,11 @@ m = Map("simple-adblock", translate("Simple AdBlock Settings"))
|
||||||
s = m:section(NamedSection, "config", "simple-adblock")
|
s = m:section(NamedSection, "config", "simple-adblock")
|
||||||
|
|
||||||
-- General options
|
-- General options
|
||||||
e = s:option(Flag, "enabled", translate("Enable/start service"))
|
e = s:option(Flag, "enabled", translate("Start Simple Adblock service"))
|
||||||
e.rmempty = false
|
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)
|
function e.write(self, section, value)
|
||||||
if value == "1" then
|
if value ~= "1" then
|
||||||
luci.sys.call("/etc/init.d/simple-adblock enable >/dev/null")
|
luci.sys.init.stop("simple-adblock")
|
||||||
luci.sys.call("/etc/init.d/simple-adblock start >/dev/null")
|
|
||||||
else
|
|
||||||
luci.sys.call("/etc/init.d/simple-adblock stop >/dev/null")
|
|
||||||
end
|
end
|
||||||
return Flag.write(self, section, value)
|
return Flag.write(self, section, value)
|
||||||
end
|
end
|
||||||
|
@ -32,7 +24,6 @@ o3:value("1", translate("Force Router DNS server to all local devices"))
|
||||||
o3.rmempty = false
|
o3.rmempty = false
|
||||||
o3.default = 1
|
o3.default = 1
|
||||||
|
|
||||||
|
|
||||||
local sysfs_path = "/sys/class/leds/"
|
local sysfs_path = "/sys/class/leds/"
|
||||||
local leds = {}
|
local leds = {}
|
||||||
if nixio.fs.access(sysfs_path) then
|
if nixio.fs.access(sysfs_path) then
|
||||||
|
@ -49,7 +40,6 @@ if #leds ~= 0 then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
s2 = m:section(NamedSection, "config", "simple-adblock")
|
s2 = m:section(NamedSection, "config", "simple-adblock")
|
||||||
-- Whitelisted Domains
|
-- Whitelisted Domains
|
||||||
d1 = s2:option(DynamicList, "whitelist_domain", translate("Whitelisted Domains"), translate("Individual domains to be whitelisted"))
|
d1 = s2:option(DynamicList, "whitelist_domain", translate("Whitelisted Domains"), translate("Individual domains to be whitelisted"))
|
||||||
|
|
|
@ -13,9 +13,6 @@ msgstr ""
|
||||||
msgid "Controls system log and console output verbosity"
|
msgid "Controls system log and console output verbosity"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Enable/start service"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Force Router DNS"
|
msgid "Force Router DNS"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -52,6 +49,9 @@ msgstr ""
|
||||||
msgid "Some output"
|
msgid "Some output"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Start Simple Adblock service"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Suppress output"
|
msgid "Suppress output"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue