|
|
@ -48,33 +48,28 @@ var express = require('express'),
|
|
|
|
metaString = utils.buildMetaTags(defaultMetaTags.concat(options.metaTags || [])),
|
|
|
|
metaString = utils.buildMetaTags(defaultMetaTags.concat(options.metaTags || [])),
|
|
|
|
templateValues = {
|
|
|
|
templateValues = {
|
|
|
|
cssSrc: meta.config['theme:src'] || nconf.get('relative_path') + '/vendor/bootstrap/css/bootstrap.min.css',
|
|
|
|
cssSrc: meta.config['theme:src'] || nconf.get('relative_path') + '/vendor/bootstrap/css/bootstrap.min.css',
|
|
|
|
title: meta.config['title'] || 'NodeBB',
|
|
|
|
title: meta.config.title || 'NodeBB',
|
|
|
|
browserTitle: meta.config['title'] || 'NodeBB',
|
|
|
|
browserTitle: meta.config.title || 'NodeBB',
|
|
|
|
csrf: options.res.locals.csrf_token,
|
|
|
|
csrf: options.res.locals.csrf_token,
|
|
|
|
relative_path: nconf.get('relative_path'),
|
|
|
|
relative_path: nconf.get('relative_path'),
|
|
|
|
meta_tags: metaString
|
|
|
|
meta_tags: metaString
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// meta.build_title(options.title, (options.req.user ? options.req.user.uid : 0), function(err, title) {
|
|
|
|
callback(null, templates.header.parse(templateValues));
|
|
|
|
// if (!err) templateValues.browserTitle = title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// callback(null, templates['header'].parse(templateValues));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callback(null, templates['header'].parse(templateValues));
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Middlewares
|
|
|
|
// Middlewares
|
|
|
|
|
|
|
|
app.use(express.compress());
|
|
|
|
app.use(express.favicon(path.join(__dirname, '../', 'public', 'favicon.ico')));
|
|
|
|
app.use(express.favicon(path.join(__dirname, '../', 'public', 'favicon.ico')));
|
|
|
|
app.use(require('less-middleware')({
|
|
|
|
app.use(require('less-middleware')({
|
|
|
|
src: path.join(__dirname, '../', 'public'),
|
|
|
|
src: path.join(__dirname, '../', 'public'),
|
|
|
|
prefix: nconf.get('relative_path')
|
|
|
|
prefix: nconf.get('relative_path'),
|
|
|
|
|
|
|
|
yuicompress: true
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
app.use(nconf.get('relative_path'), express.static(path.join(__dirname, '../', 'public')));
|
|
|
|
app.use(nconf.get('relative_path'), express.static(path.join(__dirname, '../', 'public')));
|
|
|
|
app.use(express.bodyParser()); // Puts POST vars in request.body
|
|
|
|
app.use(express.bodyParser()); // Puts POST vars in request.body
|
|
|
|
|
|
|
|
|
|
|
|
app.use(express.cookieParser()); // If you want to parse cookies (res.cookies)
|
|
|
|
app.use(express.cookieParser()); // If you want to parse cookies (res.cookies)
|
|
|
|
app.use(express.compress());
|
|
|
|
|
|
|
|
app.use(express.session({
|
|
|
|
app.use(express.session({
|
|
|
|
store: new RedisStore({
|
|
|
|
store: new RedisStore({
|
|
|
|
client: RDB,
|
|
|
|
client: RDB,
|
|
|
@ -481,6 +476,8 @@ var express = require('express'),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
app.get('/search', function (req, res) {
|
|
|
|
app.get('/search', function (req, res) {
|
|
|
|
|
|
|
|
if (!req.user)
|
|
|
|
|
|
|
|
return res.redirect('/403');
|
|
|
|
app.build_header({
|
|
|
|
app.build_header({
|
|
|
|
req: req,
|
|
|
|
req: req,
|
|
|
|
res: res
|
|
|
|
res: res
|
|
|
@ -490,6 +487,8 @@ var express = require('express'),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
app.get('/search/:term', function (req, res) {
|
|
|
|
app.get('/search/:term', function (req, res) {
|
|
|
|
|
|
|
|
if (!req.user)
|
|
|
|
|
|
|
|
return res.redirect('/403');
|
|
|
|
app.build_header({
|
|
|
|
app.build_header({
|
|
|
|
req: req,
|
|
|
|
req: req,
|
|
|
|
res: res
|
|
|
|
res: res
|
|
|
|