|
|
@ -1,11 +1,11 @@
|
|
|
|
"use strict";
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
var utils = require('./../../public/src/utils'),
|
|
|
|
var utils = require('../../public/src/utils'),
|
|
|
|
meta = require('./../meta'),
|
|
|
|
meta = require('../meta'),
|
|
|
|
plugins = require('./../plugins'),
|
|
|
|
plugins = require('../plugins'),
|
|
|
|
db = require('./../database'),
|
|
|
|
db = require('../database'),
|
|
|
|
auth = require('./../routes/authentication'),
|
|
|
|
auth = require('../routes/authentication'),
|
|
|
|
emitter = require('./../emitter'),
|
|
|
|
emitter = require('../emitter'),
|
|
|
|
|
|
|
|
|
|
|
|
async = require('async'),
|
|
|
|
async = require('async'),
|
|
|
|
path = require('path'),
|
|
|
|
path = require('path'),
|
|
|
@ -19,7 +19,6 @@ var utils = require('./../../public/src/utils'),
|
|
|
|
cookieParser = require('cookie-parser'),
|
|
|
|
cookieParser = require('cookie-parser'),
|
|
|
|
compression = require('compression'),
|
|
|
|
compression = require('compression'),
|
|
|
|
favicon = require('serve-favicon'),
|
|
|
|
favicon = require('serve-favicon'),
|
|
|
|
multipart = require('connect-multiparty'),
|
|
|
|
|
|
|
|
session = require('express-session'),
|
|
|
|
session = require('express-session'),
|
|
|
|
cluster = require('cluster'),
|
|
|
|
cluster = require('cluster'),
|
|
|
|
|
|
|
|
|
|
|
@ -31,7 +30,7 @@ var middleware = {};
|
|
|
|
|
|
|
|
|
|
|
|
function routeCurrentTheme(app, themeId, themesData) {
|
|
|
|
function routeCurrentTheme(app, themeId, themesData) {
|
|
|
|
themeId = (themeId || 'nodebb-theme-vanilla');
|
|
|
|
themeId = (themeId || 'nodebb-theme-vanilla');
|
|
|
|
|
|
|
|
|
|
|
|
var themeObj = (function(id) {
|
|
|
|
var themeObj = (function(id) {
|
|
|
|
return themesData.filter(function(themeObj) {
|
|
|
|
return themesData.filter(function(themeObj) {
|
|
|
|
return themeObj.id === id;
|
|
|
|
return themeObj.id === id;
|
|
|
@ -49,7 +48,7 @@ function routeCurrentTheme(app, themeId, themesData) {
|
|
|
|
function setupFavicon(app) {
|
|
|
|
function setupFavicon(app) {
|
|
|
|
var faviconPath = path.join(__dirname, '../../', 'public', meta.config['brand:favicon'] ? meta.config['brand:favicon'] : 'favicon.ico');
|
|
|
|
var faviconPath = path.join(__dirname, '../../', 'public', meta.config['brand:favicon'] ? meta.config['brand:favicon'] : 'favicon.ico');
|
|
|
|
if (fs.existsSync(faviconPath)) {
|
|
|
|
if (fs.existsSync(faviconPath)) {
|
|
|
|
app.use(favicon(faviconPath));
|
|
|
|
app.use(favicon(faviconPath));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -70,7 +69,7 @@ module.exports = function(app, data) {
|
|
|
|
app.use(compression());
|
|
|
|
app.use(compression());
|
|
|
|
|
|
|
|
|
|
|
|
setupFavicon(app);
|
|
|
|
setupFavicon(app);
|
|
|
|
|
|
|
|
|
|
|
|
app.use(relativePath + '/apple-touch-icon', middleware.routeTouchIcon);
|
|
|
|
app.use(relativePath + '/apple-touch-icon', middleware.routeTouchIcon);
|
|
|
|
|
|
|
|
|
|
|
|
app.use(bodyParser.urlencoded({extended: true}));
|
|
|
|
app.use(bodyParser.urlencoded({extended: true}));
|
|
|
@ -93,8 +92,6 @@ module.exports = function(app, data) {
|
|
|
|
saveUninitialized: true
|
|
|
|
saveUninitialized: true
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
app.use(multipart());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.use(function (req, res, next) {
|
|
|
|
app.use(function (req, res, next) {
|
|
|
|
res.setHeader('X-Powered-By', 'NodeBB');
|
|
|
|
res.setHeader('X-Powered-By', 'NodeBB');
|
|
|
|
|
|
|
|
|
|
|
|