From 307090e32fb205ff18ee7ff203a7b3260f683455 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 24 May 2024 13:09:32 -0500 Subject: [PATCH] updateCredentialsController: stricter validation, support bot field --- src/controllers/api/accounts.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/controllers/api/accounts.ts b/src/controllers/api/accounts.ts index 13ef07e..9600f05 100644 --- a/src/controllers/api/accounts.ts +++ b/src/controllers/api/accounts.ts @@ -225,10 +225,10 @@ const updateCredentialsSchema = z.object({ locked: z.boolean().optional(), bot: z.boolean().optional(), discoverable: z.boolean().optional(), - nip05: z.string().optional(), + nip05: z.string().email().optional(), pleroma_settings_store: z.unknown().optional(), - lud16: z.string().email().optional().catch(''), - website: z.string().url().optional().catch(''), + lud16: z.string().email().optional(), + website: z.string().url().optional(), }); const updateCredentialsController: AppController = async (c) => { @@ -252,6 +252,7 @@ const updateCredentialsController: AppController = async (c) => { nip05, lud16, website, + bot, } = result.data; const [avatar, header] = await Promise.all([ @@ -266,6 +267,7 @@ const updateCredentialsController: AppController = async (c) => { meta.nip05 = nip05 ?? meta.nip05; meta.lud16 = lud16 ?? meta.lud16; meta.website = website ?? meta.website; + meta.bot = bot ?? meta.bot; const event = await createEvent({ kind: 0,