From 83fbc483f0c8b3a3077c09b7ac93cfcf7673b2f0 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 3 Nov 2024 23:10:21 +0100 Subject: [PATCH] fix: :truck: remove alias and cleanup --- backend/pilotwings.py | 30 ++++++++++++------------- frontend/components/Loading.vue | 2 +- frontend/main.ts | 2 +- frontend/{router.ts => router/index.ts} | 4 ++-- frontend/types.ts | 10 +++++++++ frontend/views/Home.vue | 9 ++++---- tsconfig.json | 4 ---- vite.config.ts | 8 ------- 8 files changed, 33 insertions(+), 36 deletions(-) rename frontend/{router.ts => router/index.ts} (78%) create mode 100644 frontend/types.ts diff --git a/backend/pilotwings.py b/backend/pilotwings.py index 6095c6d..8bb7109 100644 --- a/backend/pilotwings.py +++ b/backend/pilotwings.py @@ -42,20 +42,6 @@ async def check_auth( return credentials -class AuthStaticFiles(StaticFiles): - async def __call__( - self, scope: types.Scope, receive: types.Receive, send: types.Send - ) -> None: - request = Request(scope, receive) - credentials = await security(request) - - if not credentials: - raise http_401() - - await check_auth(credentials) - await super().__call__(scope, receive, send) - - app = FastAPI(dependencies=[Depends(check_auth)]) @@ -66,7 +52,6 @@ class SerializedContainer(BaseModel): labels: dict[str, str] status: str health: str - ports: dict[str, str] owner: str | None environment: list[str] @@ -79,7 +64,6 @@ def serialize_container(container: Container) -> SerializedContainer: labels=container.labels, status=container.status, health=container.health, - ports=container.ports, owner=container.labels.get("owner"), environment=container.attrs["Config"]["Env"], ) @@ -182,6 +166,20 @@ def update_container( ) +class AuthStaticFiles(StaticFiles): + async def __call__( + self, scope: types.Scope, receive: types.Receive, send: types.Send + ) -> None: + request = Request(scope, receive) + credentials = await security(request) + + if not credentials: + raise http_401() + + await check_auth(credentials) + await super().__call__(scope, receive, send) + + app.mount( "/", AuthStaticFiles( diff --git a/frontend/components/Loading.vue b/frontend/components/Loading.vue index 56e91b6..2790c7a 100644 --- a/frontend/components/Loading.vue +++ b/frontend/components/Loading.vue @@ -6,7 +6,7 @@