mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-27 17:11:14 +01:00
revert: use of vanity domains, needs rethinking. Originally added in 709a02d97a
This commit is contained in:
@@ -47,7 +47,6 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
ids = ids.filter(id => !utils.isNumber(id));
|
ids = ids.filter(id => !utils.isNumber(id));
|
||||||
|
|
||||||
// Translate webfinger handles to uris
|
// Translate webfinger handles to uris
|
||||||
const hostMap = new Map();
|
|
||||||
ids = (await Promise.all(ids.map(async (id) => {
|
ids = (await Promise.all(ids.map(async (id) => {
|
||||||
const originalId = id;
|
const originalId = id;
|
||||||
if (activitypub.helpers.isWebfinger(id)) {
|
if (activitypub.helpers.isWebfinger(id)) {
|
||||||
@@ -57,7 +56,6 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
({ actorUri: id } = await activitypub.helpers.query(id));
|
({ actorUri: id } = await activitypub.helpers.query(id));
|
||||||
hostMap.set(id, host);
|
|
||||||
}
|
}
|
||||||
// ensure the final id is a valid URI
|
// ensure the final id is a valid URI
|
||||||
if (!id || !activitypub.helpers.isUri(id)) {
|
if (!id || !activitypub.helpers.isUri(id)) {
|
||||||
@@ -163,7 +161,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
actors = actors.filter(Boolean); // remove unresolvable actors
|
actors = actors.filter(Boolean); // remove unresolvable actors
|
||||||
|
|
||||||
// Build userData object for storage
|
// 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 now = Date.now();
|
||||||
|
|
||||||
const bulkSet = profiles.reduce((memo, profile) => {
|
const bulkSet = profiles.reduce((memo, profile) => {
|
||||||
|
|||||||
@@ -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
|
// Should only ever be called by activitypub.actors.assert
|
||||||
const profiles = await Promise.all(actors.map(async (actor) => {
|
const profiles = await Promise.all(actors.map(async (actor) => {
|
||||||
if (!actor) {
|
if (!actor) {
|
||||||
@@ -137,7 +137,7 @@ Mocks.profile = async (actors, hostMap) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uid = actor.id;
|
const uid = actor.id;
|
||||||
let hostname = hostMap.get(uid);
|
let hostname;
|
||||||
let {
|
let {
|
||||||
url, preferredUsername, published, icon, image,
|
url, preferredUsername, published, icon, image,
|
||||||
name, summary, followers, inbox, endpoints, tag,
|
name, summary, followers, inbox, endpoints, tag,
|
||||||
@@ -145,12 +145,10 @@ Mocks.profile = async (actors, hostMap) => {
|
|||||||
preferredUsername = slugify(preferredUsername || name);
|
preferredUsername = slugify(preferredUsername || name);
|
||||||
const { followers: followerCount, following: followingCount } = await activitypub.actors.getLocalFollowCounts(uid);
|
const { followers: followerCount, following: followingCount } = await activitypub.actors.getLocalFollowCounts(uid);
|
||||||
|
|
||||||
if (!hostname) { // if not available via webfinger, infer from id
|
try {
|
||||||
try {
|
({ hostname } = new URL(actor.id));
|
||||||
({ hostname } = new URL(actor.id));
|
} catch (e) {
|
||||||
} catch (e) {
|
return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let picture;
|
let picture;
|
||||||
|
|||||||
Reference in New Issue
Block a user