795a15cb8b
Lint & Test / test (push) Successful in 10s
- Abstract ReleaseProvider protocol for platform-agnostic version checking - GiteaReleaseProvider implementation using stdlib urllib - UpdateChecker service with periodic background checks and WS broadcast - Persistent dismissible banner in Web UI when a new version is detected - Health endpoint now returns cached update info - Configurable via update_check_enabled and update_check_interval settings - i18n support (EN/RU)
30 lines
749 B
Python
30 lines
749 B
Python
"""Abstract release provider interface for version checking."""
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Protocol
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ReleaseInfo:
|
|
"""Version-provider-agnostic release metadata."""
|
|
|
|
version: str # e.g. "1.1.0" (no "v" prefix)
|
|
url: str # release page URL
|
|
prerelease: bool
|
|
|
|
|
|
class ReleaseProvider(Protocol):
|
|
"""Abstract interface for fetching the latest release.
|
|
|
|
Implement this protocol to support different hosting platforms
|
|
(Gitea, GitHub, GitLab, etc.).
|
|
"""
|
|
|
|
async def get_latest_release(self) -> ReleaseInfo | None:
|
|
"""Fetch the latest stable release.
|
|
|
|
Returns:
|
|
ReleaseInfo if a release was found, None on failure.
|
|
"""
|
|
...
|