From 30b7b0d63a59ef6f39a3d69291660d6b4b3f2c42 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 26 Mar 2017 13:42:29 +0200 Subject: [PATCH 1/2] Show FTL version and update notification (if available) in footer --- scripts/pi-hole/js/footer.js | 12 ++++++++++-- scripts/pi-hole/js/index.js | 9 ++++++++- scripts/pi-hole/php/footer.php | 15 +++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index 20866b85..e6c3c157 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -144,6 +144,7 @@ $("#pihole-disable-custom").on("click", function(e){ var piholeVersion = $("#piholeVersion").html(); var webVersion = $("#webVersion").html(); +var FTLVersion = $("#FTLVersion").html(); // Credit for following function: https://gist.github.com/alexey-bass/1115557 // Modified to discard any possible "v" in the string @@ -183,17 +184,24 @@ function versionCompare(left, right) { $.getJSON("https://api.github.com/repos/pi-hole/pi-hole/releases/latest", function(json) { if(versionCompare(piholeVersion, json.tag_name.slice(1)) < 0) { // Alert user - $("#piholeVersion").html($("#piholeVersion").text() + "(Update available!)"); + $("#piholeVersion").html($("#piholeVersion").text() + " (Update available!)"); $("#alPiholeUpdate").show(); } }); $.getJSON("https://api.github.com/repos/pi-hole/AdminLTE/releases/latest", function(json) { if(versionCompare(webVersion, json.tag_name.slice(1)) < 0) { // Alert user - $("#webVersion").html($("#webVersion").text() + "(Update available!)"); + $("#webVersion").html($("#webVersion").text() + " (Update available!)"); $("#alWebUpdate").show(); } }); +$.getJSON("https://api.github.com/repos/pi-hole/FTL/releases/latest", function(json) { + if(versionCompare(FTLVersion, json.tag_name.slice(1)) < 0) { + // Alert user + $("#FTLVersion").html($("#FTLVersion").text() + " (Update available!)"); + $("#alFTLUpdate").show(); + } +}); /* * Make sure that Pi-hole is updated to at least v2.7, since that is needed to use the sudo diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 1bf21a15..26370d5c 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -390,7 +390,14 @@ function updateSummaryData(runOnce) { }, 500); }).done(function() { - setTimer(1); + if(FTLoffline) + { + setTimer(1); + } + else + { + setTimer(10); + } }).fail(function() { setTimer(300); }); diff --git a/scripts/pi-hole/php/footer.php b/scripts/pi-hole/php/footer.php index 34d7319f..50ebc210 100644 --- a/scripts/pi-hole/php/footer.php +++ b/scripts/pi-hole/php/footer.php @@ -62,10 +62,25 @@ else { $webVersion = exec("git describe --tags --abbrev=0"); } + + $FTLVersion = exec("pihole-FTL version"); ?> +
Donate if you found this useful.
From 77468ac541c891c5a52918ca856893c2370d4057 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 26 Mar 2017 22:19:41 +0200 Subject: [PATCH 2/2] Fix logic --- 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 26370d5c..34701b7d 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -390,7 +390,7 @@ function updateSummaryData(runOnce) { }, 500); }).done(function() { - if(FTLoffline) + if(!FTLoffline) { setTimer(1); }