import { createHash } from "node:crypto"; export type IconGroesse = "180" | "192" | "512" | "512-maskable"; export type IconBranding = { id: string; name: string; logo_pfad: string | null; app_icon_pfad: string | null; farbe_primaer: string | null; }; export function iconVersion(f: IconBranding | null): string { if (!f) return "standard"; const roh = [f.name, f.logo_pfad, f.app_icon_pfad, f.farbe_primaer].map((v) => v ?? "").join("|"); return createHash("sha1").update(roh).digest("hex").slice(0, 10); } export function iconUrl(f: IconBranding | null, groesse: IconGroesse): string { return `/app-icon/${f ? f.id : "standard"}/${iconVersion(f)}/${groesse}.png`; }