mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 00:11:49 +03:00
1181707a9d
closes #5914, #6589 - moves all private-blogging related code & tests into /server/apps/private-blogging/ - rework Grunt to run private-blogging tests - modify server apps code to have a place for internal apps
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
var config = require('../../config'),
|
|
errors = require('../../errors'),
|
|
i18n = require('../../i18n'),
|
|
middleware = require('./lib/middleware'),
|
|
router = require('./lib/router');
|
|
|
|
module.exports = {
|
|
activate: function activate() {
|
|
if (config.paths.subdir) {
|
|
var paths = config.paths.subdir.split('/');
|
|
|
|
if (paths.pop() === config.routeKeywords.private) {
|
|
errors.logErrorAndExit(
|
|
new Error(i18n.t('errors.config.urlCannotContainPrivateSubdir.error')),
|
|
i18n.t('errors.config.urlCannotContainPrivateSubdir.description'),
|
|
i18n.t('errors.config.urlCannotContainPrivateSubdir.help')
|
|
);
|
|
}
|
|
}
|
|
},
|
|
|
|
setupMiddleware: function setupMiddleware(blogApp) {
|
|
blogApp.use(middleware.checkIsPrivate);
|
|
blogApp.use(middleware.filterPrivateRoutes);
|
|
},
|
|
|
|
setupRoutes: function setupRoutes(blogRouter) {
|
|
blogRouter.use('/' + config.routeKeywords.private + '/', router);
|
|
}
|
|
};
|