fix(onboarding): fallback to CDN icon URL when icons table is empty

During fresh onboarding the icons DB table hasn't been populated by the
cron job yet. Fall back to a dashboard-icons CDN URL guess based on
the container image name so apps still get icons for popular services.
This commit is contained in:
Thomas Camlong committed 2026-05-27 16:28:04 +02:00
1 parent d571396fba
commit 460875345b
1 file changed
+5 -1
@@ -185,10 +185,14 @@ export const onboardRouter = createTRPCRouter({
const discoveredIntegrations = emptyResult.integrations;
const discoveredApps = emptyResult.apps;
const cdnIconUrl = (slug: string) =>
`https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/${slug}.svg`;
for (const container of containers) {
const imageName = extractContainerImageName(container.Image);
const containerName = container.Names[0]?.split("/")[1] ?? "Unknown";
const iconUrl = bestMatch(imageName, dbIcons, (icon) => icon.name)?.url ?? null;
const iconUrl =
bestMatch(imageName, dbIcons, (icon) => icon.name)?.url ?? cdnIconUrl(imageName.toLowerCase());
const { url: suggestedUrl, publishedPort } = buildSuggestedUrl(container.Ports, container.host);