mirror of
https://github.com/bartvdbraak/hellob.art.git
synced 2025-06-28 07:19:09 +00:00
fix: use inlining based on filename
This commit is contained in:
parent
ecc83f4a4f
commit
aa8fb480d0
3 changed files with 6 additions and 40 deletions
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
|
@ -4,32 +4,16 @@ import { html as toReactNode } from 'satori-html';
|
|||
import { OgImage } from '$lib/components/site';
|
||||
import GeistRegular from '$lib/assets/og/Geist-Regular.woff';
|
||||
import GeistBold from '$lib/assets/og/Geist-Bold.woff';
|
||||
import imageData from '$lib/assets/og/me.jpg?base64';
|
||||
// import { readFile } from 'fs/promises';
|
||||
// import path from 'path';
|
||||
import imageData from '$lib/assets/og/me-inline.jpg';
|
||||
|
||||
const height = 630;
|
||||
const width = 1200;
|
||||
|
||||
// const getImageData = async () => {
|
||||
// // try {
|
||||
// const imagePath = path.join(process.cwd(), Me);
|
||||
// const meImage = await readFile(imagePath);
|
||||
// return Buffer.from(meImage).toString('base64');
|
||||
// // } catch (error) {
|
||||
// // console.error('Error reading image:', error);
|
||||
// // throw error;
|
||||
// // }
|
||||
// };
|
||||
|
||||
/** @type {import('./$types').RequestHandler} */
|
||||
export const GET = async ({ url }) => {
|
||||
// try {
|
||||
const title = url.searchParams.get('title') ?? undefined;
|
||||
const subTitle = url.searchParams.get('subTitle') ?? undefined;
|
||||
|
||||
// const imageData = await getImageData();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const result = (OgImage as any).render({ title, subTitle, imageData });
|
||||
const element = toReactNode(`${result.html}<style>${result.css.code}</style>`);
|
||||
|
@ -66,13 +50,4 @@ export const GET = async ({ url }) => {
|
|||
'cache-control': 'public, max-age=86400, immutable'
|
||||
}
|
||||
});
|
||||
// } catch (error) {
|
||||
// console.error('Error generating image:', error);
|
||||
// return new Response('Internal Server Error', {
|
||||
// status: 500,
|
||||
// headers: {
|
||||
// 'content-type': 'text/plain'
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue