Skip to content

Commit d46e279

Browse files
committed
Added link to 'Last build' notice showing commits since last release
1 parent 77e074e commit d46e279

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/web/App.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,24 @@ App.prototype.resetLayout = function() {
524524
App.prototype.setCompileMessage = function() {
525525
// Display time since last build and compile message
526526
let now = new Date(),
527-
timeSinceCompile = Utils.fuzzyTime(now.getTime() - window.compileTime),
528-
compileInfo = "<span style=\"font-weight: normal\">Last build: " +
529-
timeSinceCompile.substr(0, 1).toUpperCase() + timeSinceCompile.substr(1) + " ago";
527+
timeSinceCompile = Utils.fuzzyTime(now.getTime() - window.compileTime);
528+
529+
// Calculate previous version to compare to
530+
let prev = PKG_VERSION.split(".").map(n => {
531+
return parseInt(n, 10);
532+
});
533+
if (prev[2] > 0) prev[2]--;
534+
else if (prev[1] > 0) prev[1]--;
535+
else prev[0]--;
536+
537+
const compareURL = `https://github.com/gchq/CyberChef/compare/v${prev.join(".")}...v${PKG_VERSION}`;
538+
539+
let compileInfo = `<a href='${compareURL}'>Last build: ${timeSinceCompile.substr(0, 1).toUpperCase() + timeSinceCompile.substr(1)} ago</a>`;
530540

531541
if (window.compileMessage !== "") {
532542
compileInfo += " - " + window.compileMessage;
533543
}
534544

535-
compileInfo += "</span>";
536545
document.getElementById("notice").innerHTML = compileInfo;
537546
};
538547

0 commit comments

Comments
 (0)