From 3ec55dbf0a318d39caa5405e92e741f0ab269d94 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Wed, 22 Nov 2017 13:25:23 -0500 Subject: [PATCH 01/12] 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 02/12] :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 6e6151c9cd3b2c4892f7a0a603e49b658809025e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 4 Dec 2017 21:50:14 +0100 Subject: [PATCH 03/12] Adding branch/version display for FTL Signed-off-by: DL6ER --- scripts/pi-hole/php/footer.php | 1 + scripts/pi-hole/php/update_checker.php | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/php/footer.php b/scripts/pi-hole/php/footer.php index d9ca6cec..4a353832 100644 --- a/scripts/pi-hole/php/footer.php +++ b/scripts/pi-hole/php/footer.php @@ -59,6 +59,7 @@ if($web_update){ ?> (Update available!) FTL Version (Update available!)
Donate if you found this useful.
diff --git a/scripts/pi-hole/php/update_checker.php b/scripts/pi-hole/php/update_checker.php index e7ab480d..9bd4ab06 100644 --- a/scripts/pi-hole/php/update_checker.php +++ b/scripts/pi-hole/php/update_checker.php @@ -42,8 +42,15 @@ else $web_current = explode("-",$versions[1])[0]; } - /********** Get Pi-hole FTL version (not a git repository) **********/ - $FTL_current = $versions[2]; + /********** Get Pi-hole FTL (not a git repository) **********/ + $FTL_branch = $branches[2]; + if($FTL_branch !== "master") { + $FTL_current = "vDev"; + $FTL_commit = $versions[2]; + } + else { + $FTL_current = explode("-",$versions[2])[0]; + } // Get data from GitHub $core_latest = $GitHubversions[0]; @@ -77,7 +84,15 @@ else // FTL version comparison // This logic allows the local core version to be newer than the upstream version // The update indicator is only shown if the upstream version is NEWER - $FTL_update = (version_compare($FTL_current, $FTL_latest) < 0); + if($FTL_current !== "vDev") + { + $FTL_update = (version_compare($FTL_current, $FTL_latest) < 0); + } + else + { + $FTL_update = false; + } + } ?> From f5f4e57454bf03c10e04c143cbe3f0bb506723da Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 4 Dec 2017 21:51:44 +0100 Subject: [PATCH 04/12] Also hide the long details if only the FTL branch is set Signed-off-by: DL6ER --- 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 4a353832..43cc2041 100644 --- a/scripts/pi-hole/php/footer.php +++ b/scripts/pi-hole/php/footer.php @@ -48,7 +48,7 @@