custom_components/bahmcloud_store/core.py aktualisiert
This commit is contained in:
@@ -46,7 +46,7 @@ class RepoItem:
|
||||
default_branch: str | None = None
|
||||
|
||||
latest_version: str | None = None
|
||||
latest_version_source: str | None = None # "release" | "tag" | None
|
||||
latest_version_source: str | None = None # "release" | "tag" | "atom" | None
|
||||
|
||||
meta_source: str | None = None
|
||||
meta_name: str | None = None
|
||||
@@ -239,35 +239,6 @@ class BCSCore:
|
||||
)
|
||||
return out
|
||||
|
||||
def _split_owner_repo(self, repo_url: str) -> tuple[str | None, str | None]:
|
||||
u = urlparse(repo_url.rstrip("/"))
|
||||
parts = [p for p in u.path.strip("/").split("/") if p]
|
||||
if len(parts) < 2:
|
||||
return None, None
|
||||
owner = parts[0].strip() or None
|
||||
name = parts[1].strip()
|
||||
if name.endswith(".git"):
|
||||
name = name[:-4]
|
||||
name = name.strip() or None
|
||||
return owner, name
|
||||
|
||||
def _is_github(self, repo_url: str) -> bool:
|
||||
return "github.com" in urlparse(repo_url).netloc.lower()
|
||||
|
||||
def _is_gitea(self, repo_url: str) -> bool:
|
||||
host = urlparse(repo_url).netloc.lower()
|
||||
return host and "github.com" not in host and "gitlab.com" not in host
|
||||
|
||||
async def _fetch_text(self, url: str) -> str | None:
|
||||
session = async_get_clientsession(self.hass)
|
||||
try:
|
||||
async with session.get(url, timeout=20) as resp:
|
||||
if resp.status != 200:
|
||||
return None
|
||||
return await resp.text()
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
async def fetch_readme_markdown(self, repo_id: str) -> str | None:
|
||||
repo = self.get_repo(repo_id)
|
||||
if not repo:
|
||||
|
||||
Reference in New Issue
Block a user