This repository has no description
1import { dev } from "$app/environment";
2import dolly from "../../../static/logos/dolly.svg?raw";
3import type { RequestHandler } from "./$types";
4
5// the logo is monochrome and tracks the color scheme, so we repaint the favicon
6// per environment to tell a local or next tab apart from production at a glance
7const devTint = "#d97706"; // --color-foreground-warning
8const nextTint = "#4338ca"; // --color-foreground-info
9
10export const prerender = false;
11
12export const GET: RequestHandler = ({ url }) => {
13 const tint = dev ? devTint : url.hostname === "next.tangled.org" ? nextTint : null;
14 const svg = tint ? dolly.replace(/color:\s*#[0-9a-f]{3,8};/gi, `color: ${tint};`) : dolly;
15
16 return new Response(svg, {
17 headers: {
18 "content-type": "image/svg+xml",
19 "cache-control": dev ? "no-store" : "public, max-age=3600"
20 }
21 });
22};