mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
closes #5404
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
"maximumAboutMeLength": 1000,
|
||||
"maximumProfileImageSize": 256,
|
||||
"maximumCoverImageSize": 2048,
|
||||
"profileImageDimension": 128,
|
||||
"profileImageDimension": 200,
|
||||
"requireEmailConfirmation": 0,
|
||||
"allowProfileImageUploads": 1,
|
||||
"teaserPost": "last-reply",
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user