This commit is contained in:
Rizky 2023-11-15 23:17:51 +07:00
parent eb1b38bca6
commit 81bf55ca5c
1 changed files with 15 additions and 0 deletions

15
app/srv/api/font.ts Normal file
View File

@ -0,0 +1,15 @@
import { apiContext } from "service-srv";
export const _ = {
url: "/_font/**",
async api() {
const { req } = apiContext(this);
const pathname = req.url.split("/_font").pop();
const f = await fetch(`https://fonts.googleapis.com${pathname}`);
const body = await f.arrayBuffer();
const res = new Response(body);
res.headers.set("content-type", f.headers.get("content-type") || "");
return res;
},
};