From 4ee491115add09582fcef6c3108840b8e6bb539d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 13 Nov 2020 00:34:59 +0100 Subject: [PATCH] Show upstream destination a query was sent to in the Query Log (both standard and long-term) Signed-off-by: DL6ER --- api_db.php | 6 +++--- scripts/pi-hole/js/db_queries.js | 5 ++++- scripts/pi-hole/js/queries.js | 6 +++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/api_db.php b/api_db.php index cddfb17a..49270671 100644 --- a/api_db.php +++ b/api_db.php @@ -94,7 +94,7 @@ if (isset($_GET['getAllQueries']) && $auth) { $from = intval($_GET["from"]); $until = intval($_GET["until"]); - $dbquery = "SELECT timestamp, type, domain, client, status FROM queries WHERE timestamp >= :from AND timestamp <= :until "; + $dbquery = "SELECT timestamp, type, domain, client, status, forward FROM queries WHERE timestamp >= :from AND timestamp <= :until "; if(isset($_GET["types"])) { $types = $_GET["types"]; @@ -153,8 +153,8 @@ if (isset($_GET['getAllQueries']) && $auth) $query_type = "UNKN"; break; } - // array: time type domain client status - $allQueries[] = [$row[0], $query_type, utf8_encode($row[2]), utf8_encode($c), $row[4]]; + // array: time type domain client status upstream destination + $allQueries[] = [$row[0], $query_type, utf8_encode($row[2]), utf8_encode($c), $row[4], utf8_encode($row[5])]; } } $result = array('data' => $allQueries); diff --git a/scripts/pi-hole/js/db_queries.js b/scripts/pi-hole/js/db_queries.js index 9c33bd18..6751b00b 100644 --- a/scripts/pi-hole/js/db_queries.js +++ b/scripts/pi-hole/js/db_queries.js @@ -268,7 +268,10 @@ $(function () { break; case 2: color = "green"; - fieldtext = "OK (forwarded)"; + fieldtext = + "OK (forwarded to " + + (data.length > 5 && data[5] !== "N/A" ? data[5] : "") + + ")"; buttontext = ''; break; diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 092dd610..8ff12674 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -188,7 +188,11 @@ $(function () { break; case "2": colorClass = "text-green"; - fieldtext = "OK (forwarded)" + dnssecStatus; + fieldtext = + "OK (forwarded to " + + (data.length > 10 && data[10] !== "N/A" ? data[10] : "") + + ")" + + dnssecStatus; buttontext = ''; break;