feat: relay handshake logic, handle Follow/Accept, send back Accept.

This commit is contained in:
Julian Lam
2025-08-26 12:30:22 -04:00
parent 4967492f4f
commit f4d1df7c66
3 changed files with 38 additions and 4 deletions

View File

@@ -367,9 +367,12 @@ inbox.announce = async (req) => {
inbox.follow = async (req) => {
const { actor, object, id: followId } = req.body;
// Sanity checks
const { type, id } = await helpers.resolveLocalId(object.id);
if (!['category', 'user'].includes(type)) {
if (type === 'application') {
return activitypub.relays.handshake(req.body);
} else if (!['category', 'user'].includes(type)) {
throw new Error('[[error:activitypub.invalid-id]]');
}
@@ -454,7 +457,9 @@ inbox.accept = async (req) => {
const { type } = object;
const { type: localType, id } = await helpers.resolveLocalId(object.actor);
if (!['user', 'category'].includes(localType)) {
if (object.id === `${nconf.get('url')}/actor`) {
return activitypub.relays.handshake(req.body);
} else if (!['user', 'category'].includes(localType)) {
throw new Error('[[error:invalid-data]]');
}