Node.js based forum software built for the modern web
revert: use of vanity domains, needs rethinking. Originally added in 709a02d97ae7acbab08c7fa1fecfd01e0dcadcc7
Julian Lam55c89969edc8
diff --git a/src/activitypub/actors.js b/src/activitypub/actors.jsindex 370fb70c31..594e4e5da8 100644--- a/src/activitypub/actors.js+++ b/src/activitypub/actors.js@@ -47,7 +47,6 @@ Actors.assert = async (ids, options = {}) => {ids = ids.filter(id => !utils.isNumber(id));// Translate webfinger handles to uris- const hostMap = new Map();ids = (await Promise.all(ids.map(async (id) => {const originalId = id;if (activitypub.helpers.isWebfinger(id)) {@@ -57,7 +56,6 @@ Actors.assert = async (ids, options = {}) => {}({ actorUri: id } = await activitypub.helpers.query(id));- hostMap.set(id, host);}// ensure the final id is a valid URIif (!id || !activitypub.helpers.isUri(id)) {@@ -163,7 +161,7 @@ Actors.assert = async (ids, options = {}) => {actors = actors.filter(Boolean); // remove unresolvable actors// Build userData object for storage- const profiles = (await activitypub.mocks.profile(actors, hostMap)).filter(Boolean);+ const profiles = (await activitypub.mocks.profile(actors)).filter(Boolean);const now = Date.now();const bulkSet = profiles.reduce((memo, profile) => {diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.jsindex 3e05aa413d..7726768016 100644--- a/src/activitypub/mocks.js+++ b/src/activitypub/mocks.js@@ -129,7 +129,7 @@ Mocks._normalize = async (object) => {};};-Mocks.profile = async (actors, hostMap) => {+Mocks.profile = async (actors) => {// Should only ever be called by activitypub.actors.assertconst profiles = await Promise.all(actors.map(async (actor) => {if (!actor) {@@ -137,7 +137,7 @@ Mocks.profile = async (actors, hostMap) => {}const uid = actor.id;- let hostname = hostMap.get(uid);+ let hostname;let {url, preferredUsername, published, icon, image,name, summary, followers, inbox, endpoints, tag,@@ -145,12 +145,10 @@ Mocks.profile = async (actors, hostMap) => {preferredUsername = slugify(preferredUsername || name);const { followers: followerCount, following: followingCount } = await activitypub.actors.getLocalFollowCounts(uid);- if (!hostname) { // if not available via webfinger, infer from id- try {- ({ hostname } = new URL(actor.id));- } catch (e) {- return null;- }+ try {+ ({ hostname } = new URL(actor.id));+ } catch (e) {+ return null;}let picture;