Node.js based forum software built for the modern web
closes #5404
barisusakli33e8ecc1f460
diff --git a/install/data/defaults.json b/install/data/defaults.jsonindex 25fe659b27..98de790158 100644--- a/install/data/defaults.json+++ b/install/data/defaults.json@@ -29,7 +29,7 @@"maximumAboutMeLength": 1000,"maximumProfileImageSize": 256,"maximumCoverImageSize": 2048,- "profileImageDimension": 128,+ "profileImageDimension": 200,"requireEmailConfirmation": 0,"allowProfileImageUploads": 1,"teaserPost": "last-reply",diff --git a/src/controllers/accounts/edit.js b/src/controllers/accounts/edit.jsindex d659b0153f..eca16192c9 100644--- a/src/controllers/accounts/edit.js+++ b/src/controllers/accounts/edit.js@@ -26,7 +26,7 @@ editController.get = function (req, res, callback) {userData.maximumProfileImageSize = parseInt(meta.config.maximumProfileImageSize, 10);userData.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads, 10) === 1;userData.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1;- userData.profileImageDimension = parseInt(meta.config.profileImageDimension, 10) || 128;+ userData.profileImageDimension = parseInt(meta.config.profileImageDimension, 10) || 200;userData.groups = userData.groups.filter(function (group) {return group && group.userTitleEnabled && !groups.isPrivilegeGroup(group.name) && group.name !== 'registered-users';diff --git a/src/controllers/categories.js b/src/controllers/categories.jsindex e02f107b4a..9a17a47fc2 100644--- a/src/controllers/categories.js+++ b/src/controllers/categories.js@@ -21,17 +21,6 @@ categoriesController.list = function (req, res, next) {content: 'website',}];- var ogImage = meta.config['og:image'] || meta.config['brand:logo'] || '';- if (ogImage) {- if (!ogImage.startsWith('http')) {- ogImage = nconf.get('url') + ogImage;- }- res.locals.metaTags.push({- property: 'og:image',- content: ogImage,- });- }-var categoryData;async.waterfall([function (next) {diff --git a/src/controllers/tags.js b/src/controllers/tags.jsindex cffff0e44c..64e1640706 100644--- a/src/controllers/tags.js+++ b/src/controllers/tags.js@@ -1,8 +1,6 @@'use strict';-var async = require('async');-var nconf = require('nconf');var validator = require('validator');var user = require('../user');@@ -63,10 +61,6 @@ tagsController.getTag = function (req, res, next) {property: 'og:title',content: tag,},- {- property: 'og:url',- content: nconf.get('url') + '/tags/' + tag,- },];templateData.topics = topics;diff --git a/src/controllers/topics.js b/src/controllers/topics.jsindex 4fe1bf96d5..ddd6fd889a 100644--- a/src/controllers/topics.js+++ b/src/controllers/topics.js@@ -206,11 +206,6 @@ topicsController.get = function (req, res, callback) {property: 'og:type',content: 'article',},- {- property: 'og:url',- content: nconf.get('url') + '/topic/' + topicData.slug + (req.params.post_index ? ('/' + req.params.post_index) : ''),- noEscape: true,- },{property: 'og:image',content: ogImageUrl,diff --git a/src/meta/tags.js b/src/meta/tags.jsindex 5b1097d427..ac0b395a23 100644--- a/src/meta/tags.js+++ b/src/meta/tags.js@@ -9,7 +9,7 @@ var plugins = require('../plugins');module.exports = function (Meta) {Meta.tags = {};- Meta.tags.parse = function (meta, link, callback) {+ Meta.tags.parse = function (req, meta, link, callback) {async.parallel({tags: function (next) {var defaultTags = [{@@ -120,7 +120,23 @@ module.exports = function (Meta) {return tag;});- addDescription(meta);+ addIfNotExists(meta, 'property', 'og:title', Meta.config.title || 'NodeBB');++ var ogUrl = nconf.get('url') + req.path;+ addIfNotExists(meta, 'property', 'og:url', ogUrl);++ addIfNotExists(meta, 'name', 'description', Meta.config.description);+ addIfNotExists(meta, 'property', 'og:description', Meta.config.description);++ var ogImage = Meta.config['og:image'] || Meta.config['brand:logo'] || '';+ if (ogImage && !ogImage.startsWith('http')) {+ ogImage = nconf.get('url') + ogImage;+ }+ addIfNotExists(meta, 'property', 'og:image', ogImage);+ if (ogImage) {+ addIfNotExists(meta, 'property', 'og:image:width', 200);+ addIfNotExists(meta, 'property', 'og:image:height', 200);+ }link = results.links.concat(link || []);@@ -131,19 +147,20 @@ module.exports = function (Meta) {});};- function addDescription(meta) {- var hasDescription = false;+ function addIfNotExists(meta, keyName, tagName, value) {+ var exists = false;meta.forEach(function (tag) {- if (tag.name === 'description') {- hasDescription = true;+ if (tag[keyName] === tagName) {+ exists = true;}});- if (!hasDescription && Meta.config.description) {- meta.push({- name: 'description',- content: validator.escape(String(Meta.config.description)),- });+ if (!exists && value) {+ var data = {+ content: validator.escape(String(value)),+ };+ data[keyName] = tagName;+ meta.push(data);}}};diff --git a/src/middleware/header.js b/src/middleware/header.jsindex 70c0755def..af1a2e0285 100644--- a/src/middleware/header.js+++ b/src/middleware/header.js@@ -97,7 +97,7 @@ module.exports = function (middleware) {db.get('uid:' + req.uid + ':confirm:email:sent', next);},navigation: async.apply(navigation.get),- tags: async.apply(meta.tags.parse, res.locals.metaTags, res.locals.linkTags),+ tags: async.apply(meta.tags.parse, req, res.locals.metaTags, res.locals.linkTags),banned: async.apply(user.isBanned, req.uid),banReason: async.apply(user.getBannedReason, req.uid),}, next);diff --git a/src/user/picture.js b/src/user/picture.jsindex 2b4f45d344..dfe0aa72bb 100644--- a/src/user/picture.js+++ b/src/user/picture.js@@ -154,7 +154,7 @@ module.exports = function (User) {function (path, next) {picture.path = path;- var imageDimension = parseInt(meta.config.profileImageDimension, 10) || 128;+ var imageDimension = parseInt(meta.config.profileImageDimension, 10) || 200;image.resizeImage({path: picture.path,extension: extension,diff --git a/src/views/admin/settings/uploads.tpl b/src/views/admin/settings/uploads.tplindex feff2dbff3..32e432adfc 100644--- a/src/views/admin/settings/uploads.tpl+++ b/src/views/admin/settings/uploads.tpl@@ -91,7 +91,7 @@<div class="form-group"><label for="profileImageDimension">[[admin/settings/uploads:profile-image-dimension]]</label>- <input id="profileImageDimension" type="text" class="form-control" data-field="profileImageDimension" placeholder="128" />+ <input id="profileImageDimension" type="text" class="form-control" data-field="profileImageDimension" placeholder="200" /><p class="help-block">[[admin/settings/uploads:profile-image-dimension-help]]</p>