Fux insta

This commit is contained in:
2026-01-16 17:27:02 +00:00
parent df631eec9e
commit 1e86df49e9

View File

@@ -306,7 +306,7 @@ class BCSCore:
def list_repos_public(self) -> list[dict[str, Any]]:
out: list[dict[str, Any]] = []
installed_map: dict[str, Any] = getattr(self, '_installed_cache', {}) or {}
installed_map: dict[str, Any] = getattr(self, "_installed_cache", {}) or {}
if not isinstance(installed_map, dict):
installed_map = {}
@@ -315,33 +315,41 @@ class BCSCore:
installed = bool(inst)
installed_domains: list[str] = []
installed_version: str | None = None
installed_manifest_version: str | None = None
if isinstance(inst, dict):
d = inst.get('domains') or []
d = inst.get("domains") or []
if isinstance(d, list):
installed_domains = [str(x) for x in d if str(x).strip()]
v = inst.get('installed_version')
# IMPORTANT: this is the ref we installed (tag/release/branch)
v = inst.get("installed_version")
installed_version = str(v) if v is not None else None
mv = inst.get("installed_manifest_version")
installed_manifest_version = str(mv) if mv is not None else None
out.append(
{
'id': r.id,
'name': r.name,
'url': r.url,
'source': r.source,
'owner': r.owner,
'provider': r.provider,
'repo_name': r.provider_repo_name,
'description': r.provider_description or r.meta_description,
'default_branch': r.default_branch,
'latest_version': r.latest_version,
'latest_version_source': r.latest_version_source,
'category': r.meta_category,
'meta_author': r.meta_author,
'meta_maintainer': r.meta_maintainer,
'meta_source': r.meta_source,
'installed': installed,
'installed_version': installed_version,
'installed_domains': installed_domains,
"id": r.id,
"name": r.name,
"url": r.url,
"source": r.source,
"owner": r.owner,
"provider": r.provider,
"repo_name": r.provider_repo_name,
"description": r.provider_description or r.meta_description,
"default_branch": r.default_branch,
"latest_version": r.latest_version,
"latest_version_source": r.latest_version_source,
"category": r.meta_category,
"meta_author": r.meta_author,
"meta_maintainer": r.meta_maintainer,
"meta_source": r.meta_source,
"installed": installed,
"installed_version": installed_version,
"installed_manifest_version": installed_manifest_version,
"installed_domains": installed_domains,
}
)
return out
@@ -457,7 +465,7 @@ class BCSCore:
await self.hass.async_add_executor_job(_copy)
async def _read_installed_version(self, domain: str) -> str | None:
async def _read_installed_manifest_version(self, domain: str) -> str | None:
def _read() -> str | None:
try:
p = Path(self.hass.config.path("custom_components", domain, "manifest.json"))
@@ -478,7 +486,8 @@ class BCSCore:
for it in items:
cache[it.repo_id] = {
"domains": it.domains,
"installed_version": it.installed_version,
"installed_version": it.installed_version, # BCS ref
"installed_manifest_version": it.installed_manifest_version,
"ref": it.ref,
"installed_at": it.installed_at,
}
@@ -525,13 +534,19 @@ class BCSCore:
if not installed_domains:
raise BCSInstallError("No integrations found under custom_components/ (missing manifest.json)")
installed_version = await self._read_installed_version(installed_domains[0])
# informational only (many repos are wrong here)
installed_manifest_version = await self._read_installed_manifest_version(installed_domains[0])
# IMPORTANT: BCS "installed_version" is the ref we installed (tag/release/branch),
# so update logic won't break when manifest.json is 0.0.0 or outdated.
installed_version = ref
await self.storage.set_installed_repo(
repo_id=repo_id,
url=repo.url,
domains=installed_domains,
installed_version=installed_version,
installed_manifest_version=installed_manifest_version,
ref=ref,
)
await self._refresh_installed_cache()
@@ -543,13 +558,20 @@ class BCSCore:
notification_id="bcs_restart_required",
)
_LOGGER.info("BCS install complete: repo_id=%s domains=%s", repo_id, installed_domains)
_LOGGER.info(
"BCS install complete: repo_id=%s domains=%s installed_ref=%s manifest_version=%s",
repo_id,
installed_domains,
installed_version,
installed_manifest_version,
)
self.signal_updated()
return {
"ok": True,
"repo_id": repo_id,
"domains": installed_domains,
"installed_version": installed_version,
"installed_manifest_version": installed_manifest_version,
"restart_required": True,
}