duck.etc.blueprints.dashboard.views

View handlers for the dashboard blueprint.

Checks JWT authentication on every dashboard request. Unauthenticated requests are served the LoginPage so auth is handled in a single WebSocket-driven flow with no redirects.

Module Contents

Functions

dashboard

Renders the live server dashboard if the request carries a valid JWT.

logout

Clears the JWT session and redirects to the dashboard login screen.

API

async duck.etc.blueprints.dashboard.views.dashboard(request: duck.http.request.HttpRequest)[source]

Renders the live server dashboard if the request carries a valid JWT.

Calls async_get_user_from_jwt to extract and verify the token from the request (cookie or Authorization header). Unauthenticated requests receive the LoginPage; authenticated requests receive the DashboardPage.

Parameters:

request – The incoming HTTP request.

Returns:

A rendered DashboardPage or LoginPage component.

async duck.etc.blueprints.dashboard.views.logout(request: duck.http.request.HttpRequest)[source]

Clears the JWT session and redirects to the dashboard login screen.

Parameters:

request – The incoming HTTP request.

Returns:

An HttpResponse redirect to the dashboard index (which will show LoginPage since the JWT has been cleared).