pages cfw

This commit is contained in:
Shivam Meena
2023-10-05 09:01:20 +05:30
parent 8385ef770c
commit b2c5bc1633
2 changed files with 2 additions and 28 deletions

View File

@@ -19,19 +19,7 @@ const template = `
</div> </div>
</div> </div>
`; `;
const fontFile = await fetch('https://og-playground.vercel.app/inter-latin-ext-400-normal.woff');
const fontData: ArrayBuffer = await fontFile.arrayBuffer();
export const GET: RequestHandler = async () => { export const GET: RequestHandler = async () => {
return ImageResponse(template, { return ImageResponse(template);
height: 400,
width: 800,
fonts: [
{
name: 'Inter',
data: fontData,
weight: 400
}
]
});
}; };

View File

@@ -2,23 +2,9 @@ import OG from './OG.svelte';
import type { RequestHandler } from '@sveltejs/kit'; import type { RequestHandler } from '@sveltejs/kit';
import { componentToImageResponse } from '@ethercorps/sveltekit-og'; import { componentToImageResponse } from '@ethercorps/sveltekit-og';
const fontFile = await fetch('https://og-playground.vercel.app/inter-latin-ext-700-normal.woff');
const fontData: ArrayBuffer = await fontFile.arrayBuffer();
export const GET: RequestHandler = async () => { export const GET: RequestHandler = async () => {
return componentToImageResponse( return componentToImageResponse(
OG, OG,
{ text: 'Ready to dive in?', spanText: 'Start your free trial today.' }, { text: 'Ready to dive in?', spanText: 'Start your free trial today.' }
{
height: 250,
width: 500,
fonts: [
{
name: 'Inter Latin',
data: fontData,
weight: 700
}
]
}
); );
}; };