Domains on Blocklist
---
diff --git a/list.php b/list.php
index 9b71bd74..5efde479 100644
--- a/list.php
+++ b/list.php
@@ -11,7 +11,7 @@ $list = $_GET['l'];
if($list !== "white" && $list !== "black"){
echo "Invalid list parameter";
- require "footer.php";
+ require "scripts/pi-hole/php/footer.php";
die();
}
diff --git a/scripts/pi-hole/js/db_lists.js b/scripts/pi-hole/js/db_lists.js
index 9a7cdfbc..75a21746 100644
--- a/scripts/pi-hole/js/db_lists.js
+++ b/scripts/pi-hole/js/db_lists.js
@@ -90,7 +90,7 @@ function updateTopClientsChart() {
var url = clientname;
percentage = data.top_sources[client] / sum * 100.0;
clienttable.append("
| " + url +
- " | " + data.top_sources[client] + " | | " + data.top_sources[client] + " | | |
");
}
@@ -128,7 +128,7 @@ function updateTopDomainsChart() {
percentage = data.top_domains[domain] / sum * 100.0;
domaintable.append("
| " + domain +
- " | " + data.top_domains[domain] + " | | " + data.top_domains[domain] + " | | |
");
}
@@ -165,7 +165,7 @@ function updateTopAdsChart() {
}
percentage = data.top_ads[ad] / sum * 100.0;
- adtable.append("
| " + ad + " | " + data.top_ads[ad] + " | |
");
+ adtable.append("
| " + ad + " | " + data.top_ads[ad] + " | |
");
}
}
diff --git a/scripts/pi-hole/js/gravity.js b/scripts/pi-hole/js/gravity.js
index 7ba64775..bf31254b 100644
--- a/scripts/pi-hole/js/gravity.js
+++ b/scripts/pi-hole/js/gravity.js
@@ -28,7 +28,17 @@ function eventsource() {
alSuccess.show();
}
- ta.append(e.data);
+ // Detect ${OVER}
+ if(e.data.indexOf("<------") !== -1)
+ {
+ ta.text(ta.text().substring(0, ta.text().lastIndexOf("\n")) + "\n");
+ var new_string = e.data.replace("<------", "");
+ ta.append(new_string);
+ }
+ else
+ {
+ ta.append(e.data);
+ }
}, false);
diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js
index 6bbd6296..48a2d6f0 100644
--- a/scripts/pi-hole/js/index.js
+++ b/scripts/pi-hole/js/index.js
@@ -118,17 +118,9 @@ function updateQueryTypesOverTime() {
// New style: Get Unix timestamps
d = new Date(1000*h);
- var sum = plotdata[j][0] + plotdata[j][1];
- var A = 0, AAAA = 0;
- if(sum > 0)
- {
- A = plotdata[j][0]/sum;
- AAAA = plotdata[j][1]/sum;
- }
-
queryTypeChart.data.labels.push(d);
- queryTypeChart.data.datasets[0].data.push(A);
- queryTypeChart.data.datasets[1].data.push(AAAA);
+ queryTypeChart.data.datasets[0].data.push(1e-2*plotdata[j][0]);
+ queryTypeChart.data.datasets[1].data.push(1e-2*plotdata[j][1]);
}
}
$("#query-types .overlay").hide();
@@ -243,18 +235,10 @@ function updateForwardedOverTime() {
for (j in timestamps)
{
if (!{}.hasOwnProperty.call(timestamps, j)) continue;
- var sum = 0.0;
for (key in plotdata[j])
{
if (!{}.hasOwnProperty.call(plotdata[j], key)) continue;
- sum += plotdata[j][key];
- }
- var dd = [];
- for (key in plotdata[j])
- {
- if (!{}.hasOwnProperty.call(plotdata[j], key)) continue;
- var singlepoint = plotdata[j][key];
- forwardDestinationChart.data.datasets[key].data.push(singlepoint/sum);
+ forwardDestinationChart.data.datasets[key].data.push(1e-2*plotdata[j][key]);
}
var d = new Date(1000*parseInt(timestamps[j]));
@@ -288,17 +272,27 @@ function updateForwardDestinationsPie() {
var colors = [];
// Get colors from AdminLTE
$.each($.AdminLTE.options.colors, function(key, value) { colors.push(value); });
- var v = [], c = [], k = [];
- // Collect values and colors, immediately push individual labels
+ var v = [], c = [], k = [], values = [];
+
+ // Collect values and colors
$.each(data.forward_destinations, function(key , value) {
- v.push(value);
- c.push(colors.shift());
if(key.indexOf("|") > -1)
{
key = key.substr(0, key.indexOf("|"));
}
- k.push(key);
+ values.push([key, value, colors.shift()]);
});
+
+ // Sort data ASC accorwing to 2nd column, keep already assigned labels and colors
+ values = values.sort(function(a,b) { return b[1] - a[1]; });
+
+ // Split data into individual arrays for the graphs
+ $.each(values, function(key , value) {
+ k.push(value[0]);
+ v.push(value[1]);
+ c.push(value[2]);
+ });
+
// Build a single dataset with the data to be pushed
var dd = {data: v, backgroundColor: c};
// and push it at once
@@ -822,8 +816,21 @@ $(document).ready(function() {
display: true,
position: "right"
},
+ tooltips: {
+ enabled: true,
+ callbacks: {
+ title: function(tooltipItem, data) {
+ return "Query types";
+ },
+ label: function(tooltipItems, data) {
+ var dataset = data.datasets[tooltipItems.datasetIndex];
+ var label = data.labels[tooltipItems.index];
+ return label + ": " + dataset.data[tooltipItems.index].toFixed(1) + "%";
+ }
+ }
+ },
animation: {
- duration: 2000
+ duration: 750
},
cutoutPercentage: 0
}
@@ -847,8 +854,21 @@ $(document).ready(function() {
display: true,
position: "right"
},
+ tooltips: {
+ enabled: true,
+ callbacks: {
+ title: function(tooltipItem, data) {
+ return "Forward destinations";
+ },
+ label: function(tooltipItems, data) {
+ var dataset = data.datasets[tooltipItems.datasetIndex];
+ var label = data.labels[tooltipItems.index];
+ return label + ": " + dataset.data[tooltipItems.index].toFixed(1) + "%";
+ }
+ }
+ },
animation: {
- duration: 2000
+ duration: 750
},
cutoutPercentage: 0
}
diff --git a/scripts/pi-hole/js/list.js b/scripts/pi-hole/js/list.js
index 1b01387c..664d64b2 100644
--- a/scripts/pi-hole/js/list.js
+++ b/scripts/pi-hole/js/list.js
@@ -143,8 +143,7 @@ function add(arg) {
method: "post",
data: {"domain":domain.val(), "list":locallistType, "token":token},
success: function(response) {
- if (response.indexOf("not a valid argument") >= 0 ||
- response.indexOf("is not a valid domain") >= 0) {
+ if (response.indexOf("] Pi-hole blocking is ") === -1) {
alFailure.show();
err.html(response);
alFailure.delay(4000).fadeOut(2000, function() {
diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js
index 74991352..73c1dfab 100644
--- a/scripts/pi-hole/js/settings.js
+++ b/scripts/pi-hole/js/settings.js
@@ -17,6 +17,22 @@ $(function () {
$("input[name=\"AddMAC\"]").val(mac);
});
});
+$(".confirm-poweroff").confirm({
+ text: "Are you sure you want to send a poweroff command to your Pi-Hole?",
+ title: "Confirmation required",
+ confirm(button) {
+ $("#poweroffform").submit();
+ },
+ cancel(button) {
+ // nothing to do
+ },
+ confirmButton: "Yes, poweroff",
+ cancelButton: "No, go back",
+ post: true,
+ confirmButtonClass: "btn-danger",
+ cancelButtonClass: "btn-success",
+ dialogClass: "modal-dialog modal-mg" // Bootstrap classes for mid-size modal
+});
$(".confirm-reboot").confirm({
text: "Are you sure you want to send a reboot command to your Pi-Hole?",
title: "Confirmation required",
diff --git a/scripts/pi-hole/php/auth.php b/scripts/pi-hole/php/auth.php
index a8a64e33..b3fe6a64 100644
--- a/scripts/pi-hole/php/auth.php
+++ b/scripts/pi-hole/php/auth.php
@@ -119,7 +119,7 @@ function check_csrf($token) {
function check_domain() {
if(isset($_POST['domain'])){
- $domains = explode(" ",$_POST['domain']);
+ $domains = preg_split('\s+', $_POST['domain']);
foreach($domains as $domain)
{
$validDomain = is_valid_domain_name($domain);
@@ -146,7 +146,7 @@ function list_verify($type) {
require("password.php");
if(strlen($pwhash) == 0)
{
- log_and_die("No password set - ".htmlspecialchars($type)."listing with password not supported");
+ log_and_die("No password set - ".htmlspecialchars($type)."listing without password not supported");
}
elseif($wrongpassword)
{
diff --git a/scripts/pi-hole/php/footer.php b/scripts/pi-hole/php/footer.php
index 33917305..1e1bc3f8 100644
--- a/scripts/pi-hole/php/footer.php
+++ b/scripts/pi-hole/php/footer.php
@@ -11,17 +11,16 @@