From c7726b652b06752e7e0b26c16b97bdb2da3e4752 Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Thu, 23 May 2024 15:59:29 -0300 Subject: [PATCH] feat: save user lud16 & website into kind 0 --- src/controllers/api/accounts.ts | 6 ++++++ src/views/mastodon/accounts.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/controllers/api/accounts.ts b/src/controllers/api/accounts.ts index 2d61adc..13ef07e 100644 --- a/src/controllers/api/accounts.ts +++ b/src/controllers/api/accounts.ts @@ -227,6 +227,8 @@ const updateCredentialsSchema = z.object({ discoverable: z.boolean().optional(), nip05: z.string().optional(), pleroma_settings_store: z.unknown().optional(), + lud16: z.string().email().optional().catch(''), + website: z.string().url().optional().catch(''), }); const updateCredentialsController: AppController = async (c) => { @@ -248,6 +250,8 @@ const updateCredentialsController: AppController = async (c) => { display_name, note, nip05, + lud16, + website, } = result.data; const [avatar, header] = await Promise.all([ @@ -260,6 +264,8 @@ const updateCredentialsController: AppController = async (c) => { meta.picture = avatar?.url ?? meta.picture; meta.banner = header?.url ?? meta.banner; meta.nip05 = nip05 ?? meta.nip05; + meta.lud16 = lud16 ?? meta.lud16; + meta.website = website ?? meta.website; const event = await createEvent({ kind: 0, diff --git a/src/views/mastodon/accounts.ts b/src/views/mastodon/accounts.ts index 69cf1db..f8294d8 100644 --- a/src/views/mastodon/accounts.ts +++ b/src/views/mastodon/accounts.ts @@ -28,6 +28,7 @@ async function renderAccount( about, lud06, lud16, + website, } = n.json().pipe(n.metadata()).catch({}).parse(event.content); const npub = nip19.npubEncode(pubkey); @@ -83,7 +84,9 @@ async function renderAccount( }, nostr: { pubkey, + lud16, }, + website, }; }