From 543daee866a6dad8dd36ff641f303ba0e6cae7a5 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 22 Dec 2023 13:56:18 -0500 Subject: [PATCH] fix: send actor uris in follow instead of webfinger ids --- src/activitypub/index.js | 5 +---- src/api/activitypub.js | 8 +++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/activitypub/index.js b/src/activitypub/index.js index c439821680..ff9dcf259c 100644 --- a/src/activitypub/index.js +++ b/src/activitypub/index.js @@ -172,10 +172,7 @@ ActivityPub.send = async (uid, targets, payload) => { payload = { '@context': 'https://www.w3.org/ns/activitystreams', - actor: { - type: 'Person', - name: `${userslug}@${nconf.get('url_parsed').host}`, - }, + actor: `${nconf.get('url')}/user/${userslug}`, ...payload, }; diff --git a/src/api/activitypub.js b/src/api/activitypub.js index fd9f219e18..733a0cbcee 100644 --- a/src/api/activitypub.js +++ b/src/api/activitypub.js @@ -14,16 +14,14 @@ const activitypub = require('../activitypub'); const activitypubApi = module.exports; activitypubApi.follow = async (caller, { actorId } = {}) => { - if (!actorId) { + const object = activitypub.getActor(actorId); + if (!object) { throw new Error('[[error:invalid-uid]]'); // should be activitypub-specific } await activitypub.send(caller.uid, actorId, { type: 'Follow', - object: { - type: 'Person', - name: actorId, - }, + object: object.actorUri, }); const now = Date.now();