This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

web: serve favicons of different colors depending on deployment location

dev: warning (orange)
next: info (blue)
prod: classic (black)
Signed-off-by: eti <eti@eti.tf>

+23 -1
+1 -1
web/src/app.html
··· 14 14 <meta name="author" content="Tangled" /> 15 15 <meta name="robots" content="index, follow" /> 16 16 <link rel="icon" href="/logos/dolly.ico" sizes="48x48" /> 17 - <link rel="icon" href="/logos/dolly.svg" sizes="any" type="image/svg+xml" /> 17 + <link rel="icon" href="/favicon.svg" sizes="any" type="image/svg+xml" /> 18 18 <link rel="apple-touch-icon" href="/logos/dolly.png" /> 19 19 <link rel="preconnect" href="https://avatar.tangled.sh" /> 20 20 <link rel="preconnect" href="https://camo.tangled.sh" />
+22
web/src/routes/favicon.svg/+server.ts
··· 1 + import { dev } from "$app/environment"; 2 + import dolly from "../../../static/logos/dolly.svg?raw"; 3 + import 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 7 + const devTint = "#d97706"; // --color-foreground-warning 8 + const nextTint = "#4338ca"; // --color-foreground-info 9 + 10 + export const prerender = false; 11 + 12 + export 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 + };