Skip to content

Use the HACS repository icon endpoint for dashboard icons#945

Open
Niek wants to merge 3 commits into
hacs:mainfrom
Niek:repository-brand-icons
Open

Use the HACS repository icon endpoint for dashboard icons#945
Niek wants to merge 3 commits into
hacs:mainfrom
Niek:repository-brand-icons

Conversation

@Niek

@Niek Niek commented Jul 15, 2026

Copy link
Copy Markdown

Proposed change

Uses the repository icon endpoint provided by hacs/integration#5388 for integration rows instead of relying only on the public brands CDN.

Since Home Assistant 2026.3, custom integrations ship brand icons inside the repository (custom_components/<domain>/brand/), and home-assistant/brands no longer accepts images for custom integrations. The CDN URLs used today therefore show placeholders for integrations that are not grandfathered in.

This change:

  • obtains Home Assistant's rotating brands access token through brands/access_token and refreshes it every 30 minutes;
  • includes the token in same-origin HACS icon URLs and keeps referrerpolicy="no-referrer";
  • uses dark_icon.png in dark mode and icon.png otherwise;
  • falls back to the existing brands CDN URL if the token command is unavailable (for older Home Assistant versions), the repository has no domain, or the HACS endpoint fails to load;
  • keeps the icon decorative with alt="".

Requires hacs/integration#5388.

Release follow-up

The integration currently pins frontend release 20250128065759 in scripts/install/frontend. After both PRs merge, a new frontend release must be published and that pin must be bumped before the integration release. Until then, merging this PR alone does not ship the frontend change to HACS users.

Related issues and PRs: hacs/integration#5171, hacs/integration#5179, hacs/integration#5223, and earlier installed-only approaches #937 / #929.

Verification

  • Prettier passes for src/dashboards/hacs-dashboard.ts.
  • Full dependency-based build: blocked before compilation because the repository pins the unavailable tsparticles-preset-links@2.12.0 package; the same dependency is present on main.

Point integration icons at /api/hacs/repository/{id}/icon.png served by
the HACS integration, instead of the public brands CDN which no longer
accepts images for custom integrations. Repositories without a domain
keep the CDN placeholder fallback.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates how HACS dashboard repository icons are resolved, switching integration icons to the HACS backend’s repository icon endpoint so icons can be served from each repository’s bundled brand/ assets (with backend caching/redirect behavior), instead of relying on the public brands CDN which no longer accepts new custom-integration images.

Changes:

  • Use /api/hacs/repository/{id}/{icon|dark_icon}.png for integration repository icons when a domain exists.
  • Keep the existing brandsUrl(...) fallback path for repositories without a domain.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/dashboards/hacs-dashboard.ts Outdated
Comment thread src/dashboards/hacs-dashboard.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants