Skip to content

Commit

Permalink
Use .ico favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaGanchev committed Sep 26, 2023
1 parent 58eeaf0 commit 1532d82
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/routes/+layout.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export async function load({ fetch }) {
url
alt
}
favicon {
url
}
favicons {
size
favicon {
Expand Down
1 change: 1 addition & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
</script>

<svelte:head>
<link rel="icon" type="image/x-icon" href="/favicon.ico">
{#each data.MainInfo.favicons as favicon}
<link rel="icon" type="image/png" sizes="{favicon.size}"
href={env.PUBLIC_SERVER_URL + favicon.favicon.url} />
Expand Down
13 changes: 13 additions & 0 deletions src/routes/favicon.ico/+server.js
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 1532d82

Please sign in to comment.