refactor(init): avoid network request for downloading of favicon (#2867)

This commit is contained in:
Asher Gomez
2025-04-28 15:10:03 +02:00
committed by GitHub
parent 7aec5a268e
commit d077130b05
+6 -8
View File
@@ -391,14 +391,12 @@ ${GRADIENT_CSS}`;
<path d="M14.297 16.49c.985-.747 1.644-1.01 2.099-2.526.566.121.841-.08 1.29-.701.324.466 1.657.608 2.453.701-.715.451-1.057.852-1.452 2.106-1.464-.611-3.167-.302-4.39.42Z" fill="#fff"/>
</svg>`;
await writeFile("static/logo.svg", STATIC_LOGO);
try {
const res = await fetch("https://fresh.deno.dev/favicon.ico");
const buf = await res.arrayBuffer();
await writeFile("static/favicon.ico", new Uint8Array(buf));
} catch {
// Skip this and be silent if there is a network issue.
}
await writeFile(
"static/favicon.ico",
await Deno.readFile(
new URL(import.meta.resolve("../../www/static/favicon.ico")),
),
);
const MAIN_TS = `import { App, fsRoutes, staticFiles } from "fresh";
import { define, type State } from "./utils.ts";