Node.js based forum software built for the modern web
fix(activitypub): handle instance list as blocklist or allowlist based on type
Julian Lam822250d77d99
diff --git a/src/activitypub/instances.js b/src/activitypub/instances.jsindex 1ecd5307c6..ca0a73881b 100644--- a/src/activitypub/instances.js+++ b/src/activitypub/instances.js@@ -18,15 +18,17 @@ Instances.isAllowed = async (domain) => {const result = await activitypub.blocklists.check(domain);let { activitypubFilter: type, activitypubFilterList: list } = meta.config;- if (!result.allowed && !type) {- return result;- }-list = new Set(String(list).split('\n'));- if (result.allowed) {- return { ...result, allowed: type ? list.has(domain) : true };+ if (!type) {+ // type = 0: blocklist mode — deny if domain is on the list+ if (result.allowed) {+ return { ...result, allowed: !list.has(domain) };+ }++ return result;}- return { ...result, allowed: type ? !list.has(domain) : false };+ // type = 1: allowlist mode — allow only if domain is on the list+ return { ...result, allowed: list.has(domain) };};