mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
fixed screenshots for themes
This commit is contained in:
12
src/meta.js
12
src/meta.js
@@ -81,12 +81,22 @@ var utils = require('./../public/src/utils.js'),
|
|||||||
if (fs.existsSync(config)) {
|
if (fs.existsSync(config)) {
|
||||||
fs.readFile(config, function (err, file) {
|
fs.readFile(config, function (err, file) {
|
||||||
var configObj = JSON.parse(file.toString());
|
var configObj = JSON.parse(file.toString());
|
||||||
if (!configObj.screenshot) {
|
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';
|
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 {
|
} else {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user