mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
Rename themes_dir to themes_path for consistency with other configuration options
This commit is contained in:
10
app.js
10
app.js
@@ -87,20 +87,20 @@ function start() {
|
||||
});
|
||||
|
||||
nconf.defaults({
|
||||
themes_dir: path.join(__dirname, 'node_modules')
|
||||
themes_path: path.join(__dirname, 'node_modules')
|
||||
});
|
||||
|
||||
nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path'));
|
||||
nconf.set('upload_url', path.join(path.sep, nconf.get('relative_path'), 'uploads', path.sep));
|
||||
nconf.set('base_dir', __dirname);
|
||||
|
||||
// Ensure themes_dir is a full filepath
|
||||
nconf.set('themes_dir', path.resolve(__dirname, nconf.get('themes_dir')));
|
||||
// Ensure themes_path is a full filepath
|
||||
nconf.set('themes_path', path.resolve(__dirname, nconf.get('themes_path')));
|
||||
|
||||
winston.info('Time: ' + new Date());
|
||||
winston.info('Initializing NodeBB v' + pkg.version);
|
||||
winston.info('* using ' + nconf.get('database') +' store at ' + nconf.get(nconf.get('database') + ':host') + ':' + nconf.get(nconf.get('database') + ':port'));
|
||||
winston.info('* using themes stored in: ' + nconf.get('themes_dir'));
|
||||
winston.info('* using themes stored in: ' + nconf.get('themes_path'));
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
winston.info('Base Configuration OK.');
|
||||
@@ -130,7 +130,7 @@ function start() {
|
||||
|
||||
translator.loadServer();
|
||||
|
||||
var customTemplates = meta.config['theme:templates'] ? path.join(nconf.get('themes_dir'), meta.config['theme:id'], meta.config['theme:templates']) : false;
|
||||
var customTemplates = meta.config['theme:templates'] ? path.join(nconf.get('themes_path'), meta.config['theme:id'], meta.config['theme:templates']) : false;
|
||||
|
||||
utils.walk(path.join(__dirname, 'public/templates'), function (err, tplsToLoad) {
|
||||
templates.init(tplsToLoad, customTemplates);
|
||||
|
||||
@@ -85,7 +85,7 @@ var fs = require('fs'),
|
||||
|
||||
Meta.themes = {
|
||||
get: function (callback) {
|
||||
var themePath = nconf.get('themes_dir');
|
||||
var themePath = nconf.get('themes_path');
|
||||
fs.readdir(themePath, function (err, files) {
|
||||
async.filter(files, function (file, next) {
|
||||
fs.stat(path.join(themePath, file), function (err, fileStat) {
|
||||
@@ -132,7 +132,7 @@ var fs = require('fs'),
|
||||
case 'local':
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
fs.readFile(path.join(nconf.get('themes_dir'), data.id, 'theme.json'), function(err, config) {
|
||||
fs.readFile(path.join(nconf.get('themes_path'), data.id, 'theme.json'), function(err, config) {
|
||||
if (!err) {
|
||||
config = JSON.parse(config.toString());
|
||||
next(null, config);
|
||||
|
||||
@@ -255,7 +255,7 @@ module.exports.server = server;
|
||||
|
||||
// Theme's static directory
|
||||
if (themeData['theme:staticDir']) {
|
||||
app.use('/css/assets', express.static(path.join(nconf.get('themes_dir'), themeData['theme:id'], themeData['theme:staticDir']), {
|
||||
app.use('/css/assets', express.static(path.join(nconf.get('themes_path'), themeData['theme:id'], themeData['theme:staticDir']), {
|
||||
maxAge: app.enabled('cache') ? 5184000000 : 0
|
||||
}));
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
@@ -264,7 +264,7 @@ module.exports.server = server;
|
||||
}
|
||||
|
||||
if (themeData['theme:templates']) {
|
||||
app.use('/templates', express.static(path.join(nconf.get('themes_dir'), themeData['theme:id'], themeData['theme:templates']), {
|
||||
app.use('/templates', express.static(path.join(nconf.get('themes_path'), themeData['theme:id'], themeData['theme:templates']), {
|
||||
maxAge: app.enabled('cache') ? 5184000000 : 0
|
||||
}));
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
@@ -273,7 +273,7 @@ module.exports.server = server;
|
||||
}
|
||||
|
||||
app.use(require('less-middleware')({
|
||||
src: path.join(nconf.get('themes_dir'), themeId),
|
||||
src: path.join(nconf.get('themes_path'), themeId),
|
||||
dest: path.join(__dirname, '../public/css'),
|
||||
prefix: nconf.get('relative_path') + '/css',
|
||||
yuicompress: app.enabled('minification') ? true : false
|
||||
@@ -287,7 +287,7 @@ module.exports.server = server;
|
||||
}
|
||||
|
||||
app.use(require('less-middleware')({
|
||||
src: path.join(nconf.get('themes_dir'), '/nodebb-theme-vanilla'),
|
||||
src: path.join(nconf.get('themes_path'), '/nodebb-theme-vanilla'),
|
||||
dest: path.join(__dirname, '../public/css'),
|
||||
prefix: nconf.get('relative_path') + '/css',
|
||||
yuicompress: app.enabled('minification') ? true : false
|
||||
@@ -303,7 +303,7 @@ module.exports.server = server;
|
||||
|
||||
async.each(themes, function(themeObj, next) {
|
||||
if (themeObj.screenshot) {
|
||||
screenshotPath = path.join(nconf.get('themes_dir'), themeObj.id, themeObj.screenshot);
|
||||
screenshotPath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.screenshot);
|
||||
(function(id, path) {
|
||||
fs.exists(path, function(exists) {
|
||||
if (exists) {
|
||||
|
||||
Reference in New Issue
Block a user