toActor: don't require the nip05
Related: https://gitlab.com/soapbox-pub/ditto/-/issues/30
This commit is contained in:
parent
8019a8d958
commit
97d2298178
|
@ -12,7 +12,7 @@ const actorController: AppController = async (c) => {
|
||||||
const event = await getAuthor(user.pubkey);
|
const event = await getAuthor(user.pubkey);
|
||||||
if (!event) return notFound(c);
|
if (!event) return notFound(c);
|
||||||
|
|
||||||
const actor = await toActor(event);
|
const actor = await toActor(event, user.username);
|
||||||
if (!actor) return notFound(c);
|
if (!actor) return notFound(c);
|
||||||
|
|
||||||
return activityJson(c, actor);
|
return activityJson(c, actor);
|
||||||
|
|
|
@ -6,13 +6,9 @@ import type { Event } from '@/event.ts';
|
||||||
import type { Actor } from '@/schemas/activitypub.ts';
|
import type { Actor } from '@/schemas/activitypub.ts';
|
||||||
|
|
||||||
/** Nostr metadata event to ActivityPub actor. */
|
/** Nostr metadata event to ActivityPub actor. */
|
||||||
async function toActor(event: Event<0>): Promise<Actor | undefined> {
|
async function toActor(event: Event<0>, username: string): Promise<Actor | undefined> {
|
||||||
const content = parseMetaContent(event);
|
const content = parseMetaContent(event);
|
||||||
|
|
||||||
if (!content.nip05) return;
|
|
||||||
const [username, hostname] = content.nip05.split('@');
|
|
||||||
if (hostname !== Conf.url.hostname) return;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'Person',
|
type: 'Person',
|
||||||
id: Conf.local(`/users/${username}`),
|
id: Conf.local(`/users/${username}`),
|
||||||
|
|
Loading…
Reference in New Issue