From 4862181d61771ff0f91c1d29134ce1718684f820 Mon Sep 17 00:00:00 2001 From: Peaceultime Date: Wed, 10 Dec 2025 20:57:55 +0100 Subject: [PATCH] Fix registration email and markdown parser singleton --- app/composables/useMarkdown.ts | 12 ++++++------ server/api/auth/register.post.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/composables/useMarkdown.ts b/app/composables/useMarkdown.ts index a9ad8ce..fd1a70c 100644 --- a/app/composables/useMarkdown.ts +++ b/app/composables/useMarkdown.ts @@ -18,7 +18,7 @@ interface Parser } export default function useMarkdown(): Parser { - let processor: Processor, processorSync: Processor; + let processor: Processor, processorText: Processor; const parse = (markdown: string) => { if (!processor) @@ -43,14 +43,14 @@ export default function useMarkdown(): Parser } const text = (markdown: string) => { - if (!processor) + if (!processorText) { - processor = unified().use([RemarkParse, RemarkGfm, RemarkOfm, RemarkBreaks, RemarkFrontmatter ]); - processor.use(StripMarkdown, { remove: [ 'comment', 'tag', 'callout' ] }); - processor.use(RemarkStringify); + processorText = unified().use([RemarkParse, RemarkGfm, RemarkOfm, RemarkBreaks, RemarkFrontmatter ]); + processorText.use(StripMarkdown, { remove: [ 'comment', 'tag', 'callout' ] }); + processorText.use(RemarkStringify); } - const processed = processor.processSync(markdown); + const processed = processorText.processSync(markdown); return String(processed); } diff --git a/server/api/auth/register.post.ts b/server/api/auth/register.post.ts index dce0d35..4b95569 100644 --- a/server/api/auth/register.post.ts +++ b/server/api/auth/register.post.ts @@ -90,7 +90,7 @@ export default defineEventHandler(async (e): Promise => { template: 'registration', data: { id: emailId, timestamp, - userId: id, + userId: id.id, username: body.data.username, }, }