mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-28 18:29:50 +01:00
ACP quick actions (#6374)
* ACP quick actions - Moved restart, build & restart, and logout into separate buttons - Moved buttons on mobile into the side menu - Added version and upgrade alert to header / mobile menu - Moved version checking to server-side with a cache for rate limiting - Changed "reload" translations to "rebuild and restart" * Change info alert to black-on-white to match focused search bar * Fix tests * Fallback for failed fetch of latest version
This commit is contained in:
committed by
Julian Lam
parent
81e085bb9d
commit
eaae5b52cd
@@ -2,10 +2,14 @@
|
||||
|
||||
var async = require('async');
|
||||
var winston = require('winston');
|
||||
var jsesc = require('jsesc');
|
||||
var nconf = require('nconf');
|
||||
var semver = require('semver');
|
||||
|
||||
var user = require('../user');
|
||||
var meta = require('../meta');
|
||||
var plugins = require('../plugins');
|
||||
var jsesc = require('jsesc');
|
||||
var versions = require('../admin/versions');
|
||||
|
||||
var controllers = {
|
||||
api: require('../controllers/api'),
|
||||
@@ -54,6 +58,15 @@ module.exports = function (middleware) {
|
||||
configs: function (next) {
|
||||
meta.configs.list(next);
|
||||
},
|
||||
latestVersion: function (next) {
|
||||
versions.getLatestVersion(function (err, result) {
|
||||
if (err) {
|
||||
winston.error('[acp] Failed to fetch latest version', err);
|
||||
}
|
||||
|
||||
next(null, err ? null : result);
|
||||
});
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
@@ -67,6 +80,8 @@ module.exports = function (middleware) {
|
||||
});
|
||||
acpPath = acpPath.join(' > ');
|
||||
|
||||
var version = nconf.get('version');
|
||||
|
||||
var templateValues = {
|
||||
config: res.locals.config,
|
||||
configJSON: jsesc(JSON.stringify(res.locals.config), { isScriptContext: true }),
|
||||
@@ -81,6 +96,9 @@ module.exports = function (middleware) {
|
||||
env: !!process.env.NODE_ENV,
|
||||
title: (acpPath || 'Dashboard') + ' | NodeBB Admin Control Panel',
|
||||
bodyClass: data.bodyClass,
|
||||
version: version,
|
||||
latestVersion: results.latestVersion,
|
||||
upgradeAvailable: results.latestVersion && semver.gt(results.latestVersion, version),
|
||||
};
|
||||
|
||||
templateValues.template = { name: res.locals.template };
|
||||
|
||||
Reference in New Issue
Block a user