From 357da1d15af7044e9658652c470d68391bd460fa Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Wed, 6 Jun 2018 18:27:55 -0400 Subject: [PATCH] Expose both name and IP of client Signed-off-by: Mcat12 --- api_FTL.php | 6 +++++- scripts/pi-hole/js/index.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api_FTL.php b/api_FTL.php index f1d7a5a7..3cf3f5f4 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -353,7 +353,11 @@ else $client_names = array(); foreach($return as $line) { - $client_names[] = $line; + $tmp = explode(" ", $line); + $client_names[] = array( + "name" => $tmp[0], + "ip" => $tmp[1] + ); } $result = array('clients' => $client_names); diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 0ace02af..e91369eb 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -386,7 +386,7 @@ function updateClientsOverTime() { for (key in data.clients) { if (!{}.hasOwnProperty.call(data.clients, key)) continue; - labels.push(data.clients[key]); + labels.push(data.clients[key].name); } // Get colors from AdminLTE var colors = [];