fix: only send activitypub+json links via webfinger if activitypub is global enabled

This commit is contained in:
Julian Lam
2024-03-22 12:29:41 -04:00
parent 9c03e6e93c
commit 65bb866654

View File

@@ -2,6 +2,7 @@
const nconf = require('nconf');
const meta = require('../meta');
const user = require('../user');
const categories = require('../categories');
const privileges = require('../privileges');
@@ -42,13 +43,15 @@ Controller.webfinger = async (req, res) => {
function application(response) {
response.aliases = [nconf.get('url')];
response.links = [
{
response.links = [];
if (meta.config.activitypubEnabled) {
response.links.push({
rel: 'self',
type: 'application/activity+json',
href: `${nconf.get('url')}/actor`, // actor
},
];
});
}
return response;
}
@@ -66,11 +69,6 @@ async function profile(callerUid, uid, response) {
];
response.links = [
{
rel: 'self',
type: 'application/activity+json',
href: `${nconf.get('url')}/uid/${uid}`, // actor
},
{
rel: 'http://webfinger.net/rel/profile-page',
type: 'text/html',
@@ -78,6 +76,14 @@ async function profile(callerUid, uid, response) {
},
];
if (meta.config.activitypubEnabled) {
response.links.push({
rel: 'self',
type: 'application/activity+json',
href: `${nconf.get('url')}/uid/${uid}`, // actor
});
}
return response;
}
@@ -89,13 +95,15 @@ async function category(callerUid, cid, response) {
const slug = await categories.getCategoryField(cid, 'slug');
response.aliases = [`${nconf.get('url')}/category/${slug}`];
response.links = [
{
response.links = [];
if (meta.config.activitypubEnabled) {
response.links.push({
rel: 'self',
type: 'application/activity+json',
href: `${nconf.get('url')}/category/${cid}`, // actor
},
];
});
}
return response;
}