From 0c49a50fc9f9aa477dc631e42f60356c5353e306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Bachmann?= Date: Tue, 20 Jan 2026 07:17:24 +0000 Subject: [PATCH] 0.7.1 --- custom_components/bahmcloud_store/providers.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/custom_components/bahmcloud_store/providers.py b/custom_components/bahmcloud_store/providers.py index 11d478a..0d24480 100644 --- a/custom_components/bahmcloud_store/providers.py +++ b/custom_components/bahmcloud_store/providers.py @@ -537,7 +537,7 @@ async def fetch_repo_versions( - source: release|tag|branch Notes: - - Uses public endpoints (no tokens) for public repositories. + - Uses provider APIs; for GitHub we include the configured token (if any) to avoid unauthenticated rate limits. - We prefer releases first (if available), then tags. """ @@ -575,11 +575,13 @@ async def fetch_repo_versions( try: if prov == "github": - # Releases - gh_headers = {"Accept": "application/vnd.github+json", "User-Agent": UA} + # Releases (prefer these over tags) + # Use the configured GitHub token (if any) to avoid unauthenticated rate limits. + gh_headers = _github_headers(github_token) + per_page = max(1, min(int(limit), 100)) data, _ = await _safe_json( session, - f"https://api.github.com/repos/{owner}/{repo}/releases?per_page={int(limit)}", + f"https://api.github.com/repos/{owner}/{repo}/releases?per_page={per_page}", headers=gh_headers, ) if isinstance(data, list): @@ -597,7 +599,7 @@ async def fetch_repo_versions( # Tags data, _ = await _safe_json( session, - f"https://api.github.com/repos/{owner}/{repo}/tags?per_page={int(limit)}", + f"https://api.github.com/repos/{owner}/{repo}/tags?per_page={per_page}", headers=gh_headers, ) if isinstance(data, list):