diff --git a/og-image/api/_lib/template.ts b/og-image/api/_lib/template.ts index 8d89a3cf..04430162 100644 --- a/og-image/api/_lib/template.ts +++ b/og-image/api/_lib/template.ts @@ -1,4 +1,3 @@ -import { readFileSync } from "fs"; import marked from "marked"; import { sanitizeHtml } from "./sanitizer"; import { ParsedRequest } from "./types"; @@ -6,16 +5,6 @@ const twemoji = require("twemoji"); const twOptions = { folder: "svg", ext: ".svg" }; const emojify = (text: string) => twemoji.parse(text, twOptions); -const rglr = readFileSync( - `${__dirname}/../_fonts/Inter-Regular.woff2` -).toString("base64"); -const bold = readFileSync(`${__dirname}/../_fonts/Inter-Bold.woff2`).toString( - "base64" -); -const mono = readFileSync(`${__dirname}/../_fonts/Vera-Mono.woff2`).toString( - "base64" -); - function getCss(theme: string, fontSize: string) { let background = "white"; let foreground = "black"; @@ -30,27 +19,6 @@ function getCss(theme: string, fontSize: string) { return ` @import url('https://fonts.googleapis.com/css2?family=Major+Mono+Display&family=Readex+Pro:wght@400;700&display=swap'); - @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: normal; - src: url(data:font/woff2;charset=utf-8;base64,${rglr}) format('woff2'); - } - - @font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: bold; - src: url(data:font/woff2;charset=utf-8;base64,${bold}) format('woff2'); - } - - @font-face { - font-family: 'Vera'; - font-style: normal; - font-weight: normal; - src: url(data:font/woff2;charset=utf-8;base64,${mono}) format("woff2"); - } - body { background: ${background}; background-image: radial-gradient(circle at 25px 25px, ${radial} 2%, transparent 0%), radial-gradient(circle at 75px 75px, ${radial} 2%, transparent 0%); @@ -115,15 +83,18 @@ export function getHtml(parsedReq: ParsedRequest) { const { text, theme, md, fontSize, images, widths, heights } = parsedReq; return ` - -
Helloz World
+