mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
31 lines
1 KiB
JavaScript
31 lines
1 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);
|
||
|
}
|
||
|
};
|