tangled
alpha
login
or
join now
flo-bit.dev
/
blento
21
fork
atom
your personal website on atproto - mirror
blento.app
21
fork
atom
overview
issues
pulls
pipelines
fix og image
Florian
1 month ago
654542f5
0f13dc4b
+11
-4
1 changed file
expand all
collapse all
unified
split
src
routes
[handle=handle]
og.png
+server.ts
+11
-4
src/routes/[handle=handle]/og.png/+server.ts
···
1
1
+
import { getCDNImageBlobUrl } from '$lib/atproto/methods.js';
1
2
import type { UserCache } from '$lib/types';
2
3
import { loadData } from '$lib/website/load';
3
4
import type { Handle } from '@atcute/lexicons';
5
5
+
import { isDid } from '@atcute/lexicons/syntax';
4
6
import { ImageResponse } from '@ethercorps/sveltekit-og';
5
7
6
8
function escapeHtml(str: string): string {
···
13
15
}
14
16
15
17
export async function GET({ params, platform }) {
16
16
-
const handle = params.handle;
17
17
-
18
18
const cache = platform?.env?.USER_DATA_CACHE as unknown;
19
19
20
20
const data = await loadData(params.handle as Handle, cache as UserCache);
21
21
22
22
-
const image = data.profile.avatar;
22
22
+
let image: string | undefined = data.profile.avatar;
23
23
+
24
24
+
if (data.publication.icon) {
25
25
+
image =
26
26
+
getCDNImageBlobUrl({ did: data.did, blob: data.publication.icon }) ?? data.profile.avatar;
27
27
+
}
28
28
+
29
29
+
const name = data.publication?.name ?? data.profile.displayName ?? data.profile.handle;
23
30
24
31
const htmlString = `
25
32
<div class="flex flex-col p-8 w-full h-full bg-neutral-900">
26
33
<div class="flex items-center mb-8 mt-16">
27
34
<img src="${escapeHtml(image ?? '')}" width="128" height="128" class="rounded-full" />
28
35
29
29
-
<h1 class="text-neutral-50 text-7xl ml-4">${escapeHtml(handle)}</h1>
36
36
+
<h1 class="text-neutral-50 text-7xl ml-4">${escapeHtml(name)}</h1>
30
37
</div>
31
38
32
39
<p class="mt-8 text-4xl text-neutral-300">Check out my blento</p>