Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
patsissons committed Feb 17, 2024
1 parent b6adfa7 commit 94bf834
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions src/routes/og/[token_id]/+server.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
import { ImageResponse } from '@ethercorps/sveltekit-og'
// import { ImageResponse } from '@ethercorps/sveltekit-og'
import { loadTokenData } from '../../token/[id]/data'
import type { RequestHandler } from './$types'
import { error } from '@sveltejs/kit'
import OgToken from './og-token.svelte'
import inter400 from '@fontsource/inter/files/inter-latin-400-normal.woff'
import inter600 from '@fontsource/inter/files/inter-latin-600-normal.woff'
import robotoMono400 from '@fontsource/roboto-mono/files/roboto-mono-latin-400-normal.woff'
// import OgToken from './og-token.svelte'
// import inter400 from '@fontsource/inter/files/inter-latin-400-normal.woff'
// import inter600 from '@fontsource/inter/files/inter-latin-600-normal.woff'
// import robotoMono400 from '@fontsource/roboto-mono/files/roboto-mono-latin-400-normal.woff'

export const GET: RequestHandler = async ({ params: { token_id }, fetch }) => {
const props = await loadTokenData(token_id, fetch)
if (!props.token) throw error(404, 'Token not found')

return new ImageResponse(
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
OgToken as any,
{
width: 1200,
height: 630,
fonts: [
{
name: 'sans-serif',
data: await fetch(inter400).then((res) => res.arrayBuffer()),
weight: 400,
},
{
name: 'sans-serif',
data: await fetch(inter600).then((res) => res.arrayBuffer()),
weight: 600,
},
{
name: 'monospace',
data: await fetch(robotoMono400).then((res) => res.arrayBuffer()),
weight: 400,
},
],
},
props,
)
return new Response('testing', { status: 200 })

// return new ImageResponse(
// // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
// OgToken as any,
// {
// width: 1200,
// height: 630,
// fonts: [
// {
// name: 'sans-serif',
// data: await fetch(inter400).then((res) => res.arrayBuffer()),
// weight: 400,
// },
// {
// name: 'sans-serif',
// data: await fetch(inter600).then((res) => res.arrayBuffer()),
// weight: 600,
// },
// {
// name: 'monospace',
// data: await fetch(robotoMono400).then((res) => res.arrayBuffer()),
// weight: 400,
// },
// ],
// },
// props,
// )
}

0 comments on commit 94bf834

Please sign in to comment.