From 1532d823845ad7786a88d4646580942310c56371 Mon Sep 17 00:00:00 2001 From: Nikola Ganchev Date: Tue, 26 Sep 2023 17:09:41 +0300 Subject: [PATCH] Use .ico favicon --- src/routes/+layout.server.js | 3 +++ src/routes/+layout.svelte | 1 + src/routes/favicon.ico/+server.js | 13 +++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 src/routes/favicon.ico/+server.js diff --git a/src/routes/+layout.server.js b/src/routes/+layout.server.js index 39388fe..18b735f 100644 --- a/src/routes/+layout.server.js +++ b/src/routes/+layout.server.js @@ -21,6 +21,9 @@ export async function load({ fetch }) { url alt } + favicon { + url + } favicons { size favicon { diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 89c85be..214f969 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -78,6 +78,7 @@ + {#each data.MainInfo.favicons as favicon} diff --git a/src/routes/favicon.ico/+server.js b/src/routes/favicon.ico/+server.js new file mode 100644 index 0000000..f2d9639 --- /dev/null +++ b/src/routes/favicon.ico/+server.js @@ -0,0 +1,13 @@ +import { env } from "$env/dynamic/public"; + +export async function GET() { + const res = await ( + await fetch(env.PUBLIC_SERVER_URL + `/api/globals/main-info`) + ).json(); + const file = await ( + await fetch(env.PUBLIC_SERVER_URL + res.favicon.url) + ).blob(); + const response = new Response(file); + response.headers.set("Content-Type", "image/x-icon"); + return response; +}