fix: actually detect rich text stuff
All checks were successful
create archive with lfs / tag (push) Successful in 9s

This commit is contained in:
dusk 2024-10-30 18:36:25 +03:00
parent 04006bda91
commit 9566e8627c
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw

View File

@ -2,6 +2,7 @@ import { env } from '$env/dynamic/private';
import { PUBLIC_BASE_URL } from '$env/static/public'; import { PUBLIC_BASE_URL } from '$env/static/public';
import { bskyClient, loginToBsky } from '$lib'; import { bskyClient, loginToBsky } from '$lib';
import { createNote } from '$lib/notes.js'; import { createNote } from '$lib/notes.js';
import { RichText } from '@atproto/api';
import { get } from 'svelte/store'; import { get } from 'svelte/store';
interface NoteData { interface NoteData {
@ -27,7 +28,14 @@ export const POST = async ({ request }) => {
client = await loginToBsky() client = await loginToBsky()
bskyClient.set(client) 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 // send back created note id
return new Response(JSON.stringify({ noteId }), { return new Response(JSON.stringify({ noteId }), {