diff --git a/public/src/forum/admin/index.js b/public/src/forum/admin/index.js index c99dd43cb9..914676115d 100644 --- a/public/src/forum/admin/index.js +++ b/public/src/forum/admin/index.js @@ -14,7 +14,23 @@ define(function() { }, function() { window.location.href = RELATIVE_PATH + '/'; }); - }) + }); + + $.get('https://api.github.com/repos/designcreateplay/NodeBB/tags', function(releases) { + var version = $('#version').html(), + latestVersion = releases[0].name.slice(1), + checkEl = $('.version-check'); + checkEl.html($('.version-check').html().replace('', 'v' + latestVersion)); + + // Alter box colour accordingly + if (latestVersion === version) { + checkEl.removeClass('alert-info').addClass('alert-success'); + checkEl.append('
You are up-to-date
'); + } else if (latestVersion > version) { + checkEl.removeClass('alert-info').addClass('alert-danger'); + checkEl.append('A new version (v' + latestVersion + ') has been released. Consider upgrading your NodeBB.
'); + } + }); }; Admin.updateRoomUsage = function(err, data) { diff --git a/public/templates/admin/index.tpl b/public/templates/admin/index.tpl index aa4838ef35..0ff8383dc3 100644 --- a/public/templates/admin/index.tpl +++ b/public/templates/admin/index.tpl @@ -1,20 +1,36 @@ - -- NodeBB Community Forum - Get Plugins and Themes - Follow @NodeBB - NodeBB Wiki -
-You are running NodeBB v{version}. Always make sure that your NodeBB is up to date for the latest security patches and bug fixes.
-- -
-You are running NodeBB v{version}.
++ Always make sure that your NodeBB is up to date for the latest security patches and bug fixes. +
+