Fix update logic for custom branches by comparing hashes (#2737)

This commit is contained in:
yubiuser
2023-10-12 20:22:26 +02:00
committed by GitHub

View File

@@ -475,6 +475,7 @@ function updateVersionInfo() {
remote: version.core.remote.version,
branch: version.core.local.branch,
hash: version.core.local.hash,
hash_remote: version.core.remote.hash,
url: "https://github.com/pi-hole/pi-hole/releases",
},
{
@@ -483,6 +484,7 @@ function updateVersionInfo() {
remote: version.ftl.remote.version,
branch: version.ftl.local.branch,
hash: version.ftl.local.hash,
hash_remote: version.ftl.remote.hash,
url: "https://github.com/pi-hole/FTL/releases",
},
{
@@ -491,6 +493,7 @@ function updateVersionInfo() {
remote: version.web.remote.version,
branch: version.web.local.branch,
hash: version.web.local.hash,
hash_remote: version.web.remote.hash,
url: "https://github.com/pi-hole/web/releases",
},
];
@@ -509,11 +512,25 @@ function updateVersionInfo() {
'" rel="noopener" target="_blank">' +
localVersion +
"</a>";
} else localVersion = "vDev (" + v.branch + ", " + v.hash + ")";
if (versionCompare(v.local, v.remote) === -1) {
// Update available
updateAvailable = true;
}
} else {
// non-master branch
localVersion = "vDev (" + v.branch + ", " + v.hash + ")";
if (v.hash !== v.hash_remote) {
// hash differ > Update available
updateAvailable = true;
}
}
if (versionCompare(v.local, v.remote) === -1) {
if (v.name === "Docker Tag") dockerUpdate = true;
else updateAvailable = true;
if (v.name === "Docker Tag" && versionCompare(v.local, v.remote) === -1) {
updateAvailable = true;
dockerUpdate = true;
}
if (updateAvailable) {
$("#versions").append(
"<li><strong>" +
v.name +