Skip to content

Node.js based forum software built for the modern web

fix(activitypub): gate TLD requirement on activitypubAllowLoopback

Julian Lam12896b06ed64
diff --git a/.mocharc.yml b/.mocharc.yml
index 16d8518d1b..be39addbcc 100644
--- a/.mocharc.yml
+++ b/.mocharc.yml
@@ -1,4 +1,3 @@
reporter: dot
timeout: 25000
exit: true
-bail: true
diff --git a/src/activitypub/helpers.js b/src/activitypub/helpers.js
index f1501f7bcd..6008c7acba 100644
--- a/src/activitypub/helpers.js
+++ b/src/activitypub/helpers.js
@@ -66,7 +66,7 @@ Helpers.isUri = (value) => {
require_host: true,
protocols: activitypub._constants.acceptedProtocols,
require_valid_protocol: true,
- require_tld: false, // temporary — for localhost
+ require_tld: !meta.config.activitypubAllowLoopback,
});
};
diff --git a/test/activitypub/actors.js b/test/activitypub/actors.js
index f72e1ad6ce..29c5c3d57a 100644
--- a/test/activitypub/actors.js
+++ b/test/activitypub/actors.js
@@ -188,6 +188,7 @@ describe('as:Person (Actor asserton)', () => {
const userslug = utils.generateUUID().slice(0, 8);
before(async () => {
uid = await user.create({ username: userslug });
+ meta.config.activitypubAllowLoopback = true;
});
it('should return true but not actually assert the handle into the database', async () => {
diff --git a/test/activitypub/feps.js b/test/activitypub/feps.js
index 0bc29925c6..6f1431fc60 100644
--- a/test/activitypub/feps.js
+++ b/test/activitypub/feps.js
@@ -141,6 +141,7 @@ describe('FEPs', () => {
let topicData;
before(async () => {
+ meta.config.activitypubAllowLoopback = true;
topicData = await api.topics.create({ uid }, {
cid,
title: utils.generateUUID(),