From f6ff32c40d51113dfb55b6589562cc452f6dbc30 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Mon, 14 Jan 2019 16:00:06 +0100 Subject: 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 --- .../luasrc/view/adblock/report.htm | 162 +++++++++++++++------ 1 file changed, 114 insertions(+), 48 deletions(-) (limited to 'applications/luci-app-adblock/luasrc/view/adblock') diff --git a/applications/luci-app-adblock/luasrc/view/adblock/report.htm b/applications/luci-app-adblock/luasrc/view/adblock/report.htm index 4e3d65ba75..814cc2fb25 100644 --- a/applications/luci-app-adblock/luasrc/view/adblock/report.htm +++ b/applications/luci-app-adblock/luasrc/view/adblock/report.htm @@ -1,5 +1,5 @@ <%# -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 -%> @@ -84,10 +84,10 @@ This is free software, licensed under the Apache License, Version 2.0 s += '
<%:Domain%>
'; s += '
<%:Answer%>
'; s += '
<%:Action%>
'; - var btn; + var btn1; var record; var title_arr = ["<%:Date%>", "<%:Time%>", "<%:Client%>", "<%:Domain%>", "<%:Answer%>", "<%:Action%>"]; - var array = text.split("\n", 50); + var array = text.split("\n"); for (var i=0;i' + record[j] + ''; if (record[4] === "NX") { - btn = '
'; + btn1 = '
'; + } + else if (record[4] === "OK") + { + btn1 = '
'; } else { - btn = '
'; + btn1 = '-' } } - s += btn + '' + s += btn1 + '' } } document.getElementById("value_6").innerHTML = s; @@ -118,27 +122,96 @@ This is free software, licensed under the Apache License, Version 2.0 if (action[0] === "do_report") { - var btn = document.getElementById("btn"); - var btn_running = document.getElementById("btn_running"); + var btn1 = document.getElementById("btn1"); + var btn1_running = document.getElementById("btn1_running"); - btn.disabled = true; - running(btn_running, 1); - action[1] = "-" - } + btn1.disabled = true; + running(btn1_running, 1); + + document.getElementById("filter_search").value = ''; + document.getElementById("filter_count").selectedIndex = 1; - new XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action[0] + "/" + action[1], null, - function(x) + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action[0], null, + function(x) + { + if (!x) + { + return; + } + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_json")%>', null, + function(x, json_info) + { + if (!x || !json_info || !json_info.data) + { + running(btn1_running, 0); + btn1.disabled = false; + return; + } + report_json(json_info); + }); + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_text")%>', null, + function(x) + { + if (!x || !x.responseText) + { + return; + } + report_text(x.responseText); + running(btn1_running, 0); + btn1.disabled = false; + }); + }); + } + else if (action[0] === "do_filter") { - if (!x) + var btn2 = document.getElementById("btn2"); + var btn2_running = document.getElementById("btn2_running"); + var search = document.getElementById("filter_search").value.replace(/[^\x00-\x7F]|[\s!@#$%^&*()+=\[\]{};'"\\|,<>\/?]/g,'') || "\"+\""; + var count = document.getElementById("filter_count").value; + + btn2.disabled = true; + running(btn2_running, 1); + if (search != "\"+\"") { - return; + document.getElementById("filter_search").value = search; } - if (action[0] === "do_report") + + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action[0] + "/" + "-" + "/" + search + "/" + count + "/" + "true" + "/" + "false", null, + function(x) { - running(btn_running, 0); - btn.disabled = false; - } - }); + if (!x) + { + return; + } + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_text")%>', null, + function(x) + { + if (!x || !x.responseText) + { + return; + } + report_text(x.responseText); + running(btn2_running, 0); + btn2.disabled = false; + }); + }); + } + else if (action[0] === "add_blacklist" || action[0] === "add_whitelist") + { + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action[0] + "/" + action[1], null, + function(x) + { + if (!x) + { + return; + } + btn3 = document.getElementsByName(value.name); + for (var i=0; i', null, - function(x, json_info) - { - if (!x || !json_info || !json_info.data) - { - running(btn_running, 0); - btn.disabled = false; + running(btn1_running, 0); + btn1.disabled = false; return; } report_json(json_info); @@ -187,16 +248,6 @@ This is free software, licensed under the Apache License, Version 2.0 } report_text(x.responseText); }); - - XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_text")%>', null, - function(x) - { - if (!x || !x.responseText) - { - return; - } - report_text(x.responseText); - }); //]]> @@ -227,8 +278,8 @@ This is free software, licensed under the Apache License, Version 2.0
- - + +

@@ -236,8 +287,23 @@ This is free software, licensed under the Apache License, Version 2.0

<%:Top 10 Reporting%>

-
+
+
<%:Filter the DNS Query result set for a particular domain, client or time frame.%>
+
+ + + + +
+
+

<%:Latest DNS Queries%>

-- cgit v1.2.3