-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6adfa7
commit 7423378
Showing
2 changed files
with
34 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
// ) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters