This commit is contained in:
barisusakli
2014-10-26 17:04:55 -04:00
parent 63cf8d674d
commit 35e2e1462b
2 changed files with 15 additions and 0 deletions

View File

@@ -149,6 +149,16 @@ module.exports = function(app, middleware) {
require('./debug')(app, middleware, controllers);
}
app.use(function(req, res, next) {
if (req.user || parseInt(meta.config.privateUploads, 10) !== 1) {
return next();
}
if (req.path.indexOf('/uploads/files') === 0) {
return res.status(403).json('not-allowed');
}
next();
});
app.use(relativePath, express.static(path.join(__dirname, '../../', 'public'), {
maxAge: app.enabled('cache') ? 5184000000 : 0
}));