From 9c4301e7915498774fb92c4e7997e603c07cba56 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 2 Mar 2024 18:08:37 -0600 Subject: [PATCH] getConfigs: wrap in try-catch --- src/controllers/api/pleroma.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/controllers/api/pleroma.ts b/src/controllers/api/pleroma.ts index f76df01..9425878 100644 --- a/src/controllers/api/pleroma.ts +++ b/src/controllers/api/pleroma.ts @@ -72,9 +72,12 @@ async function getConfigs(signal: AbortSignal): Promise { limit: 1, }], { signal }); - return jsonSchema.pipe(configSchema.array()).catch([]).parse( - await new AdminSigner().nip44.decrypt(Conf.pubkey, event.content).catch(() => ''), - ); + try { + const decrypted = await new AdminSigner().nip44.decrypt(Conf.pubkey, event.content); + return jsonSchema.pipe(configSchema.array()).catch([]).parse(decrypted); + } catch (_e) { + return []; + } } export { configController, frontendConfigController, pleromaAdminDeleteStatusController, updateConfigController };