diff --git a/.env.example b/.env.example index b4214c8..37913dc 100644 --- a/.env.example +++ b/.env.example @@ -4,3 +4,6 @@ # set the same variables in your Cloudflare build environment for deploys. PUBLIC_AUTH0_DOMAIN=id.letsbuilda.dev PUBLIC_AUTH0_CLIENT_ID=THoRnVJxMOfLxMAW0kaNW8nuP1q8q3qQ +PUBLIC_AUTH0_AUDIENCE=https://mundane.letsbuilda.dev +# The Mundane API (letsbuilda/mundane-backend). Locally: http://localhost:8787 (pywrangler dev). +PUBLIC_MUNDANE_API_URL=https://mundane.letsbuilda.dev diff --git a/README.md b/README.md index 5991171..c8ba57f 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ non-secret** environment variables: | :----------------------- | :--------------------------- | | `PUBLIC_AUTH0_DOMAIN` | Auth0 tenant domain | | `PUBLIC_AUTH0_CLIENT_ID` | Auth0 SPA application client ID | +| `PUBLIC_AUTH0_AUDIENCE` | Auth0 API identifier for the Mundane backend | +| `PUBLIC_MUNDANE_API_URL` | Base URL of the Mundane API | Copy `.env.example` to `.env` for local development, and set the same variables in the Cloudflare build environment for deploys (Astro inlines `PUBLIC_*` values @@ -58,6 +60,12 @@ In the Auth0 application (type: **Single Page Application**), add both your loca **Allowed Callback URLs**, **Allowed Logout URLs**, and **Allowed Web Origins**, and enable **Refresh Token Rotation**. +The `/mundane` page plays [Mundane](https://github.com/letsbuilda/mundane) against +[`mundane-backend`](https://github.com/letsbuilda/mundane-backend), sending the +player's access token with every request. That needs an Auth0 **API** with identifier +`https://mundane.letsbuilda.dev` (RS256) and **Allow Offline Access** turned on, so +the SPA's refresh tokens work for it. + ## 👀 Want to learn more? Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). diff --git a/public/css/main.css b/public/css/main.css index 4cff3b7..9ec9e12 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -85,3 +85,39 @@ main { margin: 0; word-break: break-word; } + +.mundane-players { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); + gap: 1rem; +} + +.mundane-player { + padding: 1rem; + border: 1px solid #e2e2e2; + border-radius: 12px; +} + +.mundane-player h2, +.mundane-player h3 { + margin: 0 0 0.5rem; +} + +.mundane-button { + cursor: pointer; + margin: 0.25rem 0.25rem 0 0; + padding: 0.3rem 0.8rem; + border: 1px solid #d1d5db; + border-radius: 6px; + background: #f9fafb; + font: inherit; +} + +.mundane-button:disabled { + cursor: not-allowed; + opacity: 0.5; +} + +.mundane-error { + color: #b91c1c; +} diff --git a/public/favicon.svg b/public/favicon.svg index f157bd1..5b67f46 100644 --- a/public/favicon.svg +++ b/public/favicon.svg @@ -1,4 +1,5 @@ + letsbuilda.dev