From 6658968950dcf8f077a6bd9fb309c0aae352b2e0 Mon Sep 17 00:00:00 2001 From: gedetil Date: Tue, 11 Apr 2017 12:21:39 -0500 Subject: [PATCH 001/215] Update settings.php Implement "Halt system" button, next to "Restart system" button, on admin/settings page. Useful for doing clean shutdown before powering off. Gilbert Detillieux 2017-04-11 --- settings.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/settings.php b/settings.php index d74069b4..1c66ca4c 100644 --- a/settings.php +++ b/settings.php @@ -838,10 +838,15 @@ if(isset($_POST["submit"])) {

System Administration

+ +
+ + +
From aac1b1ba05e5bad8f07b58f42aabd66a0ec95160 Mon Sep 17 00:00:00 2001 From: gedetil Date: Tue, 11 Apr 2017 13:40:27 -0500 Subject: [PATCH 002/215] Update settings.js Implement "Halt system" button, next to "Restart system" button, on admin/settings page. Useful for doing clean shutdown before powering off. Gilbert Detillieux 2017-04-11 --- scripts/pi-hole/js/settings.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 74991352..dea9b775 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-halt").confirm({ + text: "Are you sure you want to send a halt command to your Pi-Hole?", + title: "Confirmation required", + confirm(button) { + $("#haltform").submit(); + }, + cancel(button) { + // nothing to do + }, + confirmButton: "Yes, halt", + 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", From 08f40722c1d591cc9f320aad197f88a0bd6a05ec Mon Sep 17 00:00:00 2001 From: gedetil Date: Tue, 11 Apr 2017 13:44:18 -0500 Subject: [PATCH 003/215] Update savesettings.php Implement "Halt system" button, next to "Restart system" button, on admin/settings page. Useful for doing clean shutdown before powering off. Gilbert Detillieux 2017-04-11 --- scripts/pi-hole/php/savesettings.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index da339526..850177c8 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -420,6 +420,11 @@ function readAdlists() $success .= "The webUI settings have been updated"; break; + case "halt": + exec("sudo pihole -a halt"); + $success = "The system will halt in 5 seconds..."; + break; + case "reboot": exec("sudo pihole -a reboot"); $success = "The system will reboot in 5 seconds..."; From b2a8ea7fee9a319d102b3138a8d8b73c57cfcd3a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 22 Apr 2017 01:44:26 +0200 Subject: [PATCH 004/215] Add first version of Audit log --- api_FTL.php | 6 ++- auditlog.php | 78 ++++++++++++++++++++++++++++ scripts/pi-hole/js/auditlog.js | 94 ++++++++++++++++++++++++++++++++++ scripts/pi-hole/php/header.php | 8 ++- 4 files changed, 184 insertions(+), 2 deletions(-) create mode 100644 auditlog.php create mode 100644 scripts/pi-hole/js/auditlog.js diff --git a/api_FTL.php b/api_FTL.php index 0e0a2637..c367d153 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -71,7 +71,11 @@ if (isset($_GET['overTimeData10mins'])) if (isset($_GET['topItems']) && $auth) { - if(is_numeric($_GET['topItems'])) + if($_GET['topItems'] === "audit") + { + sendRequestFTL("top-domains for audit"); + } + else if(is_numeric($_GET['topItems'])) { sendRequestFTL("top-domains (".$_GET['topItems'].")"); } diff --git a/auditlog.php b/auditlog.php new file mode 100644 index 00000000..d0ae4c44 --- /dev/null +++ b/auditlog.php @@ -0,0 +1,78 @@ + + + + + + +
+
+
+
+

Allowed queries

+
+ +
+
+ + + + + + + + +
DomainHitsAction
+
+
+
+ +
+ +
+ +
+ +
+
+
+

Blocked queries

+
+ +
+
+ + + + + + + + +
DomainHitsAction
+
+
+
+ +
+ +
+ +
+ +
+ + + + diff --git a/scripts/pi-hole/js/auditlog.js b/scripts/pi-hole/js/auditlog.js new file mode 100644 index 00000000..3cd2c680 --- /dev/null +++ b/scripts/pi-hole/js/auditlog.js @@ -0,0 +1,94 @@ +/* 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. +* +* This file is copyright under the latest version of the EUPL. +* Please see LICENSE file for your rights under this license. */ +// Define global variables +var timeLineChart, queryTypeChart, forwardDestinationChart; + +function padNumber(num) { + return ("00" + num).substr(-2,2); +} + +// Helper function needed for converting the Objects to Arrays + +function objectToArray(p){ + var keys = Object.keys(p); + keys.sort(function(a, b) { + return a - b; + }); + + var arr = [], idx = []; + for (var i = 0; i < keys.length; i++) { + arr.push(p[keys[i]]); + idx.push(keys[i]); + } + return [idx,arr]; +} + +// Functions to update data in page + +var failures = 0; + +// Credit: http://stackoverflow.com/questions/1787322/htmlspecialchars-equivalent-in-javascript/4835406#4835406 +function escapeHtml(text) { + var map = { + "&": "&", + "<": "<", + ">": ">", + "\"": """, + "\'": "'" + }; + + return text.replace(/[&<>"']/g, function(m) { return map[m]; }); +} + +function updateTopLists() { + $.getJSON("api.php?topItems=audit", function(data) { + + if("FTLnotrunning" in data) + { + return; + } + + // Clear tables before filling them with data + $("#domain-frequency td").parent().remove(); + $("#ad-frequency td").parent().remove(); + var domaintable = $("#domain-frequency").find("tbody:last"); + var adtable = $("#ad-frequency").find("tbody:last"); + var url, domain, percentage; + for (domain in data.top_queries) { + if ({}.hasOwnProperty.call(data.top_queries,domain)){ + // Sanitize domain + domain = escapeHtml(domain); + url = ""+domain+""; + percentage = data.top_queries[domain] / data.dns_queries_today * 100; + domaintable.append(" " + url + + " " + data.top_queries[domain] + " Buttons ... "); + } + } + + for (domain in data.top_ads) { + if ({}.hasOwnProperty.call(data.top_ads,domain)){ + // Sanitize domain + domain = escapeHtml(domain); + url = ""+domain+""; + percentage = data.top_ads[domain] / data.ads_blocked_today * 100; + adtable.append(" " + url + + " " + data.top_ads[domain] + " Buttons ... "); + } + } + + $("#domain-frequency .overlay").hide(); + $("#ad-frequency .overlay").hide(); + // Update top lists data every 10 seconds + setTimeout(updateTopLists, 10000); + }); +} + +$(document).ready(function() { + + // Pull in data via AJAX + updateTopLists(); + }); diff --git a/scripts/pi-hole/php/header.php b/scripts/pi-hole/php/header.php index 0c49b724..594a5be1 100644 --- a/scripts/pi-hole/php/header.php +++ b/scripts/pi-hole/php/header.php @@ -459,7 +459,7 @@ if($auth) { Enable    -
  • active"> +
  • active"> Tools @@ -479,6 +479,12 @@ if($auth) { Query adlists
  • + + class="active"> + + Audit log + + class="active"> From 349faac0482dbe569ff09b8727963c2026b83c7f Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 22 Apr 2017 16:09:56 +0200 Subject: [PATCH 005/215] Implemented also actions for audit log --- api_FTL.php | 11 ++++- auditlog.php | 9 ++-- scripts/pi-hole/js/auditlog.js | 80 ++++++++++++++++++++-------------- scripts/pi-hole/php/add.php | 26 +++++++++-- 4 files changed, 86 insertions(+), 40 deletions(-) diff --git a/api_FTL.php b/api_FTL.php index c367d153..04988f28 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -92,7 +92,11 @@ if (isset($_GET['topItems']) && $auth) $top_queries[$tmp[2]] = intval($tmp[1]); } - if(is_numeric($_GET['topItems'])) + if($_GET['topItems'] === "audit") + { + sendRequestFTL("top-ads for audit"); + } + else if(is_numeric($_GET['topItems'])) { sendRequestFTL("top-ads (".$_GET['topItems'].")"); } @@ -106,7 +110,10 @@ if (isset($_GET['topItems']) && $auth) foreach($return as $line) { $tmp = explode(" ",$line); - $top_ads[$tmp[2]] = intval($tmp[1]); + if(count($tmp) === 4) + $top_ads[$tmp[2]." (".$tmp[3].")"] = intval($tmp[1]); + else + $top_ads[$tmp[2]] = intval($tmp[1]); } $result = array('top_queries' => $top_queries, diff --git a/auditlog.php b/auditlog.php index d0ae4c44..96d74577 100644 --- a/auditlog.php +++ b/auditlog.php @@ -11,7 +11,7 @@
    @@ -28,7 +28,7 @@ Domain Hits - Action + Actions @@ -55,7 +55,7 @@ Domain Hits - Action + Actions @@ -68,6 +68,9 @@
    + diff --git a/scripts/pi-hole/js/auditlog.js b/scripts/pi-hole/js/auditlog.js index 3cd2c680..85aee673 100644 --- a/scripts/pi-hole/js/auditlog.js +++ b/scripts/pi-hole/js/auditlog.js @@ -7,30 +7,6 @@ // Define global variables var timeLineChart, queryTypeChart, forwardDestinationChart; -function padNumber(num) { - return ("00" + num).substr(-2,2); -} - -// Helper function needed for converting the Objects to Arrays - -function objectToArray(p){ - var keys = Object.keys(p); - keys.sort(function(a, b) { - return a - b; - }); - - var arr = [], idx = []; - for (var i = 0; i < keys.length; i++) { - arr.push(p[keys[i]]); - idx.push(keys[i]); - } - return [idx,arr]; -} - -// Functions to update data in page - -var failures = 0; - // Credit: http://stackoverflow.com/questions/1787322/htmlspecialchars-equivalent-in-javascript/4835406#4835406 function escapeHtml(text) { var map = { @@ -65,18 +41,29 @@ function updateTopLists() { url = ""+domain+""; percentage = data.top_queries[domain] / data.dns_queries_today * 100; domaintable.append(" " + url + - " " + data.top_queries[domain] + " Buttons ... "); + " " + data.top_queries[domain] + " "); } } for (domain in data.top_ads) { if ({}.hasOwnProperty.call(data.top_ads,domain)){ // Sanitize domain - domain = escapeHtml(domain); - url = ""+domain+""; - percentage = data.top_ads[domain] / data.ads_blocked_today * 100; - adtable.append(" " + url + - " " + data.top_ads[domain] + " Buttons ... "); + console.log(domain); + console.log(); + var input = domain.split(" "); + var printdomain = escapeHtml(input[0]); + if(input.length > 1) + { + url = ""+printdomain+" (wildcard blocked)"; + adtable.append(" " + url + + " " + data.top_ads[domain] + " "); + } + else + { + url = ""+printdomain+""; + adtable.append(" " + url + + " " + data.top_ads[domain] + " "); + } } } @@ -87,8 +74,37 @@ function updateTopLists() { }); } + +function add(domain,list) { + var token = $("#token").html(); + $.ajax({ + url: "scripts/pi-hole/php/add.php", + method: "post", + data: {"domain":domain, "list":list, "token":token, "auditlog":1}, + success: function(response) { + setTimeout(updateTopLists, 300); + } + }); +} + $(document).ready(function() { - // Pull in data via AJAX - updateTopLists(); + // Pull in data via AJAX + updateTopLists(); + + $("#domain-frequency tbody").on( "click", "button", function () { + var url = ($(this).parents("tr"))[0].innerText.split(" ")[0]; + if($(this).context.innerText === "Blacklist") + add(url,"black"); + else + add(url,"audit"); }); + + $("#ad-frequency tbody").on( "click", "button", function () { + var url = ($(this).parents("tr"))[0].innerText.split(" ")[0].split(" ")[0]; + if($(this).context.innerText === "Whitelist") + add(url,"white"); + else + add(url,"audit"); + }); +}); diff --git a/scripts/pi-hole/php/add.php b/scripts/pi-hole/php/add.php index d4ca64db..a19aae7a 100644 --- a/scripts/pi-hole/php/add.php +++ b/scripts/pi-hole/php/add.php @@ -16,13 +16,33 @@ list_verify($type); switch($type) { case "white": - echo exec("sudo pihole -w -q ${_POST['domain']}"); + if(!isset($_POST["auditlog"])) + echo exec("sudo pihole -w -q ${_POST['domain']}"); + else + { + echo exec("sudo pihole -w -q -n ${_POST['domain']}"); + echo exec("sudo pihole -a audit ${_POST['domain']}"); + } break; case "black": - echo exec("sudo pihole -b -q ${_POST['domain']}"); + if(!isset($_POST["auditlog"])) + echo exec("sudo pihole -b -q ${_POST['domain']}"); + else + { + echo exec("sudo pihole -b -q -n ${_POST['domain']}"); + echo exec("sudo pihole -a audit ${_POST['domain']}"); + } break; case "wild": - echo exec("sudo pihole -wild -q ${_POST['domain']}"); + if(!isset($_POST["auditlog"])) + echo exec("sudo pihole -wild -q ${_POST['domain']}"); + else + { + echo exec("sudo pihole -wild -q -n ${_POST['domain']}"); + echo exec("sudo pihole -a audit ${_POST['domain']}"); + } + case "audit": + echo exec("sudo pihole -a audit ${_POST['domain']}"); break; } From 870959026b7a605fcc94e646f95d6d782f32ed02 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 22 Apr 2017 16:19:19 +0200 Subject: [PATCH 006/215] Codacy fixes --- scripts/pi-hole/js/auditlog.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/pi-hole/js/auditlog.js b/scripts/pi-hole/js/auditlog.js index 85aee673..db904b91 100644 --- a/scripts/pi-hole/js/auditlog.js +++ b/scripts/pi-hole/js/auditlog.js @@ -47,10 +47,8 @@ function updateTopLists() { for (domain in data.top_ads) { if ({}.hasOwnProperty.call(data.top_ads,domain)){ - // Sanitize domain - console.log(domain); - console.log(); var input = domain.split(" "); + // Sanitize domain var printdomain = escapeHtml(input[0]); if(input.length > 1) { @@ -95,16 +93,24 @@ $(document).ready(function() { $("#domain-frequency tbody").on( "click", "button", function () { var url = ($(this).parents("tr"))[0].innerText.split(" ")[0]; if($(this).context.innerText === "Blacklist") + { add(url,"black"); + } else + { add(url,"audit"); + } }); $("#ad-frequency tbody").on( "click", "button", function () { var url = ($(this).parents("tr"))[0].innerText.split(" ")[0].split(" ")[0]; if($(this).context.innerText === "Whitelist") - add(url,"white"); + { + add(url,"white"); + } else + { add(url,"audit"); + } }); }); From ab126d94e058cbb8fc2b651f761fd49ea9ba5b33 Mon Sep 17 00:00:00 2001 From: WaLLy3K Date: Tue, 2 May 2017 10:47:02 +1000 Subject: [PATCH 007/215] Modifications to support core queryFunc() changes * Set pcre.recursion_limit, 3x the limit necessary to process a valid 253 character domain name * Updated validate_domain() to include underscore as a valid character within a domain * Run escapeshellarg() on `pihole -q` command in the unlikely event that a maliciously crafted domain query is able to pass validate_domain() * Known issues: Changes to the output of this file and Pi-hole core's queryFunc() results in `queryads.js` failing to work (Thereby breaking Tools > Query adlists) --- scripts/pi-hole/php/queryads.php | 57 ++++++++++---------------------- 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/scripts/pi-hole/php/queryads.php b/scripts/pi-hole/php/queryads.php index 457e235c..62196763 100644 --- a/scripts/pi-hole/php/queryads.php +++ b/scripts/pi-hole/php/queryads.php @@ -9,52 +9,31 @@ ob_end_flush(); ini_set("output_buffering", "0"); ob_implicit_flush(true); -header('Content-Type: text/event-stream'); -header('Cache-Control: no-cache'); +header("Content-Type: text/event-stream"); +header("Cache-Control: no-cache"); +ini_set("pcre.recursion_limit", 1500); -function echoEvent($datatext) { - if(!isset($_GET["IE"])) - echo "data: ".implode("\ndata: ", explode("\n", $datatext))."\n\n"; - else - echo $datatext; +function validate_domain($domain) { // Cr: http://stackoverflow.com/a/4694816 + return (preg_match("/^([a-z\d]((-|_)*[a-z\d])*)(\.([a-z\d]((-|_)*[a-z\d])*))*$/i", $domain) // Valid chars check + && preg_match("/^.{1,253}$/", $domain) // Overall length check + && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain)); // Length of each label } -// Credit: http://stackoverflow.com/a/4694816/2087442 -function is_valid_domain_name($domain_name) -{ - return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name) //valid chars check - && preg_match("/^.{1,253}$/", $domain_name) //overall length check - && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name) ); //length of each label -} - -// Test if domain is set -if(isset($_GET["domain"])) -{ - // Is this a valid domain? - $url = $_GET["domain"]; - if(!is_valid_domain_name($url)) - { - echoEvent("Invalid domain!"); - die(); +// Validate domain, if set +if(isset($_GET["domain"])) { + if(validate_domain($_GET["domain"])) { + $domain = $_GET["domain"]; + } else { + die("::: Invalid domain"); } -} -else -{ - echoEvent("No domain provided"); - die(); +} else { + die("::: Domain query not specified"); } -if(isset($_GET["exact"])) -{ - $exact = "-exact"; -} -else -{ - $exact = ""; -} +$exact = isset($_GET["exact"]) ? "-exact" : ""; -$proc = popen("sudo pihole -q ".$url." ".$exact, 'r'); +$proc = popen("sudo pihole -q ".escapeshellarg($domain)." $exact", "r"); while (!feof($proc)) { - echoEvent(fread($proc, 4096)); + echo fread($proc, 4096); } ?> From 2db45f806bc91d1c8ded394cdf198f0620907226 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 5 May 2017 23:29:25 +0200 Subject: [PATCH 008/215] Remove double click handler --- scripts/pi-hole/js/gravity.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/pi-hole/js/gravity.js b/scripts/pi-hole/js/gravity.js index 84b26b73..7ba64775 100644 --- a/scripts/pi-hole/js/gravity.js +++ b/scripts/pi-hole/js/gravity.js @@ -45,11 +45,6 @@ $("#gravityBtn").on("click", function(){ eventsource(); }); -$("#gravityBtn").on("click", () => { - $("#gravityBtn").attr("disabled", true); - eventsource(); -}); - // Handle hiding of alerts $(function(){ $("[data-hide]").on("click", function(){ From 2db905a9da49fa7389f999843e7f9672ccb15f8d Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 5 May 2017 22:50:03 +0100 Subject: [PATCH 009/215] ~Today~ Over Last 24 Hours --- index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index a40d5713..2cb4d3b0 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,7 @@

    ---

    -

    DNS Queries Blocked Today

    +

    DNS Queries Blocked Over Last 24 Hours

    @@ -28,7 +28,7 @@

    ---

    -

    DNS Queries Today

    +

    DNS Queries Over Last 24 Hours

    @@ -41,7 +41,7 @@

    ---

    -

    Of Today's Queries Were Blocked

    +

    Queries Were Blocked Over Last 24 Hours

    From 9cf967eb0b2cdc3422c4fd2281ad07569946b924 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Tue, 9 May 2017 17:35:46 -0400 Subject: [PATCH 010/215] Rename Top Advertisers to Top Blocked Domains --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 2cb4d3b0..dd975b78 100644 --- a/index.php +++ b/index.php @@ -164,7 +164,7 @@ else
    -

    Top Advertisers

    +

    Top Blocked Domains

    From f46a1c166ff3cbeff665a3b5e5751be77cf813a0 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 10 May 2017 21:02:02 +0200 Subject: [PATCH 011/215] percentage should be a float instead of an integer --- api_FTL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_FTL.php b/api_FTL.php index 0e0a2637..2738e700 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -45,7 +45,7 @@ if (isset($_GET['summary']) || isset($_GET['summaryRaw']) || !count($_GET)) } else { - $stats[$tmp[0]] = intval($tmp[1]); + $stats[$tmp[0]] = floatval($tmp[1]); } } $data = array_merge($data,$stats); From 915ec26547bc4e4793d2371ca18f5ea36ce982dc Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 12 May 2017 18:11:55 +0200 Subject: [PATCH 012/215] Define $over_time as array. Fixes #501 --- api_FTL.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api_FTL.php b/api_FTL.php index 2738e700..bed84b5d 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -233,6 +233,7 @@ if (isset($_GET['overTimeDataForwards']) && $auth) { sendRequestFTL("ForwardedoverTime"); $return = getResponseFTL(); + $over_time = array(); foreach($return as $line) { @@ -271,6 +272,7 @@ if (isset($_GET['overTimeDataQueryTypes']) && $auth) { sendRequestFTL("QueryTypesoverTime"); $return = getResponseFTL(); + $over_time = array(); foreach($return as $line) { From b49a7b57c531ab95a835446229ec38bf43dd767d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 13 May 2017 17:20:18 +0200 Subject: [PATCH 013/215] Add hover/hit radius for Forward Destinations over Time graph --- scripts/pi-hole/js/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 6aabe866..0bb3c02d 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -186,11 +186,13 @@ function updateForwardedOverTime() { // Collect values and colors, and labels forwardDestinationChart.data.datasets[0].backgroundColor = colors[0]; forwardDestinationChart.data.datasets[0].pointRadius = 0; + forwardDestinationChart.data.datasets[0].pointHitRadius = 5; + forwardDestinationChart.data.datasets[0].pointHoverRadius = 5; forwardDestinationChart.data.datasets[0].label = labels[0]; for (i = forwardDestinationChart.data.datasets.length; i < plotdata[0].length; i++) { - forwardDestinationChart.data.datasets.push({data: [], backgroundColor: colors[i], pointRadius: 0, label: labels[i]}); + forwardDestinationChart.data.datasets.push({data: [], backgroundColor: colors[i], pointRadius: 0, pointHitRadius: 5, pointHoverRadius: 5, label: labels[i]}); } // Add data for each dataset that is available From 7d4bf08853a49d518c2e3a3c067a9b24707c5313 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 13 May 2017 17:32:00 +0200 Subject: [PATCH 014/215] Add custom callback for tooltips and disable legend for Forward Destinations over Time graph --- scripts/pi-hole/js/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 0bb3c02d..8545fa3f 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -548,6 +548,27 @@ $(document).ready(function() { datasets: [{ data: [] }] }, options: { + tooltips: { + enabled: true, + mode: "x-axis", + callbacks: { + title: function(tooltipItem, data) { + var label = tooltipItem[0].xLabel; + var time = label.match(/(\d?\d):?(\d?\d?)/); + var h = parseInt(time[1], 10); + var m = parseInt(time[2], 10) || 0; + var from = padNumber(h)+":"+padNumber(m-5)+":00"; + var to = padNumber(h)+":"+padNumber(m+4)+":59"; + return "Forward destinations from "+from+" to "+to; + }, + label: function(tooltipItems, data) { + return data.datasets[tooltipItems.datasetIndex].label + ": " + (100.0*tooltipItems.yLabel).toFixed(1) + "%"; + } + } + }, + legend: { + display: false + }, scales: { xAxes: [{ type: "time", From e659d79da974c57ac872061ea2d05f85b6264b9a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 13 May 2017 17:34:36 +0200 Subject: [PATCH 015/215] Remove legend, add tooltips and increase hit/hover radius for Query Types over Time graph. Fixes #502 --- scripts/pi-hole/js/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 8545fa3f..ad641238 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -612,16 +612,41 @@ $(document).ready(function() { { label: "A: IPv4 queries", pointRadius: 0, + pointHitRadius: 5, + pointHoverRadius: 5, data: [] }, { label: "AAAA: IPv6 queries", pointRadius: 0, + pointHitRadius: 5, + pointHoverRadius: 5, data: [] } ] }, options: { + tooltips: { + enabled: true, + mode: "x-axis", + callbacks: { + title: function(tooltipItem, data) { + var label = tooltipItem[0].xLabel; + var time = label.match(/(\d?\d):?(\d?\d?)/); + var h = parseInt(time[1], 10); + var m = parseInt(time[2], 10) || 0; + var from = padNumber(h)+":"+padNumber(m-5)+":00"; + var to = padNumber(h)+":"+padNumber(m+4)+":59"; + return "Query types from "+from+" to "+to; + }, + label: function(tooltipItems, data) { + return data.datasets[tooltipItems.datasetIndex].label + ": " + (100.0*tooltipItems.yLabel).toFixed(1) + "%"; + } + } + }, + legend: { + display: false + }, scales: { xAxes: [{ type: "time", From 62f2f1939bdb3c8fe2551e723ee645d9c41dbcc8 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 13 May 2017 17:44:06 +0200 Subject: [PATCH 016/215] Don't hide detailed graphs on small screens any longer --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index dd975b78..61f590ca 100644 --- a/index.php +++ b/index.php @@ -89,7 +89,7 @@ // a password if($auth){ ?>
    -
    From 619f115660a0a0617906cc7d720cd0f0cf4ef446 Mon Sep 17 00:00:00 2001 From: WaLLy3K Date: Sat, 7 Oct 2017 23:42:14 +1100 Subject: [PATCH 135/215] Remove GitHub link in footer --- scripts/pi-hole/php/footer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/footer.php b/scripts/pi-hole/php/footer.php index 1e1bc3f8..b049ac57 100644 --- a/scripts/pi-hole/php/footer.php +++ b/scripts/pi-hole/php/footer.php @@ -61,7 +61,7 @@ echo $FTL_current; if($FTL_update){ ?> (Update available!)
    -
    Donate if you found this useful.
    +
    Donate if you found this useful.
    From c6b98655b1fab1767fa7fbb090f03b758308a8c0 Mon Sep 17 00:00:00 2001 From: WaLLy3K Date: Sun, 8 Oct 2017 00:54:56 +1100 Subject: [PATCH 136/215] Link to pi-hole.net/donate instead of PayPal * Give users the option to choose their preferred donation method * Use the heart symbol as the icon Signed off by WaLLy3K --- scripts/pi-hole/php/footer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/footer.php b/scripts/pi-hole/php/footer.php index b049ac57..d9ca6cec 100644 --- a/scripts/pi-hole/php/footer.php +++ b/scripts/pi-hole/php/footer.php @@ -61,7 +61,7 @@ echo $FTL_current; if($FTL_update){ ?> (Update available!)
    -
    Donate if you found this useful.
    +
    Donate if you found this useful.
    From bfad6d8fcb476935261052e5c1444aa65e454deb Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 7 Oct 2017 17:25:43 +0200 Subject: [PATCH 137/215] Add nuke option before importing new list to be sure the content is being replaced instead of appended Signed-off-by: DL6ER --- scripts/pi-hole/php/teleporter.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/pi-hole/php/teleporter.php b/scripts/pi-hole/php/teleporter.php index 34e3ab67..7e20786f 100644 --- a/scripts/pi-hole/php/teleporter.php +++ b/scripts/pi-hole/php/teleporter.php @@ -124,12 +124,14 @@ if(isset($_POST["action"])) { $blacklist = process_file(file_get_contents($file)); echo "Processing blacklist.txt
    \n"; + exec("sudo pihole -b --nuke"); exec("sudo pihole -b -q ".implode(" ", $blacklist)); } if(isset($_POST["whitelist"]) && $file->getFilename() === "whitelist.txt") { $whitelist = process_file(file_get_contents($file)); echo "Processing whitelist.txt
    \n"; + exec("sudo pihole -w --nuke"); exec("sudo pihole -w -q ".implode(" ", $whitelist)); } @@ -137,6 +139,7 @@ if(isset($_POST["action"])) { $wildlist = process_file(file_get_contents($file)); echo "Processing wildcardblocking.txt
    \n"; + exec("sudo pihole -wild --nuke"); exec("sudo pihole -wild -q ".implode(" ", $wildlist)); } } From b6caf5878fa0126745af05017678f94557120fe1 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 7 Oct 2017 17:34:10 +0200 Subject: [PATCH 138/215] Ensure we restart dnsmasq only once (at the end of importing stuff) Signed-off-by: DL6ER --- scripts/pi-hole/php/teleporter.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/pi-hole/php/teleporter.php b/scripts/pi-hole/php/teleporter.php index 7e20786f..0427b7c0 100644 --- a/scripts/pi-hole/php/teleporter.php +++ b/scripts/pi-hole/php/teleporter.php @@ -118,29 +118,38 @@ if(isset($_POST["action"])) $archive = new PharData($fullfilename); + $importedsomething = false; + foreach($archive as $file) { if(isset($_POST["blacklist"]) && $file->getFilename() === "blacklist.txt") { $blacklist = process_file(file_get_contents($file)); echo "Processing blacklist.txt
    \n"; - exec("sudo pihole -b --nuke"); - exec("sudo pihole -b -q ".implode(" ", $blacklist)); + exec("sudo pihole -b -nr --nuke"); + exec("sudo pihole -b -q -nr ".implode(" ", $blacklist)); + $importedsomething = true; } if(isset($_POST["whitelist"]) && $file->getFilename() === "whitelist.txt") { $whitelist = process_file(file_get_contents($file)); echo "Processing whitelist.txt
    \n"; - exec("sudo pihole -w --nuke"); - exec("sudo pihole -w -q ".implode(" ", $whitelist)); + exec("sudo pihole -w -nr --nuke"); + exec("sudo pihole -w -q -nr ".implode(" ", $whitelist)); + $importedsomething = true; } if(isset($_POST["wildlist"]) && $file->getFilename() === "wildcardblocking.txt") { $wildlist = process_file(file_get_contents($file)); echo "Processing wildcardblocking.txt
    \n"; - exec("sudo pihole -wild --nuke"); - exec("sudo pihole -wild -q ".implode(" ", $wildlist)); + exec("sudo pihole -wild -nr --nuke"); + exec("sudo pihole -wild -q -nr ".implode(" ", $wildlist)); + $importedsomething = true; + } + if($importedsomething) + { + exec("sudo pihole restartdns"); } } From cea17a476658f0a3c7ccbe8e61ca9c55272bd5f2 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 7 Oct 2017 16:51:22 -0400 Subject: [PATCH 139/215] Allow whitelisting/blacklist even if there is no password set --- scripts/pi-hole/php/auth.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/pi-hole/php/auth.php b/scripts/pi-hole/php/auth.php index b3fe6a64..0964a275 100644 --- a/scripts/pi-hole/php/auth.php +++ b/scripts/pi-hole/php/auth.php @@ -144,11 +144,7 @@ function list_verify($type) { elseif(isset($_POST['pw'])) { require("password.php"); - if(strlen($pwhash) == 0) - { - log_and_die("No password set - ".htmlspecialchars($type)."listing without password not supported"); - } - elseif($wrongpassword) + if($wrongpassword || !$auth) { log_and_die("Wrong password - ".htmlspecialchars($type)."listing of ${_POST['domain']} not permitted"); } From c60b703680f0fe7f8bff7e35e47a08d228a89c81 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 7 Oct 2017 17:09:49 -0400 Subject: [PATCH 140/215] Appease codacy --- scripts/pi-hole/php/auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/auth.php b/scripts/pi-hole/php/auth.php index 0964a275..85d38f8f 100644 --- a/scripts/pi-hole/php/auth.php +++ b/scripts/pi-hole/php/auth.php @@ -131,7 +131,7 @@ function check_domain() { } function list_verify($type) { - global $pwhash, $wrongpassword; + global $pwhash, $wrongpassword, $auth; if(!isset($_POST['domain']) || !isset($_POST['list']) || !(isset($_POST['pw']) || isset($_POST['token']))) { log_and_die("Missing POST variables"); } From 33db4f2842474f780d30a393380df38742f41759 Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Tue, 10 Oct 2017 10:40:18 +0100 Subject: [PATCH 141/215] Redirect the user in a POST-Redirect-GET fashion after a successful login --- scripts/pi-hole/php/password.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/pi-hole/php/password.php b/scripts/pi-hole/php/password.php index 40095563..acb404ab 100644 --- a/scripts/pi-hole/php/password.php +++ b/scripts/pi-hole/php/password.php @@ -40,6 +40,13 @@ if($postinput == $pwhash) { $_SESSION["hash"] = $pwhash; + + // Login successful, redirect the user to the homepage to discard the POST request + if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_SERVER['QUERY_STRING'] === 'login') { + header(sprintf('Location: index.php')); + exit(); + } + $auth = true; } else From a3aecbf15a9bb71bae02b6a563d030b1ba77dd0d Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Tue, 10 Oct 2017 18:42:32 +0100 Subject: [PATCH 142/215] Remove unused sprintf function --- scripts/pi-hole/php/password.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/password.php b/scripts/pi-hole/php/password.php index acb404ab..77ee2863 100644 --- a/scripts/pi-hole/php/password.php +++ b/scripts/pi-hole/php/password.php @@ -43,7 +43,7 @@ // Login successful, redirect the user to the homepage to discard the POST request if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_SERVER['QUERY_STRING'] === 'login') { - header(sprintf('Location: index.php')); + header('Location: index.php'); exit(); } From ff82895be88afcae57b04674f28aef08ec453498 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Wed, 11 Oct 2017 15:00:51 -0400 Subject: [PATCH 143/215] Fix error when no client over time data is available --- scripts/pi-hole/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index ba706ac1..9f8cb8c6 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -313,7 +313,7 @@ function updateClientsOverTime() { clientsChart.data.datasets[0].pointHoverRadius = 5; clientsChart.data.datasets[0].label = labels[0]; - for (i = clientsChart.data.datasets.length; i < plotdata[0].length; i++) + for (i = clientsChart.data.datasets.length; plotdata.length && i < plotdata[0].length; i++) { clientsChart.data.datasets.push({data: [], backgroundColor: colors[i], pointRadius: 0, pointHitRadius: 5, pointHoverRadius: 5, label: labels[i], cubicInterpolationMode: "monotone" }); } From 60b5e36c323c4f5a8408de7faf4c8a3d4e858d47 Mon Sep 17 00:00:00 2001 From: WaLLy3K Date: Thu, 12 Oct 2017 20:54:04 +1100 Subject: [PATCH 144/215] Check for updates every two days Signed off by WaLLy3K --- scripts/pi-hole/php/update_checker.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/php/update_checker.php b/scripts/pi-hole/php/update_checker.php index 6629b6a6..895af0d2 100644 --- a/scripts/pi-hole/php/update_checker.php +++ b/scripts/pi-hole/php/update_checker.php @@ -51,8 +51,8 @@ if(is_readable($versionfile)) // Obtain latest time stamp from buffer file $versions = explode(",",file_get_contents($versionfile)); - // Is last check for updates older than 30 minutes? - if($timestamp >= intval($versions[0]) + 1800) + // Is last check for updates older than 48 hours? + if($timestamp >= intval($versions[0]) + 172800) { // Yes: Retrieve new/updated version data $check_version = true; From a90222d8568fea74e23d9da92b4ff1b89d92a799 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 14 Oct 2017 15:06:44 +0200 Subject: [PATCH 145/215] Show "Query Types (over time)" and "Forward Destinations (over time)" only if requested by a setting in setupVars.conf Signed-off-by: DL6ER --- index.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/index.php b/index.php index 6bf6f260..423677da 100644 --- a/index.php +++ b/index.php @@ -159,8 +159,30 @@ else
    + +
    +
    @@ -177,6 +199,7 @@ else
    +
    @@ -193,7 +216,9 @@ else
    +
    + Date: Wed, 18 Oct 2017 16:04:31 +0200 Subject: [PATCH 146/215] Re-designed settings page using Bootstrap Tabs. No functional change. Signed-off-by: DL6ER --- settings.php | 368 +++++++++++++++++++++++---------------------------- 1 file changed, 163 insertions(+), 205 deletions(-) diff --git a/settings.php b/settings.php index 2ef1de67..a09cbd26 100644 --- a/settings.php +++ b/settings.php @@ -63,8 +63,23 @@ if(isset($_POST["submit"])) {
    -
    -
    +
    +
    + -
    +
    +
    +
    -
    -
    -

    Query Logging (size of log )

    -
    -

    Current status: Enabled (recommended) @@ -637,8 +626,6 @@ readStaticLeasesFile();

    Note that disabling will render graphs on the web user interface useless

    -
    - -
    +
    + +
    +
    +
    + + $value) { ?> +
    +
    + +
    +
    + +
    + +
    + + + + +
    +
    +
    +
    +
    -
    -
    -

    Pi-Hole's Block Lists

    -
    -
    -
    -
    -
    - - $value) { ?> -
    -
    - -
    -
    - -
    - -
    -
    -
    - -
    -
    -
    -
    -

    API

    -
    -
    +
    +

    Top Lists

    Exclude the following domains from being shown in

    -
    -
    - - -
    +
    +
    +
    + +
    -
    -
    - - -
    +
    +
    +
    + +
    +
    +

    Privacy settings (Statistics / Query Log)

    +
    -
    -
    -
    +
    +
    -
    -
    -
    -
    +
    +
    +
    +
    +
    +

    Privacy mode

    -
    -
    -
    - +
    -
    +
    +
    -
    -
    -

    Web User Interface

    -
    -
    +
    +
    Query Log Page
    @@ -813,58 +791,13 @@ readStaticLeasesFile();
    -
    - +
    -
    - -
    -

    Blocking Page

    -
    -

    Show page with details if a site is blocked

    -
    -
    -
    -

    If Yes: Hide content for in page ads?

    -
    -
    -
    -
    -*/ ?> -
    -
    -

    System Administration

    -
    -
    - - - - - -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    +
    -
    -
    -

    Pi-hole FTL (RunningNot running)

    -
    +
    +
    +FTL version: 
    +
    +Process identifier (PID): 
    +
    +Time FTL started: 
    +
    +User / Group:  / 
    +
    +Total CPU utilization: %
    +Memory utilization: %
    +Used memory: 
    +
    +
    -
    - FTL version:
    - Process identifier (PID):
    - Time FTL started:
    - User / Group: /
    - Total CPU utilization: %
    - Memory utilization: %
    - Used memory:
    - -
    -
    -
    -
    -

    Pi-hole Teleporter

    -
    -
    -
    +
    +
    @@ -932,6 +861,35 @@ if($FTL)

    The PHP extension Phar is not loaded. Please ensure it is installed and loaded if you want to use the Pi-hole teleporter. +

    +
    +
    +
    +

    Danger area!

    + + + + + + + + + +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    From a43b5f8e0db22e24345e34ca8e1f4a1c861082ba Mon Sep 17 00:00:00 2001 From: BrokenCommander Date: Wed, 18 Oct 2017 19:49:06 +0200 Subject: [PATCH 147/215] Small change Since the user can't select the box text anyway, set the cursor to default. --- style/pi-hole.css | 1 + 1 file changed, 1 insertion(+) diff --git a/style/pi-hole.css b/style/pi-hole.css index 53cf662a..3fc896c8 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -6,6 +6,7 @@ * Please see LICENSE file for your rights under this license. */ .small-box { + cursor: default; -webkit-user-select: none; /* Chrome/Safari */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* IE10+ */ From aa546d4c7ec26833eb9499413948c13c5ffe0e59 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 18 Oct 2017 22:52:53 +0100 Subject: [PATCH 148/215] Move networking to `System` box, tidy up DHCP. (could probably do with more tidying) Signed-off-by: Adam Warner --- settings.php | 1889 ++++++++++++++++++++++++++++---------------------- 1 file changed, 1049 insertions(+), 840 deletions(-) diff --git a/settings.php b/settings.php index a09cbd26..51df6e0a 100644 --- a/settings.php +++ b/settings.php @@ -5,768 +5,853 @@ * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ - require "scripts/pi-hole/php/header.php"; - require "scripts/pi-hole/php/savesettings.php"; - // Reread ini file as things might have been changed - $setupVars = parse_ini_file("/etc/pihole/setupVars.conf"); +require "scripts/pi-hole/php/header.php"; +require "scripts/pi-hole/php/savesettings.php"; +// Reread ini file as things might have been changed +$setupVars = parse_ini_file("/etc/pihole/setupVars.conf"); -function command_exist($cmd) { - return !empty(shell_exec(sprintf("which %s", escapeshellarg($cmd)))); +function command_exist($cmd) +{ + return !empty(shell_exec(sprintf("which %s", escapeshellarg($cmd)))); } + ?> refresh to the gravity page and start updating immediately -?> - - +if (isset($_POST["submit"])) { + if ($_POST["submit"] == "saveupdate") { + // If that is the case -> refresh to the gravity page and start updating immediately + ?> + + - - + + - 0){ ?> - + 0) { ?> + - 0){ ?> - + 0) { ?> +
    -
    - + + +
    - +
    @@ -493,184 +528,204 @@ if (isset($_POST["submit"])) { $DNSinterface = "single"; } ?> +
    - -
    - - - - - - - - $value) { ?> - - - - - - - - - - - - - - - - -
    IPv4IPv6Name
    ">" - value="true" - checked > - ">" - value="true" - checked > - ">" - value="true" - checked disabled > - ">" - value="true" - checked disabled > -
    -
    -
    - -
    - -
    -
    checked> -
    - value=""> -
    - -
    -
    checked> -
    - value=""> -
    - -
    -
    checked> -
    - value=""> -
    - -
    -
    checked> -
    - value=""> -
    -
    -
    -
    -
    -
    -

    Advanced DNS settings

    -
    - -
    + + +
    +
    +
    +

    Upstream DNS Servers

    -
    -
    -
    +
    +
    + + + + + + + $value) { ?> + + + + + + + + + + + + + + + + +
    IPv4IPv6Name
    ">" + value="true" + checked > + ">" + value="true" + checked > + ">" + value="true" + checked disabled > + ">" + value="true" + checked disabled > +
    -
    -
    -
    -

    Note that enabling these two options may increase your privacy - slightly, but - may also prevent you from being able to access local hostnames - if the - Pi-hole is not used as DHCP server

    -
    -
    -
    -

    Validate DNS replies and cache DNSSEC data. When forwarding DNS - queries, - Pi-hole requests the DNSSEC records needed to validate the - replies. Use - Google or Norton DNS servers when activating DNSSEC. Note that - the size of - your log might increase significantly when enabling DNSSEC. A - DNSSEC - resolver test can be found here.

    - -
    - -
    - -
    -
    - -
    -
    - +
    + +
    + +
    +
    checked> +
    + value=""> +
    + +
    +
    checked> +
    + value=""> +
    + +
    +
    checked> +
    + value=""> +
    + +
    +
    checked> +
    + value=""> +
    -
    - - -
    +
    +
    +
    +
    +
    +

    Advanced DNS settings

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Note that enabling these two options may increase your privacy + slightly, but + may also prevent you from being able to access local hostnames + if the + Pi-hole is not used as DHCP server

    +
    +
    +
    +

    Validate DNS replies and cache DNSSEC data. When forwarding DNS + queries, + Pi-hole requests the DNSSEC records needed to validate the + replies. Use + Google or Norton DNS servers when activating DNSSEC. Note that + the size of + your log might increase significantly when enabling DNSSEC. A + DNSSEC + resolver test can be found here.

    + +
    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + + + +
    +
    +
    +
    %
    -
    From 5dc556c7b9f77b506848d558c16a583f761bc7b3 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 18 Oct 2017 23:14:26 +0100 Subject: [PATCH 150/215] move some of the PHP parts up above the HTML to make the HTML easier to work with. (WIP) Signed-off-by: Adam Warner --- settings.php | 422 ++++++++++++++++++++++++++------------------------- 1 file changed, 213 insertions(+), 209 deletions(-) diff --git a/settings.php b/settings.php index f6f41dbc..ace77b3e 100644 --- a/settings.php +++ b/settings.php @@ -115,6 +115,118 @@ if (isset($setupVars["IPV6_ADDRESS"])) { $hostname = trim(file_get_contents("/etc/hostname"), "\x00..\x1F"); ?> + + + + + +
    -
    -
    - - +
    @@ -640,128 +683,119 @@ $hostname = trim(file_get_contents("/etc/hostname"), "\x00..\x1F");
    - -
    -
    -
    -
    -
    -

    Advanced DNS settings

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Note that enabling these two options may increase your privacy - slightly, but - may also prevent you from being able to access local hostnames - if the - Pi-hole is not used as DHCP server

    -
    -
    -
    -

    Validate DNS replies and cache DNSSEC data. When forwarding DNS - queries, - Pi-hole requests the DNSSEC records needed to validate the - replies. Use - Google or Norton DNS servers when activating DNSSEC. Note that - the size of - your log might increase significantly when enabling DNSSEC. A - DNSSEC - resolver test can be found here.

    -
    - -
    - +
    +
    +
    +
    +
    +

    Advanced DNS settings

    +
    +
    +
    +
    +
    -
    - +
    +
    -
    - +

    Note that enabling these two options may increase your privacy + slightly, but + may also prevent you from being able to access local hostnames + if the + Pi-hole is not used as DHCP server

    +
    +
    -
    +

    Validate DNS replies and cache DNSSEC data. When forwarding DNS + queries, + Pi-hole requests the DNSSEC records needed to validate the + replies. Use + Google or Norton DNS servers when activating DNSSEC. Note that + the size of + your log might increase significantly when enabling DNSSEC. A + DNSSEC + resolver test can be found here.

    +
    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    + + +
    - - -
    -
    -
    - -

    Current status: - - Enabled (recommended) - - Disabled -

    - -

    Note that disabling will render graphs on the web user interface useless

    - -
    - - - - - - - - - - -
    +
    +
    +

    Current status: + + Enabled (recommended) + + Disabled +

    + +

    Note that disabling will render graphs on the web user interface useless

    + +
    + + + + + + + + + + +
    +
    +
    @@ -805,36 +839,6 @@ $hostname = trim(file_get_contents("/etc/hostname"), "\x00..\x1F");
    -
    From 37313bf400c7a7a6e3354c68df52667df97989b6 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 18 Oct 2017 23:41:03 +0100 Subject: [PATCH 151/215] Go to specified tab on save or hyperlink Signed-off-by: DL6ER --- scripts/pi-hole/js/settings.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 73c1dfab..31305b32 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -161,3 +161,9 @@ $("button[id^='adlist-btn-']").on("click", function (e) { $(this).siblings("input[name^='adlist-enable-']").prop("disabled", !status); $(this).siblings("a").css("text-decoration", textType); }); + +// Javascript to go to specified tab on save or hyperlink +$(function () { + var activeTab = $('[href=' + location.hash + ']'); + activeTab && activeTab.tab('show'); +}); From 1e105f1df617111b06fc5a583321ae8c41524150 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 18 Oct 2017 23:45:12 +0100 Subject: [PATCH 152/215] Change hash for save and reload Signed-off-by: DL6ER --- scripts/pi-hole/js/settings.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 31305b32..44a26f39 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -167,3 +167,7 @@ $(function () { var activeTab = $('[href=' + location.hash + ']'); activeTab && activeTab.tab('show'); }); +// Change hash for save and reload +$('.nav-tabs a').on('shown.bs.tab', function (e) { + window.location.hash = e.target.hash; +}) From 903cb2a4f43247884139e2e65f34df867f9466e3 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 18 Oct 2017 23:55:02 +0100 Subject: [PATCH 153/215] Make DNS the default tab Signed-off-by: DL6ER --- scripts/pi-hole/js/settings.js | 9 +++++---- settings.php | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 44a26f39..155557c3 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -164,10 +164,11 @@ $("button[id^='adlist-btn-']").on("click", function (e) { // Javascript to go to specified tab on save or hyperlink $(function () { - var activeTab = $('[href=' + location.hash + ']'); - activeTab && activeTab.tab('show'); + var activeTab = $("[href=" + location.hash + "]"); + activeTab && activeTab.tab("show"); }); // Change hash for save and reload -$('.nav-tabs a').on('shown.bs.tab', function (e) { +$(".nav-tabs a").on("shown.bs.tab", function (e) { window.location.hash = e.target.hash; -}) + window.scrollTo(0, 0); +}); diff --git a/settings.php b/settings.php index ace77b3e..ae9f45d1 100644 --- a/settings.php +++ b/settings.php @@ -231,8 +231,8 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    @@ -708,7 +708,7 @@ if (isset($setupVars["API_PRIVACY_MODE"])) { checked >Listen on all interfaces, permit all origins
    -

    Note that the last option should not be used on devices which are directly connected to the Internet. This option is safe if your Pi-hole is located within your local network, i.e. protected behind your router, and you have not forwarded port 53 to this device. In virtually all other cases you have to make sure that your Pi-hole is properly firewalled. +

    Note that the last option should not be used on devices which are directly connected to the Internet. This option is safe if your Pi-hole is located within your local network, i.e. protected behind your router, and you have not forwarded port 53 to this device. In virtually all other cases you have to make sure that your Pi-hole is properly firewalled.

    From 62b8c0d733ecbfc3de08530e906c6cfe59fde714 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 19 Oct 2017 23:06:38 +0100 Subject: [PATCH 160/215] fix dhcp lease table headers/footers. Signed-off-by: Adam Warner --- scripts/pi-hole/js/settings.js | 16 +-- settings.php | 219 ++++++++++++++++++--------------- 2 files changed, 128 insertions(+), 107 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 155557c3..03a7fa72 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -115,12 +115,9 @@ $(document).ready(function() { "columnDefs": [ { "bSortable": false, "orderable": false, targets: -1} ], "paging": false, "scrollCollapse": true, - "scrollY": "200px", + "scrollY": "500px", "scrollX" : true }); - $("#leaseexpand").on( "click", function () { - setTimeout(function(){leasetable.draw();},100); - } ); } if(document.getElementById("DHCPStaticLeasesTable")) { @@ -130,12 +127,15 @@ $(document).ready(function() { "paging": false, "scrollCollapse": true, "scrollY": "200px", - "scrollX" : true + "scrollX" : "100%" }); - $("#leaseexpand").on( "click", function () { - setTimeout(function(){staticleasetable.draw();},100); - } ); } + //call draw() on each table... they don't render properly with scrollX and scrollY set... ¯\_(ツ)_/¯ + $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { + leasetable.draw(); + staticleasetable.draw(); + }); + } ); // Handle hiding of alerts diff --git a/settings.php b/settings.php index 0bf3f4ce..72746feb 100644 --- a/settings.php +++ b/settings.php @@ -294,7 +294,6 @@ if (isset($setupVars["API_PRIVACY_MODE"])) { $piHoleDomain = "local"; } ?> -
    @@ -484,84 +483,87 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {

    DHCP leases

    -
    - - - - - - - - - - - - -
    Remaining lease time:
    DHCP UID: "> - - - - - -
    MAC addressIP addressHostname
    - -
    -
    -
    -
    - - - - - - - - - - - - +
    +
    + +
    MAC addressIP addressHostname
    + - - - - - - - - - - - - - -
    0) { ?> -
    - -
    -

    Specifying the MAC address is mandatory and only one entry per MAC - address is allowed. If the IP address is omitted and a host name is - given, the IP address will still be generated dynamically and the - specified host name will be used. If the host name is omitted, only - a - static lease will be added.

    + MAC address + IP address + Hostname + + + + + +
    Remaining lease time:
    DHCP UID: "> + + + + + + + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MAC addressIP addressHostname
    0) { ?> +
    + +
    +

    Specifying the MAC address is mandatory and only one entry per MAC + address is allowed. If the IP address is omitted and a host name is + given, the IP address will still be generated dynamically and the + specified host name will be used. If the host name is omitted, only + a + static lease will be added.

    +
    @@ -696,19 +698,30 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    + checked >Listen + on all interfaces
    Allows only queries from + devices that are at most one hop away (local + devices)
    + checked >Listen + on all interfaces, permit all origins
    -

    Note that the last option should not be used on devices which are directly connected to the Internet. This option is safe if your Pi-hole is located within your local network, i.e. protected behind your router, and you have not forwarded port 53 to this device. In virtually all other cases you have to make sure that your Pi-hole is properly firewalled.

    +

    Note that the last option should not be used on devices which are + directly connected to the Internet. This option is safe if your + Pi-hole is located within your local network, i.e. protected behind + your router, and you have not forwarded port 53 to this device. In + virtually all other cases you have to make sure that your Pi-hole is + properly firewalled.

    @@ -976,18 +989,19 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    -FTL version: 
    +                                FTL version: 
     
    -Process identifier (PID): 
    +                                Process identifier (PID): 
     
    -Time FTL started: 
    +                                Time FTL started: 
     
    -User / Group:  / 
    +                                User / Group: 
    +                                / 
     
    -Total CPU utilization: %
    +                                Total CPU utilization: %
     Memory utilization: %
     Used memory: 
    -
    +
    @@ -1101,17 +1115,24 @@ Memory utilization: %

    Danger Zone!


    -

    -

    -

    -

    +

    + +

    + +

    +

    + +

    +

    + +

    From f6a05a00b3c804760429caa456b67c0108249093 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 19 Oct 2017 23:09:13 +0100 Subject: [PATCH 161/215] tidy up some experimenting Signed-off-by: Adam Warner --- scripts/pi-hole/js/settings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 03a7fa72..b5b274a5 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -115,7 +115,7 @@ $(document).ready(function() { "columnDefs": [ { "bSortable": false, "orderable": false, targets: -1} ], "paging": false, "scrollCollapse": true, - "scrollY": "500px", + "scrollY": "200px", "scrollX" : true }); } @@ -127,7 +127,7 @@ $(document).ready(function() { "paging": false, "scrollCollapse": true, "scrollY": "200px", - "scrollX" : "100%" + "scrollX" : true }); } //call draw() on each table... they don't render properly with scrollX and scrollY set... ¯\_(ツ)_/¯ From 3640867942bdbf2d0a219b7f757ad65eecbcdf96 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 20 Oct 2017 19:30:17 +0200 Subject: [PATCH 162/215] :codacy: Signed-off-by: DL6ER --- scripts/pi-hole/js/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index b5b274a5..5b6b5960 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -131,7 +131,7 @@ $(document).ready(function() { }); } //call draw() on each table... they don't render properly with scrollX and scrollY set... ¯\_(ツ)_/¯ - $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { + $("a[data-toggle=\"tab\"]").on("shown.bs.tab", function (e) { leasetable.draw(); staticleasetable.draw(); }); From 7bd0fb1e56af02da38937ef44810a5e5ccb6d3c9 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 20 Oct 2017 22:29:53 +0100 Subject: [PATCH 163/215] Sort out system tab. Start sorting out blocklists tab... but it's very broken! Duplicates disabled lists.... Signed-off-by: Adam Warner --- settings.php | 392 +++++++++++++++++++++++++++++---------------------- 1 file changed, 225 insertions(+), 167 deletions(-) diff --git a/settings.php b/settings.php index 72746feb..e51fd9d8 100644 --- a/settings.php +++ b/settings.php @@ -231,19 +231,85 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    -
    @@ -1197,8 +1190,6 @@ if (isset($setupVars["API_PRIVACY_MODE"])) { system
    - - From a2f090571262544c9f3f10af37c4cf40a930d32c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 21 Oct 2017 13:19:14 +0200 Subject: [PATCH 180/215] Combine API and web interface tabs Signed-off-by: DL6ER --- settings.php | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/settings.php b/settings.php index d0310c0a..b606b7e9 100644 --- a/settings.php +++ b/settings.php @@ -235,8 +235,7 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
  • Block Lists
  • DNS
  • DHCP
  • -
  • API
  • -
  • Web Interface
  • +
  • API / Web interface
  • Teleporter
  • @@ -838,11 +837,20 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    - + +
    -
    +

    API settings

    @@ -904,23 +912,7 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    -
    - -
    - -
    - -
    -
    -
    +

    Web interface settings

    From 1a707a081fbed12f49d35672678b7f3317b5173c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 21 Oct 2017 13:53:34 +0200 Subject: [PATCH 181/215] Rearragne buttons on the system tabs Signed-off-by: DL6ER --- scripts/pi-hole/js/settings.js | 17 ++++++ settings.php | 103 ++++++++++++++++----------------- 2 files changed, 68 insertions(+), 52 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 3dccbb92..e9217ea8 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -84,6 +84,23 @@ $(".confirm-flushlogs").confirm({ dialogClass: "modal-dialog modal-mg" }); +$(".confirm-disablelogging").confirm({ + text: "Note that disabling query logging will render graphs on the web user interface useless. Are you sure you want to disable your logging?", + title: "Confirmation required", + confirm(button) { + $("#disablelogsform").submit(); + }, + cancel(button) { + // nothing to do + }, + confirmButton: "Yes, disable logs", + cancelButton: "No, go back", + post: true, + confirmButtonClass: "btn-danger", + cancelButtonClass: "btn-success", + dialogClass: "modal-dialog modal-mg" +}); + $(".api-token").confirm({ text: "Make sure that nobody else can scan this code around you. They will have full access to the API without having to know the password. Note that the generation of the QR code will take some time.", title: "Confirmation required", diff --git a/settings.php b/settings.php index b606b7e9..7647016f 100644 --- a/settings.php +++ b/settings.php @@ -1056,6 +1056,19 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    +
    +
    +

    Logging

    +
    +
    +

    Current status: + + Enabled (recommended) + + Disabled +

    +
    +
    - -
    -
    -
    -
    -

    Logging

    -
    -
    -

    Current status: - - Enabled (recommended) - - Disabled -

    - -

    Note that disabling will render graphs on the web user interface useless

    - -
    - -
    -
    -
    -
    -

    Danger Zone!


    -
    - +
    +
    + +
    +
    + + + +
    + + + + +
    + +
    -
    - -
    -
    - +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + + + +
    From 8b61ea5c05beef12b1c1df9ba0f69f4fa75ec456 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 21 Oct 2017 14:33:16 +0200 Subject: [PATCH 182/215] Another small arrangement Signed-off-by: DL6ER --- settings.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/settings.php b/settings.php index 7647016f..2a7ff3dc 100644 --- a/settings.php +++ b/settings.php @@ -1143,7 +1143,7 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    - +
    @@ -1161,9 +1161,7 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    - +
    -
    + +
    @@ -1163,11 +1164,13 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    +
    +
    From c3b054ab5d71dc8f3e7029d350eca55ea192f3f9 Mon Sep 17 00:00:00 2001 From: TheME Date: Thu, 2 Nov 2017 21:57:33 +0100 Subject: [PATCH 205/215] Adjust boxes grid for small screens --- settings.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/settings.php b/settings.php index 6c73c78b..5ef58899 100644 --- a/settings.php +++ b/settings.php @@ -378,7 +378,7 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    -
    +
    From
    @@ -389,7 +389,7 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    -
    +
    To
    @@ -637,14 +637,14 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    in active">
    -
    +

    Upstream DNS Servers

    -
    +
    @@ -692,7 +692,7 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    IPv4
    -
    +
    @@ -745,7 +745,7 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    -
    +

    Interface listening behavior

    @@ -856,7 +856,7 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp", ?>
    in active">
    -
    +
    @@ -870,7 +870,7 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    -
    +
    -
    +
    +
    - +
    @@ -880,17 +880,20 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    -
    +
    + +
    -
    +
    + +
    @@ -898,10 +901,11 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",

    Privacy mode

    -
    +
    + +
    @@ -926,21 +930,28 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",

    Interface appearance

    -
    +
    + +

    CPU Temperature Unit

    -
    +
    +
    -
    +
    +
    -
    +
    +
    From 8837ed75254655349cbc14c430ec1a6b5f81b71a Mon Sep 17 00:00:00 2001 From: TheME Date: Sat, 4 Nov 2017 23:39:33 +0100 Subject: [PATCH 210/215] clean up code in Sysadmin section --- settings.php | 76 +++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 43 deletions(-) diff --git a/settings.php b/settings.php index fd995f12..41416e37 100644 --- a/settings.php +++ b/settings.php @@ -1103,41 +1103,36 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FTL version:
    Process identifier (PID):
    Time FTL started:
    User / Group: - /
    Total CPU utilization:%
    Memory utilization: - % -
    Used memory: - -
    FTL version:
    Process identifier (PID):
    Time FTL started:
    User / Group: /
    Total CPU utilization:%
    Memory utilization:%
    + Used memory: +
    @@ -1178,20 +1173,16 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    - +
    - +
    - +
    @@ -1211,7 +1202,6 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    -
    From 7e826901ddbd2057e3b6e9757b3a201b4232a00a Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 4 Nov 2017 21:24:45 -0400 Subject: [PATCH 211/215] Switch location of 'Restart dnsmasq' and 'Disable query logging' --- settings.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/settings.php b/settings.php index 7123c608..c6ba7a17 100644 --- a/settings.php +++ b/settings.php @@ -1154,10 +1154,6 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    - -
    - -
    @@ -1169,6 +1165,10 @@ if (isset($setupVars["API_PRIVACY_MODE"])) {
    + +
    + +

    From 603871737a96b86d2bfc991a2a67d14dd5d8afff Mon Sep 17 00:00:00 2001 From: TheME Date: Tue, 7 Nov 2017 16:59:13 +0100 Subject: [PATCH 212/215] fix 'settings page crashing' if FTL is offline Display Message instead of table in 'FTL Information'-Box and fix settings page crash --- settings.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/settings.php b/settings.php index 17235cbd..709a1a67 100644 --- a/settings.php +++ b/settings.php @@ -1082,17 +1082,6 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    -
    @@ -1101,6 +1090,16 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    + @@ -1135,6 +1134,9 @@ if (in_array($_GET['tab'], array("sysadmin", "blocklists", "dns", "piholedhcp",
    + +
    The FTL service is offline!
    +
    From 3ec55dbf0a318d39caa5405e92e741f0ab269d94 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Wed, 22 Nov 2017 13:25:23 -0500 Subject: [PATCH 213/215] Improve domain whitespace handling in inputs --- scripts/pi-hole/js/list.js | 2 +- scripts/pi-hole/js/queryads.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/pi-hole/js/list.js b/scripts/pi-hole/js/list.js index 664d64b2..e438f1b9 100644 --- a/scripts/pi-hole/js/list.js +++ b/scripts/pi-hole/js/list.js @@ -141,7 +141,7 @@ function add(arg) { $.ajax({ url: "scripts/pi-hole/php/add.php", method: "post", - data: {"domain":domain.val(), "list":locallistType, "token":token}, + data: {"domain":domain.val().trim(), "list":locallistType, "token":token}, success: function(response) { if (response.indexOf("] Pi-hole blocking is ") === -1) { alFailure.show(); diff --git a/scripts/pi-hole/js/queryads.js b/scripts/pi-hole/js/queryads.js index 5d56068f..b86a0309 100644 --- a/scripts/pi-hole/js/queryads.js +++ b/scripts/pi-hole/js/queryads.js @@ -57,9 +57,10 @@ function httpGet(ta,quiet,theUrl) function eventsource() { var ta = $("#output"); - var domain = $("#domain"); + var domain = $("#domain").val().trim(); var q = $("#quiet"); - if(domain.val().length === 0) + + if(domain.length === 0) { return; } @@ -73,12 +74,12 @@ function eventsource() { // IE does not support EventSource - load whole content at once if (typeof EventSource !== "function") { - httpGet(ta,quiet,"/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+exact+"&IE"); + httpGet(ta,quiet,"/admin/scripts/pi-hole/php/queryads.php?domain="+domain.toLowerCase()+exact+"&IE"); return; } var host = window.location.host; - var source = new EventSource("/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+"&"+exact); + var source = new EventSource("/admin/scripts/pi-hole/php/queryads.php?domain="+domain.toLowerCase()+"&"+exact); // Reset and show field ta.empty(); From aa42f3d282835572e78fd1e157c763c2f8d4a598 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 2 Dec 2017 11:16:20 +0100 Subject: [PATCH 214/215] :codacy: Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 24e37b88..218794a0 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -189,24 +189,24 @@ $(document).ready(function() { "initComplete": function () { var api = this.api(); // Query type IPv4 / IPv6 - api.$('td:eq(1)').click( function () { api.search( this.innerHTML ).draw(); $('#resetButton').show(); } ); - api.$('td:eq(1)').hover( - function () { this.title="Click to show only "+this.innerHTML+" queries"; this.style.color="#72afd2" }, - function () { this.style.color="" } + api.$("td:eq(1)").click( function () { api.search( this.innerHTML ).draw(); $("#resetButton").show(); } ); + api.$("td:eq(1)").hover( + function () { this.title="Click to show only "+this.innerHTML+" queries"; this.style.color="#72afd2"; }, + function () { this.style.color=""; } ); api.$("td:eq(1)").css("cursor","pointer"); // Domain - api.$('td:eq(2)').click( function () { api.search( this.innerHTML ).draw(); $('#resetButton').show(); } ); - api.$('td:eq(2)').hover( - function () { this.title="Click to show only queries with domain "+this.innerHTML; this.style.color="#72afd2" }, - function () { this.style.color="" } + api.$("td:eq(2)").click( function () { api.search( this.innerHTML ).draw(); $("#resetButton").show(); } ); + api.$("td:eq(2)").hover( + function () { this.title="Click to show only queries with domain "+this.innerHTML; this.style.color="#72afd2"; }, + function () { this.style.color=""; } ); api.$("td:eq(2)").css("cursor","pointer"); // Client - api.$('td:eq(3)').click( function () { api.search( this.innerHTML ).draw(); $('#resetButton').show(); } ); - api.$('td:eq(3)').hover( - function () { this.title="Click to show only queries made by "+this.innerHTML; this.style.color="#72afd2" }, - function () { this.style.color="" } + api.$("td:eq(3)").click( function () { api.search( this.innerHTML ).draw(); $("#resetButton").show(); } ); + api.$("td:eq(3)").hover( + function () { this.title="Click to show only queries made by "+this.innerHTML; this.style.color="#72afd2"; }, + function () { this.style.color=""; } ); api.$("td:eq(3)").css("cursor","pointer"); } @@ -224,7 +224,7 @@ $(document).ready(function() { } } ); - $('#resetButton').click( function () { tableApi.search("").draw(); $('#resetButton').hide(); } ); + $("#resetButton").click( function () { tableApi.search("").draw(); $("#resetButton").hide(); } ); } ); From 9c97c97504b971f3cdb4b98fa1677274a3899d72 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 7 Dec 2017 00:44:25 +0000 Subject: [PATCH 215/215] Update queries.js Add a space to the header to force codacy to move on from the current commit in this PR --- scripts/pi-hole/js/queries.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 218794a0..72b4a002 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -3,7 +3,7 @@ * Network-wide ad blocking via your own hardware. * * This file is copyright under the latest version of the EUPL. -* Please see LICENSE file for your rights under this license. */ +* Please see LICENSE file for your rights under this license. */ var tableApi; function escapeRegex(text) {