diff --git a/src/server.ts b/src/server.ts index 1ae8fc7..bb1841c 100644 --- a/src/server.ts +++ b/src/server.ts @@ -5,6 +5,21 @@ import { serveStatic } from "hono/bun"; const app = new Hono(); +app.options("*", (c) => + c.text("", 204, { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET, HEAD, OPTIONS", + "Access-Control-Allow-Headers": "Content-Type, Authorization", + }), +); + +app.use("*", async (c, next) => { + await next(); + c.header("Access-Control-Allow-Origin", "*"); + c.header("Access-Control-Allow-Methods", "GET, HEAD, OPTIONS"); + c.header("Access-Control-Allow-Headers", "Content-Type, Authorization"); +}); + const cssDir = "css"; const templatePath = join("public", "index.html"); const cardPlaceholder = ""; @@ -145,13 +160,21 @@ const buildFontCatalog = async () => { String(weightRange?.max ?? ""), )}" data-weight-step="10">\n
\n \n ${ + weightRange + ? `\n ` + : `` + }\n
\n The quick brown fox jumps over the lazy dog.\n
\n