summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-adblock/luasrc/controller
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2019-01-14 16:00:06 +0100
committerDirk Brenken <dev@brenken.org>2019-01-14 16:02:46 +0100
commitf6ff32c40d51113dfb55b6589562cc452f6dbc30 (patch)
tree184ca7e0dd953a216d20ebd739b79634c3512c6f /applications/luci-app-adblock/luasrc/controller
parent47d9205fe9b82d3a434def60e479c23ef491a06d (diff)
luci-app-adblock: sync with release 3.6.3
* the DNS Report now displays the hostname, MAC-Address or client IP (CLI & LuCI) * Filter the DNS Query result set for a particular domain, client or time frame (CLI & LuCI) * remove needless XHR.Poll-Events from Reporting page in LuCI * remove needless 'force sort' option in LuCI Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-adblock/luasrc/controller')
-rw-r--r--applications/luci-app-adblock/luasrc/controller/adblock.lua27
1 files changed, 23 insertions, 4 deletions
diff --git a/applications/luci-app-adblock/luasrc/controller/adblock.lua b/applications/luci-app-adblock/luasrc/controller/adblock.lua
index e5061bc9d9..4641ac93bb 100644
--- a/applications/luci-app-adblock/luasrc/controller/adblock.lua
+++ b/applications/luci-app-adblock/luasrc/controller/adblock.lua
@@ -1,4 +1,4 @@
--- Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
+-- Copyright 2017-2019 Dirk Brenken (dev@brenken.org)
-- This is free software, licensed under the Apache License, Version 2.0
module("luci.controller.adblock", package.seeall)
@@ -31,7 +31,20 @@ function index()
entry({"admin", "services", "adblock", "action"}, call("adb_action"), nil).leaf = true
end
-function adb_action(name, domain)
+function adb_action(name, ...)
+ local domain = select(1, ...) or ""
+ local search = select(2, ...) or "+"
+ local count = select(3, ...) or "50"
+ local filter = select(4, ...) or "false"
+ local print = select(5, ...) or "false"
+
+ local report_params = {
+ search,
+ count,
+ filter,
+ print
+ }
+
if name == "do_suspend" then
luci.sys.call("/etc/init.d/adblock suspend >/dev/null 2>&1")
elseif name == "do_resume" then
@@ -45,11 +58,17 @@ function adb_action(name, domain)
until nixio.fs.readfile(pid_file) == ""
end
elseif name == "do_report" then
- luci.sys.call("/etc/init.d/adblock report false >/dev/null 2>&1")
+ luci.sys.call("/etc/init.d/adblock report " ..table.concat(report_params, " ").. " >/dev/null 2>&1")
local rep_dir = uci:get("adblock", "extra", "adb_repdir") or "/tmp"
repeat
nixio.nanosleep(1)
until not nixio.fs.access(rep_dir.. "/adb_report.raw")
+ elseif name == "do_filter" then
+ luci.sys.call("/etc/init.d/adblock report " ..table.concat(report_params, " ").. " >/dev/null 2>&1")
+ local rep_dir = uci:get("adblock", "extra", "adb_repdir") or "/tmp"
+ repeat
+ nixio.nanosleep(1)
+ until nixio.fs.access(rep_dir.. "/adb_report.final")
elseif name == "add_blacklist" then
local file = uci:get("adblock", "blacklist", "adb_src") or "/etc/adblock/adblock.blacklist"
if nixio.fs.access(file) then
@@ -110,7 +129,7 @@ function report_text()
local content
rep_dir = uci:get("adblock", "extra", "adb_repdir") or "/tmp"
- rep_file = rep_dir.. "/adb_report"
+ rep_file = rep_dir.. "/adb_report.final"
http.prepare_content("text/plain")
if nixio.fs.access(rep_file) then