|
|
@ -289,17 +289,11 @@ async function addTags(topicData, req, res) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function addOGImageTags(res, topicData, postAtIndex) {
|
|
|
|
async function addOGImageTags(res, topicData, postAtIndex) {
|
|
|
|
const images = [];
|
|
|
|
const uploads = postAtIndex ? await posts.uploads.listWithSizes(postAtIndex.pid) : [];
|
|
|
|
|
|
|
|
const images = uploads.map((upload) => {
|
|
|
|
async.series([
|
|
|
|
|
|
|
|
async function () {
|
|
|
|
|
|
|
|
const uploads = await posts.uploads.listWithSizes(postAtIndex.pid);
|
|
|
|
|
|
|
|
uploads.forEach((upload) => {
|
|
|
|
|
|
|
|
upload.name = nconf.get('url') + nconf.get('upload_url') + '/files/' + upload.name;
|
|
|
|
upload.name = nconf.get('url') + nconf.get('upload_url') + '/files/' + upload.name;
|
|
|
|
images.push(upload);
|
|
|
|
return upload;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
function (next) {
|
|
|
|
|
|
|
|
if (topicData.thumb) {
|
|
|
|
if (topicData.thumb) {
|
|
|
|
images.push(topicData.thumb);
|
|
|
|
images.push(topicData.thumb);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -309,12 +303,7 @@ async function addOGImageTags(res, topicData, postAtIndex) {
|
|
|
|
if (postAtIndex && postAtIndex.user && postAtIndex.user.picture) {
|
|
|
|
if (postAtIndex && postAtIndex.user && postAtIndex.user.picture) {
|
|
|
|
images.push(postAtIndex.user.picture);
|
|
|
|
images.push(postAtIndex.user.picture);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
process.nextTick(next);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
], function () {
|
|
|
|
|
|
|
|
images.forEach(path => addOGImageTag(res, path));
|
|
|
|
images.forEach(path => addOGImageTag(res, path));
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function addOGImageTag(res, image) {
|
|
|
|
function addOGImageTag(res, image) {
|
|
|
|