feat: save user lud16 & website into kind 0

This commit is contained in:
P. Reis 2024-05-23 15:59:29 -03:00
parent e06dda4014
commit c7726b652b
2 changed files with 9 additions and 0 deletions

View File

@ -227,6 +227,8 @@ const updateCredentialsSchema = z.object({
discoverable: z.boolean().optional(), discoverable: z.boolean().optional(),
nip05: z.string().optional(), nip05: z.string().optional(),
pleroma_settings_store: z.unknown().optional(), pleroma_settings_store: z.unknown().optional(),
lud16: z.string().email().optional().catch(''),
website: z.string().url().optional().catch(''),
}); });
const updateCredentialsController: AppController = async (c) => { const updateCredentialsController: AppController = async (c) => {
@ -248,6 +250,8 @@ const updateCredentialsController: AppController = async (c) => {
display_name, display_name,
note, note,
nip05, nip05,
lud16,
website,
} = result.data; } = result.data;
const [avatar, header] = await Promise.all([ const [avatar, header] = await Promise.all([
@ -260,6 +264,8 @@ const updateCredentialsController: AppController = async (c) => {
meta.picture = avatar?.url ?? meta.picture; meta.picture = avatar?.url ?? meta.picture;
meta.banner = header?.url ?? meta.banner; meta.banner = header?.url ?? meta.banner;
meta.nip05 = nip05 ?? meta.nip05; meta.nip05 = nip05 ?? meta.nip05;
meta.lud16 = lud16 ?? meta.lud16;
meta.website = website ?? meta.website;
const event = await createEvent({ const event = await createEvent({
kind: 0, kind: 0,

View File

@ -28,6 +28,7 @@ async function renderAccount(
about, about,
lud06, lud06,
lud16, lud16,
website,
} = n.json().pipe(n.metadata()).catch({}).parse(event.content); } = n.json().pipe(n.metadata()).catch({}).parse(event.content);
const npub = nip19.npubEncode(pubkey); const npub = nip19.npubEncode(pubkey);
@ -83,7 +84,9 @@ async function renderAccount(
}, },
nostr: { nostr: {
pubkey, pubkey,
lud16,
}, },
website,
}; };
} }