diff --git a/custom_components/bahmcloud_store/core.py b/custom_components/bahmcloud_store/core.py index 7bc2ca8..2a9a491 100644 --- a/custom_components/bahmcloud_store/core.py +++ b/custom_components/bahmcloud_store/core.py @@ -88,6 +88,16 @@ class BCSCore: except Exception: pass + async def full_refresh(self, source: str = "manual") -> None: + """Run a full store refresh and notify listeners. + + This is the single entry-point used by both the periodic timer and + the manual refresh button. + """ + _LOGGER.info("BCS full refresh triggered (source=%s)", source) + await self.refresh() + self.signal_updated() + async def register_http_views(self) -> None: self.hass.http.register_view(StaticAssetsView()) self.hass.http.register_view(BCSApiView(self)) @@ -157,7 +167,6 @@ class BCSCore: await asyncio.gather(*(process_one(r) for r in merged.values()), return_exceptions=True) def _add_cache_buster(self, url: str) -> str: - """Append a timestamp query parameter safely (works with existing query params).""" parts = urlsplit(url) q = dict(parse_qsl(parts.query, keep_blank_values=True)) q["t"] = str(int(time.time())) @@ -165,9 +174,6 @@ class BCSCore: return urlunsplit((parts.scheme, parts.netloc, parts.path, new_query, parts.fragment)) def _gitea_src_to_raw(self, url: str) -> str: - """If the URL points to a Gitea 'src' page, convert it to a raw file URL.""" - # Example: - # /owner/repo/src/branch/main/store.yaml -> /owner/repo/raw/branch/main/store.yaml parts = urlsplit(url) path = parts.path path2 = path.replace("/src/branch/", "/raw/branch/") @@ -191,7 +197,6 @@ class BCSCore: return await resp.text() async def _load_index_repos(self) -> tuple[list[RepoItem], int]: - # ---- Phase B: force an actual remote reload of store.yaml ---- store_url = (self.config.store_url or "").strip() if not store_url: raise BCSError("store_url is empty") @@ -201,8 +206,6 @@ class BCSCore: try: raw = await self._fetch_store_text(url) - # If we accidentally fetched a HTML "src" page, try converting to raw. - # This makes the system robust even if someone configures a /src/branch/ URL. if "