2016-10-04 20:09:18 +03:00
|
|
|
var router = require('./lib/router'),
|
|
|
|
registerHelpers = require('./lib/helpers'),
|
2016-04-14 20:33:22 +03:00
|
|
|
|
2016-04-21 18:37:52 +03:00
|
|
|
// Dirty requires
|
2016-10-04 20:09:18 +03:00
|
|
|
config = require('../../config'),
|
2017-12-14 05:01:23 +03:00
|
|
|
labs = require('../../services/labs');
|
2016-04-14 20:33:22 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
activate: function activate(ghost) {
|
2017-11-05 15:45:43 +03:00
|
|
|
var subscribeRoute = '/' + config.get('routeKeywords').subscribe + '/';
|
2017-10-31 12:46:59 +03:00
|
|
|
// TODO, how to do all this only if the Subscribers flag is set?!
|
2016-10-04 20:09:18 +03:00
|
|
|
registerHelpers(ghost);
|
2016-04-14 20:33:22 +03:00
|
|
|
|
2017-11-05 15:45:43 +03:00
|
|
|
ghost.routeService.registerRouter(subscribeRoute, function labsEnabledRouter(req, res, next) {
|
2016-04-21 18:37:52 +03:00
|
|
|
if (labs.isSet('subscribers') === true) {
|
|
|
|
return router.apply(this, arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
next();
|
|
|
|
});
|
2016-04-14 20:33:22 +03:00
|
|
|
}
|
|
|
|
};
|