From 8ecd218908750ee9315696e09731dc14be684089 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 18 Nov 2016 21:31:30 +0100 Subject: [PATCH] Many changes that are documented in PR #197 --- api.php | 19 ++++++----- header.php | 19 ++++++++--- index.php | 5 +-- js/pihole/index.js | 85 ++++++++++++++++++++++++---------------------- 4 files changed, 72 insertions(+), 56 deletions(-) diff --git a/api.php b/api.php index c3db7fc4..dfdf9ac5 100644 --- a/api.php +++ b/api.php @@ -1,16 +1,16 @@ - - @@ -278,9 +286,12 @@ // password is set at all, we keep the current // behavior: everything is always authorized // and will be displayed - if(!$auth){ ?> + // + // If auth is required and wrong, we show the reduced + // version of the summary (index) page + if(!$auth && (!isset($indexpage) || isset($_GET['login']))){ ?>
Password:   diff --git a/index.php b/index.php index 270be230..c05cf15e 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,5 @@ @@ -75,7 +76,7 @@ - +
@@ -195,7 +196,7 @@
- + diff --git a/js/pihole/index.js b/js/pihole/index.js index 2851b19e..10942e93 100644 --- a/js/pihole/index.js +++ b/js/pihole/index.js @@ -17,7 +17,10 @@ $(document).ready(function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Windows()); } }; - var animate = false; + + // Get auth hash + hash = document.getElementById("hash").innerHTML; + var ctx = document.getElementById("queryOverTimeChart").getContext("2d"); timeLineChart = new Chart(ctx, { type: 'line', @@ -69,57 +72,57 @@ $(document).ready(function() { } }); - ctx = document.getElementById("queryTypeChart").getContext("2d"); - queryTypeChart = new Chart(ctx, { - type: 'doughnut', - data: { - labels: [], - datasets: [{ data: [] }] - }, - options: { - legend: { - display: false + if(!!document.getElementById("queryTypeChart")) + { + ctx = document.getElementById("queryTypeChart").getContext("2d"); + queryTypeChart = new Chart(ctx, { + type: 'doughnut', + data: { + labels: [], + datasets: [{ data: [] }] }, - animation: { - duration: 2000 - }, - cutoutPercentage: 0 - } - }); + options: { + legend: { + display: false + }, + animation: { + duration: 2000 + }, + cutoutPercentage: 0 + } + }); + updateQueryTypes(); + } - ctx = document.getElementById("forwardDestinationChart").getContext("2d"); - forwardDestinationChart = new Chart(ctx, { - type: 'doughnut', - data: { - labels: [], - datasets: [{ data: [] }] - }, - options: { - legend: { - display: false + if(!!document.getElementById("forwardDestinationChart")) + { + ctx = document.getElementById("forwardDestinationChart").getContext("2d"); + forwardDestinationChart = new Chart(ctx, { + type: 'doughnut', + data: { + labels: [], + datasets: [{ data: [] }] }, - animation: { - duration: 2000 - }, - cutoutPercentage: 0 - } - }); - - // Get auth hash - hash = document.getElementById("hash").innerHTML; - + options: { + legend: { + display: false + }, + animation: { + duration: 2000 + }, + cutoutPercentage: 0 + } + }); + updateForwardDestinations(); + } // Pull in data via AJAX updateSummaryData(); updateQueriesOverTime(); - updateQueryTypes(); - updateTopClientsChart(); - updateForwardDestinations(); - updateTopLists(); });