From 3bbb437e7b3c92c42fec9c4b728f2515e2c8d6fd Mon Sep 17 00:00:00 2001 From: manuveli Date: Sat, 18 Apr 2026 22:03:15 +0200 Subject: [PATCH] Use authenticated brands proxy for repository icons The dashboard constructed icon URLs via the upstream `brandsUrl` helper at a pinned submodule (3ffbd435, Jan 2025) that predates the brands-proxy API introduced in HA 2026.3. After upstream rewrote `brands-url.ts` to return `/api/brands/integration/{domain}/icon.png` with an access token, custom integrations shipping inline brand assets no longer render (the legacy CDN no longer accepts new custom integration submissions). Bump `homeassistant-frontend` to current master, drop the now-removed `useFallback` parameter, and fetch/schedule the brands access token from the dashboard's own bundle (module-level token state is bundle-scoped, so HACS must populate its own copy). Clear the refresh interval on disconnect. Fixes hacs/integration#5171 Fixes hacs/integration#5223 Co-Authored-By: Claude Opus 4.7 --- homeassistant-frontend | 2 +- src/dashboards/hacs-dashboard.ts | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/homeassistant-frontend b/homeassistant-frontend index 3ffbd435..f7e92b48 160000 --- a/homeassistant-frontend +++ b/homeassistant-frontend @@ -1 +1 @@ -Subproject commit 3ffbd435e0e5cf23872057187f3da53bb62441a2 +Subproject commit f7e92b484a487efc7c5b70963e68b3de14e2b6ed diff --git a/src/dashboards/hacs-dashboard.ts b/src/dashboards/hacs-dashboard.ts index a42c4bb4..a440554b 100644 --- a/src/dashboards/hacs-dashboard.ts +++ b/src/dashboards/hacs-dashboard.ts @@ -10,7 +10,7 @@ import { mdiInformation, mdiNewBox, } from "@mdi/js"; -import type { CSSResultGroup, TemplateResult } from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import { LitElement, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoize from "memoize-one"; @@ -39,7 +39,11 @@ import "../../homeassistant-frontend/src/components/ha-svg-icon"; import { PageNavigation } from "../../homeassistant-frontend/src/layouts/hass-tabs-subpage"; import { haStyle } from "../../homeassistant-frontend/src/resources/styles"; import type { HomeAssistant, Route } from "../../homeassistant-frontend/src/types"; -import { brandsUrl } from "../../homeassistant-frontend/src/util/brands-url"; +import { + brandsUrl, + clearBrandsTokenRefresh, + fetchAndScheduleBrandsAccessToken, +} from "../../homeassistant-frontend/src/util/brands-url"; import { showHacsCustomRepositoriesDialog, showHacsFormDialog, @@ -114,6 +118,16 @@ export class HacsDashboard extends LitElement { @state() private _overflowMenuRepository?: RepositoryBase; + protected firstUpdated(changedProps: PropertyValues): void { + super.firstUpdated(changedProps); + fetchAndScheduleBrandsAccessToken(this.hass); + } + + public disconnectedCallback(): void { + super.disconnectedCallback(); + clearBrandsTokenRefresh(); + } + protected render = (): TemplateResult | void => { const repositories = this._filterRepositories( this.hacs.repositories, @@ -330,7 +344,6 @@ export class HacsDashboard extends LitElement { src=${brandsUrl({ domain: repository.domain || "invalid", type: "icon", - useFallback: true, darkOptimized: this.hass.themes?.darkMode, })} referrerpolicy="no-referrer"