mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-31 19:15:58 +01:00
closes #843
This commit is contained in:
2
app.js
2
app.js
@@ -70,7 +70,7 @@
|
|||||||
});
|
});
|
||||||
meta = require('./src/meta');
|
meta = require('./src/meta');
|
||||||
|
|
||||||
nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path') + path.sep);
|
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);
|
||||||
|
|
||||||
|
|||||||
14
src/feed.js
14
src/feed.js
@@ -14,7 +14,7 @@
|
|||||||
Feed.defaults = {
|
Feed.defaults = {
|
||||||
ttl: 60,
|
ttl: 60,
|
||||||
basePath: path.join(__dirname, '../', 'feeds'),
|
basePath: path.join(__dirname, '../', 'feeds'),
|
||||||
baseUrl: nconf.get('url') + 'feeds'
|
baseUrl: nconf.get('url') + '/feeds'
|
||||||
};
|
};
|
||||||
|
|
||||||
Feed.saveFeed = function (location, feed, callback) {
|
Feed.saveFeed = function (location, feed, callback) {
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
title: topicData.topic_name,
|
title: topicData.topic_name,
|
||||||
description: topicData.posts[0].content,
|
description: topicData.posts[0].content,
|
||||||
feed_url: Feed.defaults.baseUrl + '/topics/' + tid + '.rss',
|
feed_url: Feed.defaults.baseUrl + '/topics/' + tid + '.rss',
|
||||||
site_url: nconf.get('url') + 'topic/' + topicData.slug,
|
site_url: nconf.get('url') + '/topic/' + topicData.slug,
|
||||||
image_url: topicData.posts[0].picture,
|
image_url: topicData.posts[0].picture,
|
||||||
author: topicData.posts[0].username,
|
author: topicData.posts[0].username,
|
||||||
ttl: Feed.defaults.ttl
|
ttl: Feed.defaults.ttl
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
feed.item({
|
feed.item({
|
||||||
title: 'Reply to ' + topicData.topic_name + ' on ' + dateStamp,
|
title: 'Reply to ' + topicData.topic_name + ' on ' + dateStamp,
|
||||||
description: postData.content,
|
description: postData.content,
|
||||||
url: nconf.get('url') + 'topic/' + topicData.slug + '#' + postData.pid,
|
url: nconf.get('url') + '/topic/' + topicData.slug + '#' + postData.pid,
|
||||||
author: postData.username,
|
author: postData.username,
|
||||||
date: dateStamp
|
date: dateStamp
|
||||||
});
|
});
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
title: categoryData.category_name,
|
title: categoryData.category_name,
|
||||||
description: categoryData.category_description,
|
description: categoryData.category_description,
|
||||||
feed_url: Feed.defaults.baseUrl + '/categories/' + cid + '.rss',
|
feed_url: Feed.defaults.baseUrl + '/categories/' + cid + '.rss',
|
||||||
site_url: nconf.get('url') + 'category/' + categoryData.category_id,
|
site_url: nconf.get('url') + '/category/' + categoryData.category_id,
|
||||||
ttl: Feed.defaults.ttl
|
ttl: Feed.defaults.ttl
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
async.eachSeries(categoryData.topics, function(topicData, next) {
|
async.eachSeries(categoryData.topics, function(topicData, next) {
|
||||||
feed.item({
|
feed.item({
|
||||||
title: topicData.title,
|
title: topicData.title,
|
||||||
url: nconf.get('url') + 'topic/' + topicData.slug,
|
url: nconf.get('url') + '/topic/' + topicData.slug,
|
||||||
author: topicData.username,
|
author: topicData.username,
|
||||||
date: new Date(parseInt(topicData.lastposttime, 10)).toUTCString()
|
date: new Date(parseInt(topicData.lastposttime, 10)).toUTCString()
|
||||||
});
|
});
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
title: 'Recently Active Topics',
|
title: 'Recently Active Topics',
|
||||||
description: 'A list of topics that have been active within the past 24 hours',
|
description: 'A list of topics that have been active within the past 24 hours',
|
||||||
feed_url: Feed.defaults.baseUrl + '/recent.rss',
|
feed_url: Feed.defaults.baseUrl + '/recent.rss',
|
||||||
site_url: nconf.get('url') + 'recent',
|
site_url: nconf.get('url') + '/recent',
|
||||||
ttl: Feed.defaults.ttl
|
ttl: Feed.defaults.ttl
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
async.eachSeries(recentData.topics, function(topicData, next) {
|
async.eachSeries(recentData.topics, function(topicData, next) {
|
||||||
feed.item({
|
feed.item({
|
||||||
title: topicData.title,
|
title: topicData.title,
|
||||||
url: nconf.get('url') + 'topic/' + topicData.slug,
|
url: nconf.get('url') + '/topic/' + topicData.slug,
|
||||||
author: topicData.username,
|
author: topicData.username,
|
||||||
date: new Date(parseInt(topicData.lastposttime, 10)).toUTCString()
|
date: new Date(parseInt(topicData.lastposttime, 10)).toUTCString()
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
passport.use(new passportTwitter({
|
passport.use(new passportTwitter({
|
||||||
consumerKey: meta.config['social:twitter:key'],
|
consumerKey: meta.config['social:twitter:key'],
|
||||||
consumerSecret: meta.config['social:twitter:secret'],
|
consumerSecret: meta.config['social:twitter:secret'],
|
||||||
callbackURL: nconf.get('url') + 'auth/twitter/callback'
|
callbackURL: nconf.get('url') + '/auth/twitter/callback'
|
||||||
}, function(token, tokenSecret, profile, done) {
|
}, function(token, tokenSecret, profile, done) {
|
||||||
login_module.loginViaTwitter(profile.id, profile.username, profile.photos, function(err, user) {
|
login_module.loginViaTwitter(profile.id, profile.username, profile.photos, function(err, user) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
passport.use(new passportGoogle({
|
passport.use(new passportGoogle({
|
||||||
clientID: meta.config['social:google:id'],
|
clientID: meta.config['social:google:id'],
|
||||||
clientSecret: meta.config['social:google:secret'],
|
clientSecret: meta.config['social:google:secret'],
|
||||||
callbackURL: nconf.get('url') + 'auth/google/callback'
|
callbackURL: nconf.get('url') + '/auth/google/callback'
|
||||||
}, function(accessToken, refreshToken, profile, done) {
|
}, function(accessToken, refreshToken, profile, done) {
|
||||||
login_module.loginViaGoogle(profile.id, profile.displayName, profile.emails[0].value, function(err, user) {
|
login_module.loginViaGoogle(profile.id, profile.displayName, profile.emails[0].value, function(err, user) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
passport.use(new passportFacebook({
|
passport.use(new passportFacebook({
|
||||||
clientID: meta.config['social:facebook:app_id'],
|
clientID: meta.config['social:facebook:app_id'],
|
||||||
clientSecret: meta.config['social:facebook:secret'],
|
clientSecret: meta.config['social:facebook:secret'],
|
||||||
callbackURL: nconf.get('url') + 'auth/facebook/callback'
|
callbackURL: nconf.get('url') + '/auth/facebook/callback'
|
||||||
}, function(accessToken, refreshToken, profile, done) {
|
}, function(accessToken, refreshToken, profile, done) {
|
||||||
login_module.loginViaFacebook(profile.id, profile.displayName, profile.emails[0].value, function(err, user) {
|
login_module.loginViaFacebook(profile.id, profile.displayName, profile.emails[0].value, function(err, user) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ var path = require('path'),
|
|||||||
changefreq: 'weekly',
|
changefreq: 'weekly',
|
||||||
priority: '0.6'
|
priority: '0.6'
|
||||||
}, {
|
}, {
|
||||||
url: 'recent',
|
url: '/recent',
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.4'
|
priority: '0.4'
|
||||||
}, {
|
}, {
|
||||||
url: 'users',
|
url: '/users',
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.4'
|
priority: '0.4'
|
||||||
}]);
|
}]);
|
||||||
@@ -31,7 +31,7 @@ var path = require('path'),
|
|||||||
data.categories.forEach(function(category) {
|
data.categories.forEach(function(category) {
|
||||||
if (!category.disabled) {
|
if (!category.disabled) {
|
||||||
categoryUrls.push({
|
categoryUrls.push({
|
||||||
url: path.join('category', category.slug),
|
url: path.join('/category', category.slug),
|
||||||
changefreq: 'weekly',
|
changefreq: 'weekly',
|
||||||
priority: '0.4'
|
priority: '0.4'
|
||||||
});
|
});
|
||||||
@@ -48,7 +48,7 @@ var path = require('path'),
|
|||||||
|
|
||||||
if (parseInt(topic.deleted, 10) !== 1) {
|
if (parseInt(topic.deleted, 10) !== 1) {
|
||||||
topicUrls.push({
|
topicUrls.push({
|
||||||
url: path.join('topic', topic.slug),
|
url: path.join('/topic', topic.slug),
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.6'
|
priority: '0.6'
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -801,7 +801,7 @@ var bcrypt = require('bcrypt'),
|
|||||||
db.setObjectField('reset:uid', reset_code, uid);
|
db.setObjectField('reset:uid', reset_code, uid);
|
||||||
db.setObjectField('reset:expiry', reset_code, (60 * 60) + new Date() / 1000 | 0); // Active for one hour
|
db.setObjectField('reset:expiry', reset_code, (60 * 60) + new Date() / 1000 | 0); // Active for one hour
|
||||||
|
|
||||||
var reset_link = nconf.get('url') + 'reset/' + reset_code;
|
var reset_link = nconf.get('url') + '/reset/' + reset_code;
|
||||||
|
|
||||||
Emailer.send('reset', uid, {
|
Emailer.send('reset', uid, {
|
||||||
'site_title': (meta.config['title'] || 'NodeBB'),
|
'site_title': (meta.config['title'] || 'NodeBB'),
|
||||||
@@ -857,7 +857,7 @@ var bcrypt = require('bcrypt'),
|
|||||||
User.email = {
|
User.email = {
|
||||||
verify: function(uid, email) {
|
verify: function(uid, email) {
|
||||||
var confirm_code = utils.generateUUID(),
|
var confirm_code = utils.generateUUID(),
|
||||||
confirm_link = nconf.get('url') + 'confirm/' + confirm_code;
|
confirm_link = nconf.get('url') + '/confirm/' + confirm_code;
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
function(next) {
|
function(next) {
|
||||||
|
|||||||
@@ -586,7 +586,11 @@ if(nconf.get('ssl')) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
property: "og:url",
|
property: "og:url",
|
||||||
content: nconf.get('url') + 'topic/' + topicData.slug
|
content: nconf.get('url') + '/topic/' + topicData.slug
|
||||||
|
},
|
||||||
|
{
|
||||||
|
property: "og:image:url",
|
||||||
|
content: nconf.get('url') + (meta.config['brand:logo']?meta.config['brand:logo']:'')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
property: 'og:image',
|
property: 'og:image',
|
||||||
@@ -609,11 +613,11 @@ if(nconf.get('ssl')) {
|
|||||||
{
|
{
|
||||||
rel: 'alternate',
|
rel: 'alternate',
|
||||||
type: 'application/rss+xml',
|
type: 'application/rss+xml',
|
||||||
href: nconf.get('url') + 'topic/' + tid + '.rss'
|
href: nconf.get('url') + '/topic/' + tid + '.rss'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rel: 'up',
|
rel: 'up',
|
||||||
href: nconf.get('url') + 'category/' + topicData.category_slug
|
href: nconf.get('url') + '/category/' + topicData.category_slug
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, function (err, header) {
|
}, function (err, header) {
|
||||||
@@ -720,7 +724,7 @@ if(nconf.get('ssl')) {
|
|||||||
{
|
{
|
||||||
rel: 'alternate',
|
rel: 'alternate',
|
||||||
type: 'application/rss+xml',
|
type: 'application/rss+xml',
|
||||||
href: nconf.get('url') + 'category/' + cid + '.rss'
|
href: nconf.get('url') + '/category/' + cid + '.rss'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rel: 'up',
|
rel: 'up',
|
||||||
@@ -784,7 +788,7 @@ if(nconf.get('ssl')) {
|
|||||||
} else {
|
} else {
|
||||||
res.send("User-agent: *\n" +
|
res.send("User-agent: *\n" +
|
||||||
"Disallow: /admin/\n" +
|
"Disallow: /admin/\n" +
|
||||||
"Sitemap: " + nconf.get('url') + "sitemap.xml");
|
"Sitemap: " + nconf.get('url') + "/sitemap.xml");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user