From d54447398894f180a66a3d5216cb6c660b4982c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sat, 14 Oct 2023 15:12:55 +0200 Subject: [PATCH] Fix and tweak footer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- scripts/pi-hole/js/footer.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index 289f104c9..26e3b19a2 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -501,8 +501,10 @@ function updateVersionInfo() { versions.forEach(function (v) { if (v.local !== null) { + // reset update status for each component + var updateComponentAvailable = false; var localVersion = v.local; - if (v.branch !== null && v.hash !== null) + if (v.branch !== null && v.hash !== null) { if (v.branch === "master") { localVersion = v.local.split("-")[0]; localVersion = @@ -515,23 +517,26 @@ function updateVersionInfo() { ""; if (versionCompare(v.local, v.remote) === -1) { // Update available - updateAvailable = true; + updateComponentAvailable = true; } } else { // non-master branch localVersion = "vDev (" + v.branch + ", " + v.hash + ")"; if (v.hash !== v.hash_remote) { // hash differ > Update available - updateAvailable = true; + updateComponentAvailable = true; + // link to the commit history instead of release page + v.url = v.url.replace("releases", "commits" + v.branch); } } + } if (v.name === "Docker Tag" && versionCompare(v.local, v.remote) === -1) { - updateAvailable = true; + updateComponentAvailable = true; dockerUpdate = true; } - if (updateAvailable) { + if (updateComponentAvailable) { $("#versions").append( "
  • " + v.name + @@ -541,6 +546,8 @@ function updateVersionInfo() { v.url + '" rel="noopener" target="_blank">Update available!
  • ' ); + // if at least one component can be updated, display the update-hint footer + updateAvailable = true; } else { $("#versions").append("
  • " + v.name + " " + localVersion + "
  • "); } @@ -548,11 +555,11 @@ function updateVersionInfo() { }); if (dockerUpdate) - $("update-hint").html( + $("#update-hint").html( 'To install updates, replace this old container with a fresh upgraded image.' ); else if (updateAvailable) - $("update-hint").html( + $("#update-hint").html( 'To install updates, run pihole -up.' );