0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/server/controllers/admin.js
Maurice Williams 3583515e44 adding config flags to control all items mentioned in PRIVACY.md
closes #3241
- in config.js, the `privacy` attribute holds all privacy-related flags
- `privacy.userTinfoil: true` disables everything (equivalent to setting all flags to false)
- added helper function to core/server/config/index.js to checking privacy flags
- added helper function to core/server/config/index.js to show warning about deprecated items
2014-09-13 12:04:01 -04:00

48 lines
1.6 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() {
res.render('default', {
skip_google_fonts: config.isPrivacyDisabled('useGoogleFonts')
});
}
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;