feat: fix activitypub toggler to be more complete; tests. #13054

This commit is contained in:
Julian Lam
2025-01-20 12:05:17 -05:00
parent 3e08eb3925
commit af4d07fba4
6 changed files with 64 additions and 3 deletions

View File

@@ -263,6 +263,10 @@ ActivityPub.verify = async (req) => {
};
ActivityPub.get = async (type, id, uri, options) => {
if (!meta.config.activitypubEnabled) {
throw new Error('[[error:activitypub.not-enabled]]');
}
options = {
cache: true,
...options,
@@ -358,6 +362,10 @@ async function sendMessage(uri, id, type, payload, attempts = 1) {
}
ActivityPub.send = async (type, id, targets, payload) => {
if (!meta.config.activitypubEnabled) {
return ActivityPub.helpers.log('[activitypub/send] Federation not enabled; not sending.');
}
if (!Array.isArray(targets)) {
targets = [targets];
}