corvix.web.routes_pages

Page routes: SPA shell serving, login form, and session cookie issuing.

Attributes

Functions

index(→ litestar.Response[str])

Serve the dashboard single-page UI.

dashboard_index(→ litestar.Response[str])

Serve the dashboard SPA for bookmarkable dashboard URLs.

_get_auth_secret(→ str)

Return the configured secret, delegating to middleware._get_secret().

login_page(→ litestar.Response[Any])

Serve the login form, or redirect to / when auth is not configured.

login(→ litestar.Response[None])

Validate the submitted token and issue a session cookie on success.

logout(→ litestar.Response[None])

Clear the session cookie and redirect to the login page.

Module Contents

corvix.web.routes_pages._LOGIN_HTML = Multiline-String[source][source]
Show Value
"""<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Corvix — Sign in</title>
  <style>
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: system-ui, sans-serif;
      display: flex; height: 100vh;
      align-items: center; justify-content: center;
      background: #07111f; color: #edf3ff;
    }
    form {
      display: flex; flex-direction: column; gap: 1rem;
      min-width: 300px; padding: 2rem;
      background: #0e1a2b; border-radius: 8px;
    }
    h2 { font-size: 1.4rem; color: #74c0fc; }
    input[type=password] {
      padding: .65rem .9rem; border-radius: 6px;
      border: 1px solid #223753; background: #132238;
      color: #edf3ff; font-size: 1rem;
    }
    input[type=password]:focus { outline: 2px solid #74c0fc; border-color: transparent; }
    button {
      padding: .65rem .9rem; border-radius: 6px; border: none;
      background: #74c0fc; color: #07111f;
      font-size: 1rem; font-weight: 600; cursor: pointer;
    }
    button:hover { background: #a5d4ff; }
  </style>
</head>
<body>
  <form method="post" action="/login">
    <h2>Corvix</h2>
    <input type="password" name="token" placeholder="Secret token" required autofocus>
    <button type="submit">Sign in</button>
  </form>
</body>
</html>"""
corvix.web.routes_pages.index() litestar.Response[str][source][source]

Serve the dashboard single-page UI.

corvix.web.routes_pages.dashboard_index(dashboard_name: str) litestar.Response[str][source][source]

Serve the dashboard SPA for bookmarkable dashboard URLs.

corvix.web.routes_pages._get_auth_secret() str[source][source]

Return the configured secret, delegating to middleware._get_secret().

Using the shared implementation ensures consistent TTL caching, memoized misconfiguration logging, and _FILE support in one place.

corvix.web.routes_pages.login_page() litestar.Response[Any][source][source]

Serve the login form, or redirect to / when auth is not configured.

async corvix.web.routes_pages.login(request: litestar.Request) litestar.Response[None][source][source]

Validate the submitted token and issue a session cookie on success.

The Secure attribute is set when the request arrived over HTTPS. The scheme is read from request.url.scheme which reflects the real protocol when uvicorn is started with --proxy-headers (trusting X-Forwarded-Proto from a reverse proxy). This avoids raw header inspection from application code, which can be spoofed by untrusted clients not behind a proxy.

corvix.web.routes_pages.logout() litestar.Response[None][source][source]

Clear the session cookie and redirect to the login page.