]> git.ipfire.org Git - pbs.git/commitdiff
api: Add an endpoint to return all mirrors
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Jul 2025 17:08:58 +0000 (17:08 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Jul 2025 17:08:58 +0000 (17:08 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/api/mirrors.py

index e5bf0f37ab53a0062a5a6befe58e8555a7d5f8b8..915d01d444d637b9dbf7bf5747a9ccf383cc7775 100644 (file)
@@ -37,6 +37,10 @@ async def get_mirror_from_path(hostname: str = fastapi.Path(...)) -> Mirror | No
        """
        return await backend.mirrors.get_by_hostname(hostname)
 
+@router.get("")
+async def get_mirrors() -> list[Mirror]:
+       return [mirror async for mirror in backend.mirrors]
+
 @router.get("/{hostname}")
 async def get_mirror(mirror: Mirror = fastapi.Depends(get_mirror_from_path)) -> Mirror:
        if not mirror: