diff --git a/api_FTL.php b/api_FTL.php index d4e1c085..61efa5b9 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -230,6 +230,10 @@ if (isset($_GET['getAllQueries']) && $auth) // Get specific client only sendRequestFTL("getallqueries-client ".$_GET['client']); } + else if(is_numeric($_GET['getAllQueries'])) + { + sendRequestFTL("getallqueries (".$_GET['getAllQueries'].")"); + } else { // Get all queries diff --git a/queries.php b/queries.php index 89ed91d7..be147ec1 100644 --- a/queries.php +++ b/queries.php @@ -19,47 +19,49 @@ if(isset($setupVars["API_QUERY_LOG_SHOW"])) { if($setupVars["API_QUERY_LOG_SHOW"] === "all") { - $showing = "showing all queries"; + $showing = "showing"; } elseif($setupVars["API_QUERY_LOG_SHOW"] === "permittedonly") { - $showing = "showing permitted queries only"; + $showing = "showing permitted"; } elseif($setupVars["API_QUERY_LOG_SHOW"] === "blockedonly") { - $showing = "showing blocked queries only"; + $showing = "showing blocked"; } elseif($setupVars["API_QUERY_LOG_SHOW"] === "nothing") { - $showing = "showing no queries at all"; + $showing = "showing no queries (due to setting)"; } } else { // If filter variable is not set, we // automatically show all queries - $showing = "showing all queries"; + $showing = "showing queries"; } +$showall = false; if(isset($_GET["all"])) { - $showing .= " within the Pi-hole log"; + $showing .= " all queries within the Pi-hole log"; } else if(isset($_GET["client"])) { - $showing .= " for client ".htmlentities($_GET["client"]); + $showing .= " queries for client ".htmlentities($_GET["client"]); } else if(isset($_GET["domain"])) { - $showing .= " for domain ".htmlentities($_GET["domain"]); + $showing .= " queries for domain ".htmlentities($_GET["domain"]); } -else if(isset($_GET["from"]) && isset($_GET["until"])) +else if(isset($_GET["from"]) || isset($_GET["until"])) { - $showing .= " within limited time interval"; + $showing .= " queries within specified time interval"; } else { - $showing .= " within recent 10 minutes, show all"; + $showing .= " up to 100 queries"; + $showall = true; } if(isset($setupVars["API_PRIVACY_MODE"])) @@ -74,6 +76,8 @@ if(isset($setupVars["API_PRIVACY_MODE"])) if(strlen($showing) > 0) { $showing = "(".$showing.")"; + if($showall) + $showing .= ", show all"; } ?> diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 722f8543..58ec73b9 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -82,7 +82,7 @@ function add(domain,list) { } }); }); - + // Reset Modal after it has faded out alertModal.one("hidden.bs.modal", function() { alProcessing.show(); @@ -136,11 +136,10 @@ $(document).ready(function() { { APIstring += "&domain="+GETDict["domain"]; } + // If we don't ask filtering and also not for all queries, just request the most recent 100 queries else if(!("all" in GETDict)) { - var timestamp = Math.floor(Date.now() / 1000); - APIstring += "&from="+(timestamp - 600); - APIstring += "&until="+(timestamp + 100); + APIstring += "=100"; } tableApi = $("#all-queries").DataTable( {