mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +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({
|
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('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('upload_url', path.join(path.sep, nconf.get('relative_path'), 'uploads', path.sep));
|
||||||
nconf.set('base_dir', __dirname);
|
nconf.set('base_dir', __dirname);
|
||||||
|
|
||||||
// Ensure themes_dir is a full filepath
|
// Ensure themes_path is a full filepath
|
||||||
nconf.set('themes_dir', path.resolve(__dirname, nconf.get('themes_dir')));
|
nconf.set('themes_path', path.resolve(__dirname, nconf.get('themes_path')));
|
||||||
|
|
||||||
winston.info('Time: ' + new Date());
|
winston.info('Time: ' + new Date());
|
||||||
winston.info('Initializing NodeBB v' + pkg.version);
|
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 ' + 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') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
winston.info('Base Configuration OK.');
|
winston.info('Base Configuration OK.');
|
||||||
@@ -130,7 +130,7 @@ function start() {
|
|||||||
|
|
||||||
translator.loadServer();
|
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) {
|
utils.walk(path.join(__dirname, 'public/templates'), function (err, tplsToLoad) {
|
||||||
templates.init(tplsToLoad, customTemplates);
|
templates.init(tplsToLoad, customTemplates);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ var fs = require('fs'),
|
|||||||
|
|
||||||
Meta.themes = {
|
Meta.themes = {
|
||||||
get: function (callback) {
|
get: function (callback) {
|
||||||
var themePath = nconf.get('themes_dir');
|
var themePath = nconf.get('themes_path');
|
||||||
fs.readdir(themePath, function (err, files) {
|
fs.readdir(themePath, function (err, files) {
|
||||||
async.filter(files, function (file, next) {
|
async.filter(files, function (file, next) {
|
||||||
fs.stat(path.join(themePath, file), function (err, fileStat) {
|
fs.stat(path.join(themePath, file), function (err, fileStat) {
|
||||||
@@ -132,7 +132,7 @@ var fs = require('fs'),
|
|||||||
case 'local':
|
case 'local':
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
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) {
|
if (!err) {
|
||||||
config = JSON.parse(config.toString());
|
config = JSON.parse(config.toString());
|
||||||
next(null, config);
|
next(null, config);
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ module.exports.server = server;
|
|||||||
|
|
||||||
// Theme's static directory
|
// Theme's static directory
|
||||||
if (themeData['theme:staticDir']) {
|
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
|
maxAge: app.enabled('cache') ? 5184000000 : 0
|
||||||
}));
|
}));
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
@@ -264,7 +264,7 @@ module.exports.server = server;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (themeData['theme:templates']) {
|
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
|
maxAge: app.enabled('cache') ? 5184000000 : 0
|
||||||
}));
|
}));
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
@@ -273,7 +273,7 @@ module.exports.server = server;
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.use(require('less-middleware')({
|
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'),
|
dest: path.join(__dirname, '../public/css'),
|
||||||
prefix: nconf.get('relative_path') + '/css',
|
prefix: nconf.get('relative_path') + '/css',
|
||||||
yuicompress: app.enabled('minification') ? true : false
|
yuicompress: app.enabled('minification') ? true : false
|
||||||
@@ -287,7 +287,7 @@ module.exports.server = server;
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.use(require('less-middleware')({
|
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'),
|
dest: path.join(__dirname, '../public/css'),
|
||||||
prefix: nconf.get('relative_path') + '/css',
|
prefix: nconf.get('relative_path') + '/css',
|
||||||
yuicompress: app.enabled('minification') ? true : false
|
yuicompress: app.enabled('minification') ? true : false
|
||||||
@@ -303,7 +303,7 @@ module.exports.server = server;
|
|||||||
|
|
||||||
async.each(themes, function(themeObj, next) {
|
async.each(themes, function(themeObj, next) {
|
||||||
if (themeObj.screenshot) {
|
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) {
|
(function(id, path) {
|
||||||
fs.exists(path, function(exists) {
|
fs.exists(path, function(exists) {
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|||||||
Reference in New Issue
Block a user