Implements the GET /pass?token=... endpoint for validating session tokens, resolving the correct target application domain dynamically, and routing users seamlessly using ephemeral 1-click magic links. Also updates the Sessions Hub UI hand-off modal to display the 1-Click Magic Link and adds full test coverage. Co-authored-by: mrteye <1945243+mrteye@users.noreply.github.com>
52 lines
2.0 KiB
Markdown
52 lines
2.0 KiB
Markdown
# TASK METADATA
|
|
|
|
- **Target Files:**
|
|
- `server/db.ts`
|
|
- `server/main.ts`
|
|
- `ui/components/EventJoinPage.tsx`
|
|
- `ui/components/EventSplashPage.tsx`
|
|
- `server/main.test.ts`
|
|
- **Core Objective:** Implement Multi-Claim Event Passes with short vanity URLs
|
|
(`/e/:slug`), universal PIN join portal (`/join`), and CLI environment 1-liner
|
|
(`/join/:slug?format=env`).
|
|
- **Dependencies:** `server/db.ts`, `server/auth-session.ts`
|
|
- **Additional Important Notes:** Provisions isolated guest seats
|
|
(`guest_<slug>_<index>`) with individual sessions.
|
|
|
|
---
|
|
|
|
### 1. Architectural Considerations & Risks
|
|
|
|
- **Concurrency & Seat Limits:**
|
|
- Ensure atomicity when incrementing `seats_claimed` on `event_passes` so
|
|
events with strict seat limits (e.g. 50 seats) do not oversubscribe.
|
|
- **Multi-Channel Accessibility:**
|
|
- Support web browser UI (`/e/:slug`, `/join`), JSON API (`POST /api/join`),
|
|
and CLI environment output (`GET /join/:slug?format=env`).
|
|
- **Session Isolation:**
|
|
- Each attendee gets their own dedicated guest session and UUID, preventing
|
|
state collision in shared sandbox apps.
|
|
|
|
---
|
|
|
|
### 2. Proposed Implementation
|
|
|
|
1. **Database Schema (`server/db.ts`):**
|
|
- Create `event_passes` table with columns: `id`, `slug`, `pin_code`, `name`,
|
|
`app_id`, `role`, `max_seats`, `seats_claimed`, `lifespan_hours`,
|
|
`created_by`, `is_active`, `expires_at`, `created_at`.
|
|
2. **API Endpoints (`server/main.ts`):**
|
|
- `POST /api/events`: Create a new event pass.
|
|
- `GET /e/:slug`: Web landing splash with "Enter Workshop" button.
|
|
- `GET /join`: Universal PIN / code entry page.
|
|
- `POST /api/join`: Redeems code or PIN, creates isolated guest user and
|
|
session, sets cookie or returns JSON.
|
|
- `GET /join/:slug`: Returns CLI 1-liner (`export AUTH_YES_TOKEN="..."` when
|
|
`?format=env`).
|
|
3. **SSR UI Components:**
|
|
- `ui/components/EventJoinPage.tsx`
|
|
- `ui/components/EventSplashPage.tsx`
|
|
4. **Automated Tests (`server/main.test.ts`):**
|
|
- Test event creation, PIN redemption, seat limit capping, and CLI output
|
|
format.
|