Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update devel from release v5.0 #1252

Merged
merged 52 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
0ee3c06
Fix tooltip percentage computation. While we're at it, also put the b…
DL6ER Jan 1, 2020
ac1e68a
Apply the same changes to the long-term graph page.
DL6ER Jan 1, 2020
f2713a9
Always show date (but only once if the interval is on the same date),…
DL6ER Jan 2, 2020
4337dab
Always break tooltip title into two lines on narrow screens.
DL6ER Jan 2, 2020
e319db2
Merge branch 'release/v5.0' into fix/queries_over_time
dschaper Jan 26, 2020
4f824be
Fix potential code injection on MAC address validator
PromoFaux Feb 18, 2020
62f2ffc
Merge pull request #1165 from pi-hole/release/v4.3.3
PromoFaux Feb 18, 2020
1e22f33
Merge branch 'release/v5.0' into fix/queries_over_time
DL6ER Mar 31, 2020
fd983a2
improve multiselect
Th3M3 Mar 15, 2020
3ea59d5
shorter button textes & cleanup
Th3M3 Apr 5, 2020
3dc9290
Merge pull request #1186 from Th3M3/th3m3/improve_group-select
DL6ER Apr 6, 2020
ff5e4ee
fix input fields spacing issues
Th3M3 Feb 17, 2020
0f892c9
Check for existance and readability of static leases file before tryi…
DL6ER Apr 7, 2020
8e51f75
Merge pull request #1163 from Th3M3/th3m3/add_class_form-group
DL6ER Apr 7, 2020
0f21f6d
Release possible previous onClick event handler on regex links to avo…
DL6ER Apr 10, 2020
fadc607
tweak chartjs customtooltips...
Th3M3 Apr 12, 2020
8ad3b70
We should also accept open-ended IPv6 addresses such as, e.g., fda2:2…
DL6ER Apr 13, 2020
ade3ef5
Merge pull request #1214 from pi-hole/fix/ipv6_cidr_regex
DL6ER Apr 13, 2020
2e7b919
Update scripts/pi-hole/js/queries.js
DL6ER Apr 14, 2020
3f00103
Flip default stae of debug log upload checkbox.
PromoFaux Apr 16, 2020
cf0c719
Merge pull request #1217 from pi-hole/tweak/debuguploadoptin
PromoFaux Apr 16, 2020
c1ddf66
Merge pull request #1206 from pi-hole/fix/dhcp_static_error
DL6ER Apr 21, 2020
c49bcb1
Merge pull request #1147 from Th3M3/fix/custom_tooltips
DL6ER Apr 21, 2020
14dd135
Strip whitespaces from the beginning and end of user input to prevent…
DL6ER Apr 23, 2020
7d1163f
Try to be clearer with the "failed to add domain" message by showing …
DL6ER Apr 23, 2020
77b421b
Show how many domains have been added in case of an error.
DL6ER Apr 23, 2020
00040d4
Fill missing time intervals with zero
DL6ER Apr 23, 2020
f17b216
As of ICU 55.1 (released 2015-04-01) the IDNA2003 APIs are deprecated…
DL6ER Apr 25, 2020
fec4550
Merge pull request #1225 from pi-hole/tweak/idna_uts46
DL6ER Apr 25, 2020
8404652
Allow ( and ) in adlist URLs.
DL6ER Apr 26, 2020
79539bd
Merge pull request #1121 from pi-hole/fix/queries_over_time
DL6ER Apr 28, 2020
4889350
Merge branch 'release/v5.0' into tweak/trim_domains_input
DL6ER Apr 28, 2020
abf6e9f
Merge pull request #1210 from pi-hole/fix/regex_link_multiple_tabs
DL6ER Apr 28, 2020
9cf7395
Rename Custom DNS page.
DL6ER Apr 28, 2020
527c2f1
Merge pull request #1229 from pi-hole/tweak/custom_dns
DL6ER Apr 28, 2020
2ead771
Allow too long legend lines to break
DL6ER Apr 28, 2020
eaf2d7e
Merge pull request #1226 from pi-hole/tweak/allow_()_in_urls
dschaper Apr 28, 2020
34d9942
Merge pull request #1230 from pi-hole/fix/long_doghnout_legends
dschaper Apr 28, 2020
81a2932
Merge branch 'release/v5.0' into tweak/trim_domains_input
DL6ER Apr 28, 2020
c37c86e
Merge pull request #1234 from pi-hole/fix/long_term_interval_filling
DL6ER May 2, 2020
d5477c5
Merge pull request #1224 from pi-hole/tweak/trim_domains_input
DL6ER May 2, 2020
6e5bbfb
Check IP addresses read in from dns-server.conf are valid before addi…
PromoFaux May 3, 2020
e620211
Merge pull request #1236 from pi-hole/fix/vuln-savesettings
DL6ER May 4, 2020
68ce56f
show a clickable "." when there is a blank domain in the top domain l…
PromoFaux May 6, 2020
b86ff76
Address xo complaints.
DL6ER May 7, 2020
cc4e3c9
Query Log and long-term data Query Log: Substitute empty domains by "."
DL6ER May 7, 2020
5909433
Merge pull request #1244 from pi-hole/fix/blank-domains-toplists
PromoFaux May 7, 2020
d870662
Replace paypal link with link to pi-hole.net donate page
PromoFaux May 9, 2020
b6d3d6c
Merge pull request #1248 from pi-hole/tweak/donatelink
DL6ER May 9, 2020
b86e4a3
Merge pull request #1247 from pi-hole/release/v5.0
PromoFaux May 10, 2020
73ee91a
Merge branch 'master' into master-to-development-v5.0
DL6ER May 10, 2020
e02df54
Fix lint errors.
XhmikosR May 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions api_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,30 @@ function resolveHostname($clientip, $printIP)
// Parse the DB result into graph data, filling in missing interval sections with zero
function parseDBData($results, $interval, $from, $until) {
$data = array();
$first_db_timestamp = -1;

if(!is_bool($results)) {
// Read in the data
while($row = $results->fetchArray()) {
// $data[timestamp] = value_in_this_interval
$data[$row[0]] = intval($row[1]);
if($first_db_timestamp === -1)
$first_db_timestamp = intval($row[0]);
}
}

// It is unpredictable what the first timestamp returned by the database
// will be. This depends on live data. Hence, we re-align the FROM
// timestamp to avoid unaligned holes appearing as additional
// (incorrect) data points
$aligned_from = $from + (($first_db_timestamp - $from) % $interval);

// Fill gaps in returned data
for($i = $aligned_from; $i < $until; $i += $interval) {
if(!array_key_exists($i, $data))
$data[$i] = 0;
}

return $data;
}

Expand Down
4 changes: 2 additions & 2 deletions debug.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /*
<?php /*
* Pi-hole: A black hole for Internet advertisements
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
* Network-wide ad blocking via your own hardware.
Expand All @@ -12,7 +12,7 @@
<h1>Generate debug log</h1>
</div>

<p><input type="checkbox" id="upload" checked> Upload debug log and provide token once finished</p>
<p><input type="checkbox" id="upload"> Upload debug log and provide token once finished</p>
<p>Once you click this button a debug log will be generated and can automatically be uploaded if we detect a working internet connection.</p>
<button class="btn btn-lg btn-primary btn-block" id="debugBtn">Generate debug log</button>
<pre id="output" style="width: 100%; height: 100%;" hidden="true"></pre>
Expand Down
10 changes: 5 additions & 5 deletions custom_dns.php → dns_records.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

<!-- Title -->
<div class="page-header">
<h1>Custom DNS configuration</h1>
<small>On this page, you can add domain/IP associations similar to records in <code>/etc/hosts</code>.</small>
<h1>Local DNS Records</h1>
<small>On this page, you can add domain/IP associations</small>
</div>

<!-- Domain Input -->
Expand All @@ -28,11 +28,11 @@
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-6">
<div class="form-group col-md-6">
<label for="domain">Domain:</label>
<input id="domain" type="url" class="form-control" placeholder="Add a domain (example.com or sub.example.com)" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
</div>
<div class="col-md-6">
<div class="form-group col-md-6">
<label for="ip">IP Address:</label>
<input id="ip" type="text" class="form-control" placeholder="Associated IP address" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
</div>
Expand Down Expand Up @@ -67,7 +67,7 @@
<div class="box" id="recent-queries">
<div class="box-header with-border">
<h3 class="box-title">
List of custom DNS domains
List of local DNS domains
</h3>
</div>
<!-- /.box-header -->
Expand Down
10 changes: 5 additions & 5 deletions groups-adlists.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-6">
<label for="ex1">Address:</label>
<input id="new_address" type="url" class="form-control" placeholder="http://..., https://..., file://..." autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
<div class="form-group col-md-6">
<label for="new_address">Address:</label>
<input id="new_address" type="text" class="form-control" placeholder="http://..., https://..., file://..." autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
</div>
<div class="col-md-6">
<label for="ex2">Comment:</label>
<div class="form-group col-md-6">
<label for="new_comment">Comment:</label>
<input id="new_comment" type="text" class="form-control" placeholder="Adlist description (optional)">
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions groups-clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-6">
<label for="ex1">Known clients:</label>
<div class="form-group col-md-6">
<label for="select">Known clients:</label>
<select id="select" class="form-control" placeholder="">
<option disabled selected>Loading...</option>
</select><br>
<input id="ip-custom" type="text" class="form-control" disabled placeholder="Client IP address (IPv4 or IPv6, CIDR subnetting available, optional)" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
</div>
<div class="col-md-6">
<label for="ex3">Comment:</label>
<div class="form-group col-md-6">
<label for="new_comment">Comment:</label>
<input id="new_comment" type="text" class="form-control" placeholder="Client description (optional)">
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-6">
<label for="ex1">Name:</label>
<div class="form-group col-md-6">
<label for="new_name">Name:</label>
<input id="new_name" type="text" class="form-control" placeholder="Group name">
</div>
<div class="col-md-6">
<label for="ex2">Description:</label>
<div class="form-group col-md-6">
<label for="new_desc">Description:</label>
<input id="new_desc" type="text" class="form-control" placeholder="Group description (optional)">
</div>
</div>
Expand Down
81 changes: 57 additions & 24 deletions scripts/pi-hole/js/db_graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,23 @@ function updateQueriesOverTime() {
for (hour in dates) {
if (Object.prototype.hasOwnProperty.call(dates, hour)) {
var date,
dom = 0,
ads = 0;
total = 0,
blocked = 0;
date = new Date(1000 * dates[hour]);

var idx = data.domains_over_time[0].indexOf(dates[hour].toString());
if (idx > -1) {
dom = data.domains_over_time[1][idx];
total = data.domains_over_time[1][idx];
}

idx = data.ads_over_time[0].indexOf(dates[hour].toString());
if (idx > -1) {
ads = data.ads_over_time[1][idx];
blocked = data.ads_over_time[1][idx];
}

timeLineChart.data.labels.push(date);
timeLineChart.data.datasets[0].data.push(dom - ads);
timeLineChart.data.datasets[1].data.push(ads);
timeLineChart.data.datasets[0].data.push(blocked);
timeLineChart.data.datasets[1].data.push(total - blocked);
}
}

Expand All @@ -170,28 +170,30 @@ function updateQueriesOverTime() {

$(document).ready(function () {
var ctx = document.getElementById("queryOverTimeChart").getContext("2d");
var blockedColor = "#999";
var permittedColor = "#00a65a";
timeLineChart = new Chart(ctx, {
type: "bar",
data: {
labels: [],
datasets: [
{
label: "Permitted DNS Queries",
label: "Blocked DNS Queries",
fill: true,
backgroundColor: "rgba(0, 166, 90,.8)",
borderColor: "rgba(0, 166, 90,.8)",
pointBorderColor: "rgba(0, 166, 90,.8)",
backgroundColor: blockedColor,
borderColor: blockedColor,
pointBorderColor: blockedColor,
pointRadius: 1,
pointHoverRadius: 5,
data: [],
pointHitRadius: 5
},
{
label: "Blocked DNS Queries",
label: "Permitted DNS Queries",
fill: true,
backgroundColor: "rgba(0,192,239,1)",
borderColor: "rgba(0,192,239,1)",
pointBorderColor: "rgba(0,192,239,1)",
backgroundColor: permittedColor,
borderColor: permittedColor,
pointBorderColor: permittedColor,
pointRadius: 1,
pointHoverRadius: 5,
data: [],
Expand All @@ -202,6 +204,9 @@ $(document).ready(function () {
options: {
tooltips: {
enabled: true,
itemSort: function (a, b) {
return b.datasetIndex - a.datasetIndex;
},
mode: "x-axis",
callbacks: {
title: function (tooltipItem) {
Expand All @@ -212,8 +217,8 @@ $(document).ready(function () {
"-" +
padNumber(time.getMonth() + 1) +
"-" +
padNumber(time.getDate()) +
" " +
padNumber(time.getDate());
var from_time =
padNumber(time.getHours()) +
":" +
padNumber(time.getMinutes()) +
Expand All @@ -225,22 +230,50 @@ $(document).ready(function () {
"-" +
padNumber(time.getMonth() + 1) +
"-" +
padNumber(time.getDate()) +
" " +
padNumber(time.getDate());
var until_time =
padNumber(time.getHours()) +
":" +
padNumber(time.getMinutes()) +
":" +
padNumber(time.getSeconds());
return "Queries from " + from_date + " to " + until_date;

if (from_date === until_date) {
// Abbreviated form for intervals on the same day
// We split title in two lines on small screens
if ($(window).width() < 992) {
until_time += "\n";
}

return ("Queries from " + from_time + " to " + until_time + " on " + from_date).split(
"\n "
);
}

// Full tooltip for intervals spanning more than one day
// We split title in two lines on small screens
if ($(window).width() < 992) {
from_date += "\n";
}

return (
"Queries from " +
from_date +
" " +
from_time +
" to " +
until_date +
" " +
until_time
).split("\n ");
},
label: function (tooltipItems, data) {
if (tooltipItems.datasetIndex === 1) {
if (tooltipItems.datasetIndex === 0) {
var percentage = 0.0;
var total = parseInt(data.datasets[0].data[tooltipItems.index]);
var blocked = parseInt(data.datasets[1].data[tooltipItems.index]);
if (total > 0) {
percentage = (100.0 * blocked) / total;
var permitted = parseInt(data.datasets[1].data[tooltipItems.index]);
var blocked = parseInt(data.datasets[0].data[tooltipItems.index]);
if (permitted + blocked > 0) {
percentage = (100.0 * blocked) / (permitted + blocked);
}

return (
Expand Down
8 changes: 8 additions & 0 deletions scripts/pi-hole/js/db_queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ $(document).ready(function () {
$(row).css("color", color);
$("td:eq(4)", row).html(fieldtext);
$("td:eq(5)", row).html(buttontext);

// Substitute domain by "." if empty
var domain = data[2];
if (domain.length === 0) {
domain = ".";
}

$("td:eq(2)", row).text(domain);
},
dom:
"<'row'<'col-sm-12'f>>" +
Expand Down
Loading