mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 08:20:36 +01:00
fixing screenshot previews in admin/themes
This commit is contained in:
@@ -137,10 +137,10 @@ var express = require('express'),
|
||||
app.use(function (req, res, next) {
|
||||
nconf.set('https', req.secure);
|
||||
res.locals.csrf_token = req.session._csrf;
|
||||
|
||||
|
||||
// Disable framing
|
||||
res.setHeader("X-Frame-Options", "DENY");
|
||||
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
@@ -215,6 +215,26 @@ var express = require('express'),
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
// Route paths to screenshots for installed themes
|
||||
meta.themes.get(function(err, themes) {
|
||||
var screenshotPath;
|
||||
|
||||
async.each(themes, function(themeObj, next) {
|
||||
if (themeObj.screenshot) {
|
||||
screenshotPath = path.join(__dirname, '../node_modules', themeObj.id, themeObj.screenshot);
|
||||
fs.exists(screenshotPath, function(exists) {
|
||||
if (exists) {
|
||||
app.get('/css/previews/' + themeObj.id, function(req, res) {
|
||||
res.sendfile(screenshotPath);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
next(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
], next);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user