mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-04 21:15:55 +01:00
fixed screenshots for themes
This commit is contained in:
18
src/meta.js
18
src/meta.js
@@ -81,11 +81,21 @@ var utils = require('./../public/src/utils.js'),
|
||||
if (fs.existsSync(config)) {
|
||||
fs.readFile(config, function (err, file) {
|
||||
var configObj = JSON.parse(file.toString());
|
||||
if (!configObj.screenshot) {
|
||||
configObj.screenshot = nconf.get('relative_path') + '/images/themes/default.png';
|
||||
}
|
||||
if (configObj.staticDir && configObj.screenshot) {
|
||||
// Verify that the provided path leads to a file that exists
|
||||
fs.exists(path.join(__dirname, '../node_modules/', configObj.id, configObj.staticDir, configObj.screenshot), function(exists) {
|
||||
if (exists) {
|
||||
configObj.screenshot = path.join('/css/assets/', configObj.screenshot);
|
||||
} else {
|
||||
configObj.screenshot = nconf.get('relative_path') + '/images/themes/default.png';
|
||||
}
|
||||
|
||||
next(err, configObj);
|
||||
next(err, configObj);
|
||||
});
|
||||
} else {
|
||||
configObj.screenshot = nconf.get('relative_path') + '/images/themes/default.png';
|
||||
next(err, configObj);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user