refactor: consolidate frontend serving and add health check
Backend / Lint i formatowanie (pull_request) Successful in 4s
Panel / Lint, typy i build (pull_request) Successful in 4m50s
Panel / Testowy build obrazu (pull_request) Failing after 2s
Backend / Testy i kontrakt API (pull_request) Successful in 9m24s
Backend / Testowy build obrazu (pull_request) Successful in 1m38s
Backend / Lint i formatowanie (pull_request) Successful in 4s
Panel / Lint, typy i build (pull_request) Successful in 4m50s
Panel / Testowy build obrazu (pull_request) Failing after 2s
Backend / Testy i kontrakt API (pull_request) Successful in 9m24s
Backend / Testowy build obrazu (pull_request) Successful in 1m38s
This commit is contained in:
13 files changed
+42
-121
No files matched your search
@@ -55,6 +55,10 @@ class MusicPlayer:
|
||||
self._states[guild_id] = GuildMusicState(guild_id=guild_id, volume=1.0)
|
||||
return self._states[guild_id]
|
||||
|
||||
@property
|
||||
def is_ready(self) -> bool:
|
||||
return self._bot.is_ready()
|
||||
|
||||
@property
|
||||
def default_plays(self) -> int:
|
||||
return self._config.get_default_plays()
|
||||
|
||||
@@ -4,7 +4,8 @@ from typing import Any
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from zyrarbot.ui.api.dependencies import get_status_service
|
||||
from zyrarbot.music.music_player import MusicPlayer
|
||||
from zyrarbot.ui.api.dependencies import get_player, get_status_service
|
||||
from zyrarbot.ui.api.status_service import StatusService
|
||||
|
||||
router = APIRouter(prefix="/api", tags=["status"])
|
||||
@@ -13,3 +14,8 @@ router = APIRouter(prefix="/api", tags=["status"])
|
||||
@router.get("/status")
|
||||
async def get_status(status: StatusService = Depends(get_status_service)) -> dict[str, Any]:
|
||||
return status.snapshot()
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
async def get_health(player: MusicPlayer = Depends(get_player)) -> dict[str, Any]:
|
||||
return {"status": "ok", "ready": player.is_ready}
|
||||
Reference in new issue
Block a user