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 04bb1a6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 32 deletions.
3 changes: 2 additions & 1 deletion src/lib/components/Seo/seo.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import type { POAPEventMetadata } from '$lib/types/poap'
const baseUrl = 'https://vpoap.vercel.app'
// const baseUrl = 'https://vpoap.vercel.app'
const baseUrl = 'https://vpoap-git-opengraph-goldsky.vercel.app'
const title = 'Visual POAP'
const description = 'Watch POAP mints live!'
Expand Down
63 changes: 33 additions & 30 deletions src/routes/og/[token_id]/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,42 @@ 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('<div style="display: flex">testing</div>')

// 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,
// )
}
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
},
build: {
rollupOptions: {
external: ['@resvg/resvg-js'],
external: ['@napi-rs/canvas', '@resvg/resvg-js'],
},
},
})

0 comments on commit 04bb1a6

Please sign in to comment.