diff --git a/apps/docs/docs/integrations/docker-labels/index.mdx b/apps/docs/docs/integrations/docker-labels/index.mdx index 377116020..d5ed8990b 100644 --- a/apps/docs/docs/integrations/docker-labels/index.mdx +++ b/apps/docs/docs/integrations/docker-labels/index.mdx @@ -67,6 +67,15 @@ When `homarr.name` is absent, onboarding also understands these Homepage labels: `homepage.name` and `homepage.href` are required for the fallback. Homarr does not combine partial Homarr metadata with Homepage metadata: once `homarr.name` is present, use `homarr.*` labels for the remaining fields too. +Homepage Dashboard Icons keys such as `sonarr` or `jellyfin.svg` are converted to full icon URLs. Keys are lowercased +to match published filenames. Bare keys use PNG; +`.png`, `.svg`, and `.webp` select the corresponding format. Explicit URLs and local paths are preserved. Homepage's +`mdi-`, `si-`, and `sh-` icon prefixes are not converted; use a full icon URL for those sets. Local paths must also be +available on the Homarr server. `homarr.icon` continues to accept an icon URL. + +This applies to new onboarding imports. For apps already imported with broken icons, change their icons in app +management. + ## What onboarding creates In **Connect**, label-discovered apps and integrations appear before image-based suggestions. You can import multiple diff --git a/packages/docker/src/discovery/parse-container-labels.spec.ts b/packages/docker/src/discovery/parse-container-labels.spec.ts index 22f4dbd2b..69b290375 100644 --- a/packages/docker/src/discovery/parse-container-labels.spec.ts +++ b/packages/docker/src/discovery/parse-container-labels.spec.ts @@ -55,7 +55,7 @@ describe("parseContainerLabels", () => { name: "Jellyfin", group: "Media", href: "http://jellyfin:8096", - icon: "jellyfin.svg", + icon: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/jellyfin.svg", }); }); diff --git a/packages/docker/src/discovery/parse-container-labels.ts b/packages/docker/src/discovery/parse-container-labels.ts index 56510edbd..0fbba478f 100644 --- a/packages/docker/src/discovery/parse-container-labels.ts +++ b/packages/docker/src/discovery/parse-container-labels.ts @@ -25,6 +25,21 @@ const resolveLabelValue = ( useHomepageFallback: boolean, ) => readLabel(labels, homarrKey) ?? (useHomepageFallback ? readLabel(labels, homepageKey) : undefined); +const resolveIcon = (labels: Record, useHomepageFallback: boolean) => { + const homarrIcon = readLabel(labels, dockerLabels.icon); + if (homarrIcon || !useHomepageFallback) return homarrIcon; + + const homepageIcon = readLabel(labels, homepageLabels.icon); + if (!homepageIcon || /^(mdi|si|sh)-/.test(homepageIcon)) return homepageIcon; + + // Homepage's Dashboard Icons keys default to PNG; URLs and local paths pass through. + const dashboardIcon = /^([a-zA-Z0-9][a-zA-Z0-9_-]*)(?:\.(png|svg|webp))?$/.exec(homepageIcon); + if (!dashboardIcon?.[1]) return homepageIcon; + + const extension = dashboardIcon[2] ?? "png"; + return `https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/${extension}/${dashboardIcon[1].toLowerCase()}.${extension}`; +}; + const parseIntegrationKind = (value: string | undefined): IntegrationKind | undefined => value && integrationKindSet.has(value) ? (value as IntegrationKind) : undefined; @@ -57,7 +72,7 @@ export const parseContainerLabels = ( group, name, href, - icon: resolveLabelValue(labels, dockerLabels.icon, homepageLabels.icon, useHomepageFallback), + icon: resolveIcon(labels, useHomepageFallback), description: resolveLabelValue(labels, dockerLabels.description, homepageLabels.description, useHomepageFallback), pingUrl: readLabel(labels, dockerLabels.ping), externalId,