From b945dfc71d35e7f3cc61386da1a0584640d414ea Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 22 Jan 2014 14:04:04 -0500 Subject: [PATCH] closes #843 --- app.js | 2 +- src/feed.js | 14 +++++++------- src/routes/authentication.js | 6 +++--- src/sitemap.js | 8 ++++---- src/user.js | 4 ++-- src/webserver.js | 14 +++++++++----- 6 files changed, 26 insertions(+), 22 deletions(-) diff --git a/app.js b/app.js index ec3469f221..375a74c695 100644 --- a/app.js +++ b/app.js @@ -70,7 +70,7 @@ }); 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('base_dir', __dirname); diff --git a/src/feed.js b/src/feed.js index 7f07737e03..ac55c64460 100644 --- a/src/feed.js +++ b/src/feed.js @@ -14,7 +14,7 @@ Feed.defaults = { ttl: 60, basePath: path.join(__dirname, '../', 'feeds'), - baseUrl: nconf.get('url') + 'feeds' + baseUrl: nconf.get('url') + '/feeds' }; Feed.saveFeed = function (location, feed, callback) { @@ -42,7 +42,7 @@ title: topicData.topic_name, description: topicData.posts[0].content, 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, author: topicData.posts[0].username, ttl: Feed.defaults.ttl @@ -61,7 +61,7 @@ feed.item({ title: 'Reply to ' + topicData.topic_name + ' on ' + dateStamp, description: postData.content, - url: nconf.get('url') + 'topic/' + topicData.slug + '#' + postData.pid, + url: nconf.get('url') + '/topic/' + topicData.slug + '#' + postData.pid, author: postData.username, date: dateStamp }); @@ -91,7 +91,7 @@ title: categoryData.category_name, description: categoryData.category_description, 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 }); @@ -101,7 +101,7 @@ async.eachSeries(categoryData.topics, function(topicData, next) { feed.item({ title: topicData.title, - url: nconf.get('url') + 'topic/' + topicData.slug, + url: nconf.get('url') + '/topic/' + topicData.slug, author: topicData.username, date: new Date(parseInt(topicData.lastposttime, 10)).toUTCString() }); @@ -127,7 +127,7 @@ title: 'Recently Active Topics', description: 'A list of topics that have been active within the past 24 hours', feed_url: Feed.defaults.baseUrl + '/recent.rss', - site_url: nconf.get('url') + 'recent', + site_url: nconf.get('url') + '/recent', ttl: Feed.defaults.ttl }); @@ -139,7 +139,7 @@ async.eachSeries(recentData.topics, function(topicData, next) { feed.item({ title: topicData.title, - url: nconf.get('url') + 'topic/' + topicData.slug, + url: nconf.get('url') + '/topic/' + topicData.slug, author: topicData.username, date: new Date(parseInt(topicData.lastposttime, 10)).toUTCString() }); diff --git a/src/routes/authentication.js b/src/routes/authentication.js index ea6228717a..4fb9560a1b 100644 --- a/src/routes/authentication.js +++ b/src/routes/authentication.js @@ -36,7 +36,7 @@ passport.use(new passportTwitter({ consumerKey: meta.config['social:twitter:key'], 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) { login_module.loginViaTwitter(profile.id, profile.username, profile.photos, function(err, user) { if (err) { @@ -59,7 +59,7 @@ passport.use(new passportGoogle({ clientID: meta.config['social:google:id'], 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) { login_module.loginViaGoogle(profile.id, profile.displayName, profile.emails[0].value, function(err, user) { if (err) { @@ -82,7 +82,7 @@ passport.use(new passportFacebook({ clientID: meta.config['social:facebook:app_id'], 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) { login_module.loginViaFacebook(profile.id, profile.displayName, profile.emails[0].value, function(err, user) { if (err) { diff --git a/src/sitemap.js b/src/sitemap.js index 68e69ea6a0..8d478163b0 100644 --- a/src/sitemap.js +++ b/src/sitemap.js @@ -12,11 +12,11 @@ var path = require('path'), changefreq: 'weekly', priority: '0.6' }, { - url: 'recent', + url: '/recent', changefreq: 'daily', priority: '0.4' }, { - url: 'users', + url: '/users', changefreq: 'daily', priority: '0.4' }]); @@ -31,7 +31,7 @@ var path = require('path'), data.categories.forEach(function(category) { if (!category.disabled) { categoryUrls.push({ - url: path.join('category', category.slug), + url: path.join('/category', category.slug), changefreq: 'weekly', priority: '0.4' }); @@ -48,7 +48,7 @@ var path = require('path'), if (parseInt(topic.deleted, 10) !== 1) { topicUrls.push({ - url: path.join('topic', topic.slug), + url: path.join('/topic', topic.slug), changefreq: 'daily', priority: '0.6' }); diff --git a/src/user.js b/src/user.js index f9e6bc548a..c09af86597 100644 --- a/src/user.js +++ b/src/user.js @@ -801,7 +801,7 @@ var bcrypt = require('bcrypt'), db.setObjectField('reset:uid', reset_code, uid); 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, { 'site_title': (meta.config['title'] || 'NodeBB'), @@ -857,7 +857,7 @@ var bcrypt = require('bcrypt'), User.email = { verify: function(uid, email) { var confirm_code = utils.generateUUID(), - confirm_link = nconf.get('url') + 'confirm/' + confirm_code; + confirm_link = nconf.get('url') + '/confirm/' + confirm_code; async.series([ function(next) { diff --git a/src/webserver.js b/src/webserver.js index ff28b203c6..cea4071ab9 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -586,7 +586,11 @@ if(nconf.get('ssl')) { }, { 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', @@ -609,11 +613,11 @@ if(nconf.get('ssl')) { { rel: 'alternate', type: 'application/rss+xml', - href: nconf.get('url') + 'topic/' + tid + '.rss' + href: nconf.get('url') + '/topic/' + tid + '.rss' }, { rel: 'up', - href: nconf.get('url') + 'category/' + topicData.category_slug + href: nconf.get('url') + '/category/' + topicData.category_slug } ] }, function (err, header) { @@ -720,7 +724,7 @@ if(nconf.get('ssl')) { { rel: 'alternate', type: 'application/rss+xml', - href: nconf.get('url') + 'category/' + cid + '.rss' + href: nconf.get('url') + '/category/' + cid + '.rss' }, { rel: 'up', @@ -784,7 +788,7 @@ if(nconf.get('ssl')) { } else { res.send("User-agent: *\n" + "Disallow: /admin/\n" + - "Sitemap: " + nconf.get('url') + "sitemap.xml"); + "Sitemap: " + nconf.get('url') + "/sitemap.xml"); } });