From 9566e8627cd8724818aaa4a41756d85fe0ed16ff Mon Sep 17 00:00:00 2001 From: dusk Date: Wed, 30 Oct 2024 18:36:25 +0300 Subject: [PATCH] fix: actually detect rich text stuff --- src/routes/log/create/+server.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/routes/log/create/+server.ts b/src/routes/log/create/+server.ts index d1c1b60..9092434 100644 --- a/src/routes/log/create/+server.ts +++ b/src/routes/log/create/+server.ts @@ -2,6 +2,7 @@ import { env } from '$env/dynamic/private'; import { PUBLIC_BASE_URL } from '$env/static/public'; import { bskyClient, loginToBsky } from '$lib'; import { createNote } from '$lib/notes.js'; +import { RichText } from '@atproto/api'; import { get } from 'svelte/store'; interface NoteData { @@ -27,7 +28,14 @@ export const POST = async ({ request }) => { client = await loginToBsky() bskyClient.set(client) } - await client.post({text: `${noteData.content} (${PUBLIC_BASE_URL}/log?id=${noteId})`}) + const rt = new RichText({ + text: `${noteData.content} (${PUBLIC_BASE_URL}/log?id=${noteId})`, + }) + await rt.detectFacets(client) + await client.post({ + text: rt.text, + facets: rt.facets, + }) } // send back created note id return new Response(JSON.stringify({ noteId }), {