summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2017-05-08 12:28:06 +0300
committerGitHub <noreply@github.com>2017-05-08 12:28:06 +0300
commit7f256e257c98a6e81dca448532acb4d6d0cf9d1d (patch)
treec89420dabecb7656c17a1b90093acd294aff71d3 /applications
parentfb2e4a80c1ac5853cb660e2df7f1deade4d4a05c (diff)
parent9b4b1dfebdf6818231898a7f4fb80774bc106e26 (diff)
Merge pull request #1157 from dibdot/app-adblock
luci-app-adblock: sync with adblock 2.6.3
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-app-adblock/luasrc/controller/adblock.lua2
-rw-r--r--applications/luci-app-adblock/luasrc/model/cbi/adblock/blacklist_tab.lua14
-rw-r--r--applications/luci-app-adblock/luasrc/model/cbi/adblock/configuration_tab.lua2
-rw-r--r--applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua16
-rw-r--r--applications/luci-app-adblock/luasrc/model/cbi/adblock/whitelist_tab.lua11
5 files changed, 37 insertions, 8 deletions
diff --git a/applications/luci-app-adblock/luasrc/controller/adblock.lua b/applications/luci-app-adblock/luasrc/controller/adblock.lua
index b37fcd889..03b9fc20e 100644
--- a/applications/luci-app-adblock/luasrc/controller/adblock.lua
+++ b/applications/luci-app-adblock/luasrc/controller/adblock.lua
@@ -13,7 +13,7 @@ function index()
return
end
entry({"admin", "services", "adblock"}, firstchild(), _("Adblock"), 30).dependent = false
- entry({"admin", "services", "adblock", "tab_from_cbi"}, cbi("adblock/overview_tab"), _("Overview"), 10).leaf = true
+ entry({"admin", "services", "adblock", "tab_from_cbi"}, cbi("adblock/overview_tab", {hideresetbtn=true, hidesavebtn=true}), _("Overview"), 10).leaf = true
entry({"admin", "services", "adblock", "logfile"}, call("logread"), _("View Logfile"), 20).leaf = true
entry({"admin", "services", "adblock", "advanced"}, firstchild(), _("Advanced"), 100)
entry({"admin", "services", "adblock", "advanced", "blacklist"}, cbi("adblock/blacklist_tab"), _("Edit Blacklist"), 110).leaf = true
diff --git a/applications/luci-app-adblock/luasrc/model/cbi/adblock/blacklist_tab.lua b/applications/luci-app-adblock/luasrc/model/cbi/adblock/blacklist_tab.lua
index d540c77d1..722b23f20 100644
--- a/applications/luci-app-adblock/luasrc/model/cbi/adblock/blacklist_tab.lua
+++ b/applications/luci-app-adblock/luasrc/model/cbi/adblock/blacklist_tab.lua
@@ -7,7 +7,19 @@ local uci = require("uci")
local adbinput = uci.get("adblock", "blacklist", "adb_src" or "/etc/adblock/adblock.blacklist")
if not nixio.fs.access(adbinput) then
- m = SimpleForm("error", nil, translate("Input file not found, please check your configuration."))
+ m = SimpleForm("error", nil,
+ translate("Input file not found. Please check your configuration."))
+ m.reset = false
+ m.submit = false
+ return m
+end
+
+if nixio.fs.stat(adbinput).size > 524288 then
+ m = SimpleForm("error", nil,
+ translate("The file size is too large for online editing in LuCI (&gt; 512 KB). ")
+ .. translate("Please edit this file directly in a terminal session."))
+ m.reset = false
+ m.submit = false
return m
end
diff --git a/applications/luci-app-adblock/luasrc/model/cbi/adblock/configuration_tab.lua b/applications/luci-app-adblock/luasrc/model/cbi/adblock/configuration_tab.lua
index 1b83c949e..1607f1440 100644
--- a/applications/luci-app-adblock/luasrc/model/cbi/adblock/configuration_tab.lua
+++ b/applications/luci-app-adblock/luasrc/model/cbi/adblock/configuration_tab.lua
@@ -7,6 +7,8 @@ local adbinput = "/etc/config/adblock"
if not nixio.fs.access(adbinput) then
m = SimpleForm("error", nil, translate("Input file not found, please check your configuration."))
+ m.reset = false
+ m.submit = false
return m
end
diff --git a/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua b/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua
index d2740f4da..f71fb7ba4 100644
--- a/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua
+++ b/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua
@@ -12,12 +12,14 @@ local dnsFile2 = sys.exec("find '/var/lib/unbound/.adb_hidden' -maxdepth 1 -type
m = Map("adblock", translate("Adblock"),
translate("Configuration of the adblock package to block ad/abuse domains by using DNS. ")
- .. translate("For further information ")
- .. [[<a href="https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md" target="_blank">]]
- .. translate("see online documentation")
- .. [[</a>]]
- .. translate("."))
-m.reset = false
+ .. translatef("For further information "
+ .. "<a href=\"%s\" target=\"_blank\">"
+ .. "see online documentation</a>", "https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md"))
+
+function m.on_after_commit(self)
+ luci.sys.call("/etc/init.d/adblock reload >/dev/null 2>&1")
+ luci.http.redirect(luci.dispatcher.build_url("admin", "services", "adblock"))
+end
-- Main adblock options
@@ -34,6 +36,7 @@ if dnsFile1 ~= "" or dnsFile2 ~= "" then
btn.disabled = false
function btn.write()
luci.sys.call("/etc/init.d/adblock resume >/dev/null 2>&1")
+ luci.http.redirect(luci.dispatcher.build_url("admin", "services", "adblock"))
end
else
btn.inputtitle = translate("Suspend adblock")
@@ -41,6 +44,7 @@ else
btn.disabled = false
function btn.write()
luci.sys.call("/etc/init.d/adblock suspend >/dev/null 2>&1")
+ luci.http.redirect(luci.dispatcher.build_url("admin", "services", "adblock"))
end
end
diff --git a/applications/luci-app-adblock/luasrc/model/cbi/adblock/whitelist_tab.lua b/applications/luci-app-adblock/luasrc/model/cbi/adblock/whitelist_tab.lua
index 23c99a977..10a593859 100644
--- a/applications/luci-app-adblock/luasrc/model/cbi/adblock/whitelist_tab.lua
+++ b/applications/luci-app-adblock/luasrc/model/cbi/adblock/whitelist_tab.lua
@@ -8,6 +8,17 @@ local adbinput = uci.get("adblock", "global", "adb_whitelist") or "/etc/adblock/
if not nixio.fs.access(adbinput) then
m = SimpleForm("error", nil, translate("Input file not found, please check your configuration."))
+ m.reset = false
+ m.submit = false
+ return m
+end
+
+if nixio.fs.stat(adbinput).size > 524288 then
+ m = SimpleForm("error", nil,
+ translate("The file size is too large for online editing in LuCI (&gt; 512 KB). ")
+ .. translate("Please edit this file directly in a terminal session."))
+ m.reset = false
+ m.submit = false
return m
end