From 97d2298178592acf6c6cb014876d74220073dafd Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 27 Jul 2023 13:27:53 -0500 Subject: [PATCH] toActor: don't require the nip05 Related: https://gitlab.com/soapbox-pub/ditto/-/issues/30 --- src/controllers/activitypub/actor.ts | 2 +- src/transformers/nostr-to-activitypub.ts | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/controllers/activitypub/actor.ts b/src/controllers/activitypub/actor.ts index 8d09255..5d78609 100644 --- a/src/controllers/activitypub/actor.ts +++ b/src/controllers/activitypub/actor.ts @@ -12,7 +12,7 @@ const actorController: AppController = async (c) => { const event = await getAuthor(user.pubkey); if (!event) return notFound(c); - const actor = await toActor(event); + const actor = await toActor(event, user.username); if (!actor) return notFound(c); return activityJson(c, actor); diff --git a/src/transformers/nostr-to-activitypub.ts b/src/transformers/nostr-to-activitypub.ts index 82f328d..ae7ea77 100644 --- a/src/transformers/nostr-to-activitypub.ts +++ b/src/transformers/nostr-to-activitypub.ts @@ -6,13 +6,9 @@ import type { Event } from '@/event.ts'; import type { Actor } from '@/schemas/activitypub.ts'; /** Nostr metadata event to ActivityPub actor. */ -async function toActor(event: Event<0>): Promise { +async function toActor(event: Event<0>, username: string): Promise { const content = parseMetaContent(event); - if (!content.nip05) return; - const [username, hostname] = content.nip05.split('@'); - if (hostname !== Conf.url.hostname) return; - return { type: 'Person', id: Conf.local(`/users/${username}`),