Merge branch 'master' into develop

This commit is contained in:
Barış Soner Uşaklı
2025-08-21 10:48:35 -04:00

View File

@@ -172,7 +172,7 @@ categoryController.get = async function (req, res, next) {
if (meta.config.activitypubEnabled) { if (meta.config.activitypubEnabled) {
// Include link header for richer parsing // Include link header for richer parsing
res.set('Link', `<${nconf.get('url')}/actegory/${cid}>; rel="alternate"; type="application/activity+json"`); res.set('Link', `<${nconf.get('url')}/category/${cid}>; rel="alternate"; type="application/activity+json"`);
// Category accessible // Category accessible
const remoteOk = await privileges.categories.can('read', cid, activitypub._constants.uid); const remoteOk = await privileges.categories.can('read', cid, activitypub._constants.uid);
@@ -222,12 +222,14 @@ function addTags(categoryData, res, currentPage) {
]; ];
if (categoryData.backgroundImage) { if (categoryData.backgroundImage) {
if (!categoryData.backgroundImage.startsWith('http')) { let {backgroundImage} = categoryData;
categoryData.backgroundImage = url + categoryData.backgroundImage; backgroundImage = utils.decodeHTMLEntities(backgroundImage);
if (!backgroundImage.startsWith('http')) {
backgroundImage = url + backgroundImage.replace(new RegExp(`^${nconf.get('relative_path')}`), '');
} }
res.locals.metaTags.push({ res.locals.metaTags.push({
property: 'og:image', property: 'og:image',
content: categoryData.backgroundImage, content: backgroundImage,
noEscape: true, noEscape: true,
}); });
} }
@@ -257,7 +259,7 @@ function addTags(categoryData, res, currentPage) {
res.locals.linkTags.push({ res.locals.linkTags.push({
rel: 'alternate', rel: 'alternate',
type: 'application/activity+json', type: 'application/activity+json',
href: `${nconf.get('url')}/actegory/${categoryData.cid}`, href: `${nconf.get('url')}/category/${categoryData.cid}`,
}); });
} }
} }