mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-12 04:00:20 +02:00
Merge remote-tracking branch 'origin/master' into user-icons
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var file = require('../../file');
|
||||
|
||||
var themesController = {};
|
||||
|
||||
themesController.get = function(req, res, next) {
|
||||
var themeDir = path.join(__dirname, '../../../node_modules/' + req.params.theme);
|
||||
fs.exists(themeDir, function(exists) {
|
||||
if (exists) {
|
||||
var themeConfig = require(path.join(themeDir, 'theme.json')),
|
||||
screenshotPath = path.join(themeDir, themeConfig.screenshot);
|
||||
if (themeConfig.screenshot && fs.existsSync(screenshotPath)) {
|
||||
res.sendFile(screenshotPath);
|
||||
} else {
|
||||
res.sendFile(path.join(__dirname, '../../../public/images/themes/default.png'));
|
||||
}
|
||||
} else {
|
||||
file.exists(themeDir, function(exists) {
|
||||
if (!exists) {
|
||||
return next();
|
||||
}
|
||||
|
||||
var themeConfig = require(path.join(themeDir, 'theme.json')),
|
||||
screenshotPath = path.join(themeDir, themeConfig.screenshot);
|
||||
if (themeConfig.screenshot && file.existsSync(screenshotPath)) {
|
||||
res.sendFile(screenshotPath);
|
||||
} else {
|
||||
res.sendFile(path.join(__dirname, '../../../public/images/themes/default.png'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -253,9 +253,10 @@ categoriesController.get = function(req, res, callback) {
|
||||
data.pageCount = pageCount;
|
||||
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
|
||||
data.rssFeedUrl = nconf.get('relative_path') + '/category/' + data.cid + '.rss';
|
||||
data.pagination = pagination.create(data.currentPage, data.pageCount);
|
||||
data.title = data.name;
|
||||
data.pagination = pagination.create(data.currentPage, data.pageCount);
|
||||
data.pagination.rel.forEach(function(rel) {
|
||||
rel.href = nconf.get('url') + '/category/' + data.slug + rel.href;
|
||||
res.locals.linkTags.push(rel);
|
||||
});
|
||||
|
||||
|
||||
@@ -263,6 +263,7 @@ topicsController.get = function(req, res, callback) {
|
||||
data.rssFeedUrl = nconf.get('relative_path') + '/topic/' + data.tid + '.rss';
|
||||
data.pagination = pagination.create(data.currentPage, data.pageCount);
|
||||
data.pagination.rel.forEach(function(rel) {
|
||||
rel.href = nconf.get('url') + '/topic/' + data.slug + rel.href;
|
||||
res.locals.linkTags.push(rel);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user