fix(docker): resolve Homepage Dashboard Icons keys (#7004)
This commit is contained in:
1 parent
c1dd2b3bca
commit
d15987c9fb
3 files changed
+26
-2
No files matched your search
@@ -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
|
||||
|
||||
@@ -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",
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -25,6 +25,21 @@ const resolveLabelValue = (
|
||||
useHomepageFallback: boolean,
|
||||
) => readLabel(labels, homarrKey) ?? (useHomepageFallback ? readLabel(labels, homepageKey) : undefined);
|
||||
|
||||
const resolveIcon = (labels: Record<string, string>, 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,
|
||||
|
||||
Reference in new issue
Block a user