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)
34 lines
866 B
Python
34 lines
866 B
Python
"""Health check endpoint."""
|
|
|
|
import platform
|
|
from typing import Any
|
|
|
|
from fastapi import APIRouter, Request
|
|
|
|
from .. import __version__
|
|
from ..auth import auth_enabled
|
|
|
|
router = APIRouter(prefix="/api", tags=["health"])
|
|
|
|
|
|
@router.get("/health")
|
|
async def health_check(request: Request) -> dict[str, Any]:
|
|
"""Health check endpoint - no authentication required.
|
|
|
|
Returns:
|
|
Health status and server information
|
|
"""
|
|
result: dict[str, Any] = {
|
|
"status": "healthy",
|
|
"platform": platform.system(),
|
|
"version": __version__,
|
|
"auth_required": auth_enabled(),
|
|
}
|
|
|
|
# Include cached update info if available
|
|
checker = getattr(request.app.state, "update_checker", None)
|
|
if checker is not None and checker.cached_update is not None:
|
|
result["update_available"] = checker.cached_update
|
|
|
|
return result
|