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..792ee2a3 100644 --- a/queries.php +++ b/queries.php @@ -59,7 +59,7 @@ else if(isset($_GET["from"]) && isset($_GET["until"])) } else { - $showing .= " within recent 10 minutes, show all"; + $showing .= ", most recent 100, show all"; } if(isset($setupVars["API_PRIVACY_MODE"])) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 722f8543..623ce881 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -122,26 +122,27 @@ $(document).ready(function() { location.search.substr(1).split("&").forEach(function(item) {GETDict[item.split("=")[0]] = item.split("=")[1];}); var APIstring = "api.php?getAllQueries"; + var options = ""; if("from" in GETDict && "until" in GETDict) { - APIstring += "&from="+GETDict["from"]; + options += "&from="+GETDict["from"]; APIstring += "&until="+GETDict["until"]; } else if("client" in GETDict) { - APIstring += "&client="+GETDict["client"]; + options += "&client="+GETDict["client"]; } else if("domain" in GETDict) { - APIstring += "&domain="+GETDict["domain"]; + options += "&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"; } + APIstring += options; tableApi = $("#all-queries").DataTable( { "rowCallback": function( row, data, index ){