Merge branch 'development' of github.com:Mailtrain-org/mailtrain into development

This commit is contained in:
Tomas Bures 2018-12-15 15:16:23 +01:00
commit 97bbac8698
2 changed files with 40 additions and 20 deletions

View file

@ -62,6 +62,13 @@ const interoperableErrors = require('../shared/interoperable-errors');
const { getTrustedUrl } = require('./lib/urls');
const { AppType } = require('../shared/app');
let isReady = false;
function setReady() {
isReady = true;
}
hbs.registerPartials(__dirname + '/views/partials');
hbs.registerPartials(__dirname + '/views/subscription/partials/');
@ -201,6 +208,19 @@ function createApp(appType) {
limit: config.www.postSize
}));
app.use((req, res, next) => {
if (isReady) {
next();
} else {
res.status(500);
res.render('error', {
message: 'Mailtrain is starting. Try again after a few seconds.',
error: {}
});
}
});
if (appType === AppType.TRUSTED) {
passport.setupRegularAuth(app);
} else if (appType === AppType.SANDBOXED) {
@ -385,3 +405,4 @@ function createApp(appType) {
}
module.exports.createApp = createApp;
module.exports.setReady = setReady;