diff --git a/api_FTL.php b/api_FTL.php index 85ee3f8a..daf72307 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -288,6 +288,11 @@ else // Get specific domain only sendRequestFTL("getallqueries-domain ".$_GET['domain']); } + else if(isset($_GET['client']) && (isset($_GET['type']) && $_GET['type'] === "blocked")) + { + // Get specific client only + sendRequestFTL("getallqueries-client-blocked ".$_GET['client']); + } else if(isset($_GET['client'])) { // Get specific client only diff --git a/queries.php b/queries.php index 559e9cbf..c01882f9 100644 --- a/queries.php +++ b/queries.php @@ -28,6 +28,10 @@ if(isset($setupVars["API_QUERY_LOG_SHOW"])) $showing = "showing no queries (due to setting)"; } } +else if(isset($_GET["type"]) && $_GET["type"] === "blocked") +{ + $showing = "showing blocked"; +} else { // If filter variable is not set, we @@ -44,6 +48,24 @@ else if(isset($_GET["client"])) { $showing .= " queries for client ".htmlentities($_GET["client"]); } +else if(isset($_GET["forwarddest"])) +{ + if($_GET["forwarddest"] === "blocklist") + $showing .= " queries answered from blocklists"; + elseif($_GET["forwarddest"] === "cache") + $showing .= " queries answered from cache"; + else + $showing .= " queries for upstream destination ".htmlentities($_GET["forwarddest"]); +} +else if(isset($_GET["querytype"])) +{ + $qtypes = ["A (IPv4)", "AAAA (IPv6)", "ANY", "SRV", "SOA", "PTR", "TXT", "NAPTR"]; + $qtype = intval($_GET["querytype"]); + if($qtype > 0 && $qtype <= count($qtypes)) + $showing .= " ".$qtypes[$qtype-1]." queries"; + else + $showing .= " type ".$qtype." queries"; +} else if(isset($_GET["domain"])) { $showing .= " queries for domain ".htmlentities($_GET["domain"]); diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 5c056fbc..83f49b02 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -592,7 +592,7 @@ function updateTopClientsChart() { url = '' + clientname + @@ -1001,6 +1001,24 @@ $(function () { return false; }); + $("#clientsChart").click(function (evt) { + var activePoints = clientsChart.getElementAtEvent(evt); + if (activePoints.length > 0) { + //get the internal index of slice in pie chart + var clickedElementindex = activePoints[0]._index; + + //get specific label by index + var label = clientsChart.data.labels[clickedElementindex]; + + //get value by index + var from = label / 1000 - 300; + var until = label / 1000 + 300; + window.location.href = "queries.php?from=" + from + "&until=" + until; + } + + return false; + }); + if (document.getElementById("queryTypePieChart")) { ctx = document.getElementById("queryTypePieChart").getContext("2d"); queryTypePieChart = new Chart(ctx, { diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 0055ea5a..16dc33f9 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -148,6 +148,10 @@ $(function () { APIstring += "=100"; } + if ("type" in GETDict) { + APIstring += "&type=" + GETDict.type; + } + tableApi = $("#all-queries").DataTable({ rowCallback: function (row, data) { // DNSSEC status