mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
df5a598718
closes #4485 - removes data attributes used on body in default.hbs - introduces new way to generate configuration through meta tags - config initializer consumes configurations from the meta tags using parser - moves blog_title helper/value to be a property in a configuration api
56 lines
1.9 KiB
JavaScript
56 lines
1.9 KiB
JavaScript
var _ = require('lodash'),
|
|
api = require('../api'),
|
|
errors = require('../errors'),
|
|
updateCheck = require('../update-check'),
|
|
config = require('../config'),
|
|
adminControllers;
|
|
|
|
adminControllers = {
|
|
// Route: index
|
|
// Path: /ghost/
|
|
// Method: GET
|
|
index: function (req, res) {
|
|
/*jslint unparam:true*/
|
|
|
|
function renderIndex() {
|
|
return api.configuration.browse().then(function (data) {
|
|
var apiConfig = _.omit(data.configuration, function (value) {
|
|
return _.contains(['environment', 'database', 'mail', 'version'], value.key);
|
|
});
|
|
|
|
res.render('default', {
|
|
skip_google_fonts: config.isPrivacyDisabled('useGoogleFonts'),
|
|
configuration: apiConfig
|
|
});
|
|
});
|
|
}
|
|
|
|
updateCheck().then(function () {
|
|
return updateCheck.showUpdateNotification();
|
|
}).then(function (updateVersion) {
|
|
if (!updateVersion) {
|
|
return;
|
|
}
|
|
|
|
var notification = {
|
|
type: 'success',
|
|
location: 'top',
|
|
dismissible: false,
|
|
status: 'persistent',
|
|
message: '<a href="https://ghost.org/download">Ghost ' + updateVersion +
|
|
'</a> is available! Hot Damn. Please <a href="http://support.ghost.org/how-to-upgrade/" target="_blank">upgrade</a> now'
|
|
};
|
|
|
|
return api.notifications.browse({context: {internal: true}}).then(function (results) {
|
|
if (!_.some(results.notifications, {message: notification.message})) {
|
|
return api.notifications.add({notifications: [notification]}, {context: {internal: true}});
|
|
}
|
|
});
|
|
}).finally(function () {
|
|
renderIndex();
|
|
}).catch(errors.logError);
|
|
}
|
|
};
|
|
|
|
module.exports = adminControllers;
|