From bb3d343c390a1a7d3c33b452cf4f1712ed1bf68d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 8 Dec 2016 10:52:20 +0100 Subject: [PATCH 01/16] Fix versionCompare(left, right) --- js/pihole/footer.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/pihole/footer.js b/js/pihole/footer.js index b8a7dc24..7e2b0401 100644 --- a/js/pihole/footer.js +++ b/js/pihole/footer.js @@ -42,12 +42,16 @@ var piholeVersion = $("#piholeVersion").html(); var webVersion = $("#webVersion").html(); // Credit for following function: https://gist.github.com/alexey-bass/1115557 +// Modified to discard any possible "v" in the string function versionCompare(left, right) { if (typeof left + typeof right != 'stringstring') return false; - var a = left.split('.') - , b = right.split('.') + var aa = left.split("v"), + bb = right.split("v"); + + var a = aa[aa.length-1].split(".") + , b = bb[bb.length-1].split(".") , i = 0, len = Math.max(a.length, b.length); for (; i < len; i++) { @@ -58,8 +62,7 @@ function versionCompare(left, right) { } } - return 0; -} + // Update check $.getJSON("https://api.github.com/repos/pi-hole/pi-hole/releases/latest", function(json) { From 6459e174783f6e1b30c5e80af152e53793f87202 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 8 Dec 2016 12:53:25 +0100 Subject: [PATCH 02/16] Improve Help Center --- help.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/help.php b/help.php index 3139a8a1..1069b638 100644 --- a/help.php +++ b/help.php @@ -89,13 +89,13 @@

Update Lists

-

Runs the command

sudo pihole -g
and prints the result transparently to the web UI. The gravity.sh script will update the list of ad-serving domains

+

Will download any updates from the third-party ad-serving domain lists that we source. By default, this command runs once a week via cron.

Query adlists

-

Runs the command

sudo pihole -q searchstring
and prints the result transparently to the web UI. This command can be used to scan for strings in the list of blocked domains, e.g., "analytics" will deliver all domains which contain *analytics*, where the asterisk (*) represents a number of characters or an empty string

+ This function is useful to find out what list a domain appears on. Since we don't control what the third-parties put on the block lists, you may find that a domain you normally visit stops working. If this is the case, you could run this command to scan for strings in the list of blocked domains and it will return the list the domain is found on. This proved useful a while back when the Mahakala list was adding apple.com and microsoft.com to their block list.

@@ -139,7 +139,8 @@

Emergency help

- In case the web UI does not work properly anymore (i.e. timeout errors or diagrams not showing up) you can try to flush the Pi-hole config file by clicking FLUSH. Note that your statistics will be reset and you lose the statistics up to this point. + Depending on your system and how heavily your Pi-hole is used, you may want to flush the log throughout the day by clicking on FLUSH. By default, the log if flushed at the end of the day via cron, but a very large log file can slow down the Web interface, so flushing it can be useful. + Note that your statistics will be reset and you lose the statistics up to this point.
From 6c9af746b941237b024e502506d3370adeb3bdbd Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 8 Dec 2016 12:55:37 +0100 Subject: [PATCH 03/16] Add that we update the main graph every 10 minutes --- help.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/help.php b/help.php index 1069b638..44cf1896 100644 --- a/help.php +++ b/help.php @@ -54,7 +54,7 @@

On the main page, you can see various Pi-hole statistics:

  • Summary: A summary of statistics showing how many total DNS queries have been blocked today, what percentage of DNS queries have been blocked, and how many domains are in the compiled ad list. This summary is updated every 10 seconds.
  • -
  • Queries over time: Graph showing DNS queries (total and blocked) over 10 minute time intervals. More information can be acquired by hovering over the lines.
  • +
  • Queries over time: Graph showing DNS queries (total and blocked) over 10 minute time intervals. More information can be acquired by hovering over the lines. This graph is updated every 10 minutes.
  • Query Types: Identifies the types of processed queries:
    • A: address lookup (most commonly used to map hostnames to an IPv4 address of the host)
    • From 9812e46e00ab36308acca168c83d0754d8475910 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 8 Dec 2016 22:44:13 +0100 Subject: [PATCH 04/16] Added a brace that disappeared earlier. --- js/pihole/footer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/pihole/footer.js b/js/pihole/footer.js index 7e2b0401..974dcc50 100644 --- a/js/pihole/footer.js +++ b/js/pihole/footer.js @@ -61,7 +61,8 @@ function versionCompare(left, right) { return -1; } } - + return 0; +} // Update check From b204eaca303dfc7ffbde8aacd807102722da644c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 8 Dec 2016 22:57:23 +0100 Subject: [PATCH 05/16] If we are on vDev then we assume that it is always newer than the latest online release, i.e. version comparion should return 1 --- js/pihole/footer.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/pihole/footer.js b/js/pihole/footer.js index 974dcc50..f8bd0de4 100644 --- a/js/pihole/footer.js +++ b/js/pihole/footer.js @@ -47,6 +47,14 @@ function versionCompare(left, right) { if (typeof left + typeof right != 'stringstring') return false; + // If we are on vDev then we assume that it is always + // newer than the latest online release, i.e. version + // comparion should return 1 + if(left == "vDev") + { + return 1; + } + var aa = left.split("v"), bb = right.split("v"); From eeb8811738c31ed60006df79fa19dc4c6db24137 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 8 Dec 2016 23:01:25 +0100 Subject: [PATCH 06/16] Remove some obsolete checks if on development version --- js/pihole/footer.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/js/pihole/footer.js b/js/pihole/footer.js index f8bd0de4..95f1148d 100644 --- a/js/pihole/footer.js +++ b/js/pihole/footer.js @@ -75,16 +75,14 @@ function versionCompare(left, right) { // Update check $.getJSON("https://api.github.com/repos/pi-hole/pi-hole/releases/latest", function(json) { - // Skip if on dev - if(piholeVersion !== "vDev" && versionCompare(piholeVersion, json.tag_name.slice(1)) < 0) { + if(versionCompare(piholeVersion, json.tag_name.slice(1)) < 0) { // Alert user $("#piholeVersion").html($("#piholeVersion").text() + '(Update available!)'); $("#alPiholeUpdate").show(); } }); $.getJSON("https://api.github.com/repos/pi-hole/AdminLTE/releases/latest", function(json) { - // Skip if on dev - if(webVersion !== "vDev" && versionCompare(webVersion, json.tag_name.slice(1)) < 0) { + if(versionCompare(webVersion, json.tag_name.slice(1)) < 0) { // Alert user $("#webVersion").html($("#webVersion").text() + '(Update available!)'); $("#alWebUpdate").show(); @@ -95,7 +93,7 @@ $.getJSON("https://api.github.com/repos/pi-hole/AdminLTE/releases/latest", funct * Make sure that Pi-hole is updated to at least v2.7, since that is needed to use the sudo * features of the interface. Skip if on dev */ -if(piholeVersion !== "vDev" && versionCompare(piholeVersion, "v2.7") < 0) +if(versionCompare(piholeVersion, "v2.7") < 0) alert("Pi-hole needs to be updated to at least v2.7 before you can use features such as whitelisting/blacklisting from this web interface!") // Session timer From e9a7c2f5f7e5ca7609f0ca9eb0727b6f199919e2 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Thu, 8 Dec 2016 17:20:39 -0500 Subject: [PATCH 07/16] Assume version is vDev if not on master branch This removes the need for a vDev tag, which was less reliable because it needed to be the most recent tag in the dev branch and was really just an sign that the repo was on a branch besides master. --- footer.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/footer.php b/footer.php index 2d3d6d61..309738ff 100644 --- a/footer.php +++ b/footer.php @@ -5,8 +5,20 @@