Node.js based forum software built for the modern web
fix: isUri helper so that it passes ci tests
Julian Lam27e256d26e7e
diff --git a/src/activitypub/helpers.js b/src/activitypub/helpers.jsindex 23ea97bfd3..133064d438 100644--- a/src/activitypub/helpers.js+++ b/src/activitypub/helpers.js@@ -14,13 +14,24 @@ const webfingerCache = ttl({ ttl: 1000 * 60 * 60 * 24 }); // 24 hoursconst Helpers = module.exports;-Helpers.isUri = value => validator.isURL(value, {- require_protocol: true,- require_host: true,- protocols: ['https'],- require_valid_protocol: true,- require_tld: false, // temporary — for localhost-});+Helpers.isUri = (value) => {+ if (typeof value !== 'string') {+ value = String(value);+ }++ const protocols = ['https'];+ if (process.env.CI === 'true') {+ protocols.push('http');+ }++ return validator.isURL(value, {+ require_protocol: true,+ require_host: true,+ protocols,+ require_valid_protocol: true,+ require_tld: false, // temporary — for localhost+ });+};Helpers.query = async (id) => {const [username, hostname] = id.split('@');