revert: use of vanity domains, needs rethinking. Originally added in 709a02d97a

This commit is contained in:
Julian Lam
2025-03-12 11:52:07 -04:00
parent 85fc167800
commit 55c89969ed
2 changed files with 7 additions and 11 deletions

View File

@@ -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 URI
if (!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) => {

View File

@@ -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.assert
const 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;