Neue Gruppe "Logo und Favicon" unter Admin > Inhalte mit drei Bildfeldern: Logo (Kopfzeile), optionales Logo fuer dunkle Flaechen (Mobilmenue, Fusszeile, Admin-Leiste; faellt sonst auf das normale Logo zurueck) und Favicon. Leer bleibt alles wie bisher (gezeichnetes Waben-Zeichen bzw. Standard-Icon). - lib/brand.ts liest die Pfade und prueft sie erneut gegen das Upload-Muster, bevor sie in ein src-Attribut gelangen. - Statische app/icon.svg und app/favicon.ico ersetzt durch dynamische app/icon.tsx (512 px PNG) und app/apple-icon.tsx (180 px auf Creme); lib/brand-icon.ts rendert Upload oder Standard-Icon per sharp und liest Dateien nur ueber resolveUploadPath. Cache-Control no-cache, damit ein neues Favicon ohne Tage Verzoegerung erscheint. - /favicon.ico per Rewrite auf /icon, Manifest nutzt /icon. - Hochgeladenes Logo mit fester Hoehe und begrenzter Breite (Kopfzeile mobil 56 px, ab sm 112 px), damit breite Wortmarken nichts sprengen. Uploads bleiben auf Rasterbilder beschraenkt (kein SVG, XSS-Schutz). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
24 lines
957 B
TypeScript
24 lines
957 B
TypeScript
import { getBrandAssets } from "@/lib/brand";
|
|
import { renderBrandIcon } from "@/lib/brand-icon";
|
|
|
|
export const size = { width: 180, height: 180 };
|
|
export const contentType = "image/png";
|
|
|
|
// Wie app/icon.tsx: im Admin austauschbar, deshalb nicht zur Build-Zeit festschreiben.
|
|
export const dynamic = "force-dynamic";
|
|
|
|
/**
|
|
* Apple-Touch-Icon fuer "Zum Home-Bildschirm hinzufuegen" auf iOS/iPadOS —
|
|
* Apple akzeptiert dafuer ausschliesslich PNG/JPG, kein SVG. Ohne diese
|
|
* Datei nimmt iOS ersatzweise einen Screenshot der Seite als Icon. Gleiche
|
|
* Quelle wie das Favicon, aber auf Creme-Grund: iOS stellt transparente
|
|
* Flaechen schwarz dar.
|
|
*/
|
|
export default async function AppleIcon(): Promise<Response> {
|
|
const { favicon } = await getBrandAssets();
|
|
const png = await renderBrandIcon(favicon, size.width, "#FAF8F3");
|
|
return new Response(new Uint8Array(png), {
|
|
headers: { "Content-Type": contentType, "Cache-Control": "no-cache" },
|
|
});
|
|
}
|