diff --git a/src/components/media-player/ha-media-player-browse.ts b/src/components/media-player/ha-media-player-browse.ts index 23cacf1fc7..4ee029ee13 100644 --- a/src/components/media-player/ha-media-player-browse.ts +++ b/src/components/media-player/ha-media-player-browse.ts @@ -43,7 +43,11 @@ import { showAlertDialog } from "../../dialogs/generic/show-dialog-box"; import { installResizeObserver } from "../../panels/lovelace/common/install-resize-observer"; import { haStyle } from "../../resources/styles"; import type { HomeAssistant } from "../../types"; -import { brandsUrl, extractDomainFromBrandUrl } from "../../util/brands-url"; +import { + brandsUrl, + extractDomainFromBrandUrl, + isBrandUrl, +} from "../../util/brands-url"; import { documentationUrl } from "../../util/documentation-url"; import "../entity/ha-entity-picker"; import "../ha-alert"; @@ -563,6 +567,8 @@ export class HaMediaPlayerBrowse extends LitElement {
@@ -661,7 +667,7 @@ export class HaMediaPlayerBrowse extends LitElement { return (await getSignedPath(this.hass, thumbnailUrl)).path; } - if (thumbnailUrl.startsWith("https://brands.home-assistant.io")) { + if (isBrandUrl(thumbnailUrl)) { // The backend is not aware of the theme used by the users, // so we rewrite the URL to show a proper icon thumbnailUrl = brandsUrl({ @@ -1050,6 +1056,10 @@ export class HaMediaPlayerBrowse extends LitElement { background-size: contain; } + .brand-image { + background-size: 40%; + } + .children ha-card .icon-holder { display: flex; justify-content: center; diff --git a/src/util/brands-url.ts b/src/util/brands-url.ts index e4136bc199..7b0405b696 100644 --- a/src/util/brands-url.ts +++ b/src/util/brands-url.ts @@ -23,3 +23,6 @@ export const hardwareBrandsUrl = (options: HardwareBrandsOptions): string => }${options.manufacturer}${options.model ? `_${options.model}` : ""}.png`; export const extractDomainFromBrandUrl = (url: string) => url.split("/")[4]; + +export const isBrandUrl = (thumbnail: string | ""): boolean => + thumbnail.startsWith("https://brands.home-assistant.io/");