custom_components/bahmcloud_store/core.py aktualisiert

This commit is contained in:
2026-01-15 16:13:42 +00:00
parent 1794d579d2
commit c4361cc8bd

View File

@@ -3,6 +3,7 @@ from __future__ import annotations
import asyncio
import json
import logging
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Any
@@ -157,13 +158,25 @@ class BCSCore:
async def _load_index_repos(self) -> tuple[list[RepoItem], int]:
session = async_get_clientsession(self.hass)
# ---- CACHE BUSTING FIX (Phase B) ----
# Force store.yaml to always be reloaded from remote:
# - add timestamp query parameter
# - disable HTTP cache via headers
url = f"{self.config.store_url}?t={int(time.time())}"
headers = {
"Cache-Control": "no-cache",
"Pragma": "no-cache",
}
try:
async with session.get(self.config.store_url, timeout=20) as resp:
async with session.get(url, timeout=20, headers=headers) as resp:
if resp.status != 200:
raise BCSError(f"store_url returned {resp.status}")
raw = await resp.text()
except Exception as e:
raise BCSError(f"Failed fetching store index: {e}") from e
# ---- END CACHE BUSTING FIX ----
try:
data = ha_yaml.parse_yaml(raw)