- Add Next.js app structure with base configs, linting, and formatting - Implement LiveKit Meet page, types, and utility functions - Add Docker, Compose, and deployment scripts for backend and token server - Provide E2E and smoke test scaffolding with Puppeteer and Playwright helpers - Include CSS modules and global styles for UI - Add postMessage and studio integration utilities - Update package.json with dependencies and scripts for development and testing
53 lines
2.0 KiB
Bash
53 lines
2.0 KiB
Bash
#!/usr/bin/env bash
|
|
# Quick E2E helper: create session on backend-api and print a URL you can open in the Broadcast Panel (with token in query) or use to postMessage.
|
|
# Set these env vars before running if needed:
|
|
# TOKEN_SERVER (default: http://localhost:4000)
|
|
# BROADCAST_URL (default: http://localhost:5175)
|
|
|
|
TOKEN_SERVER=${TOKEN_SERVER:-http://localhost:4000}
|
|
BROADCAST_URL=${BROADCAST_URL:-http://localhost:5175}
|
|
ROOM=${1:-e2e-room}
|
|
USERNAME=${2:-e2e-runner}
|
|
|
|
set -e
|
|
|
|
echo "Creating session on ${TOKEN_SERVER} for room=${ROOM} username=${USERNAME}"
|
|
RESP=$(curl -sS -X POST "${TOKEN_SERVER%/}/api/session" -H 'Content-Type: application/json' -d '{"room":"'"${ROOM}"'","username":"'"${USERNAME}"'"}') || true
|
|
if [ -z "$RESP" ]; then
|
|
echo "No response from token server"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Session response: $RESP"
|
|
|
|
ID=$(echo "$RESP" | jq -r '.id // empty')
|
|
TOKEN=$(echo "$RESP" | jq -r '.token // empty')
|
|
URL=$(echo "$RESP" | jq -r '.redirectUrl // .studioUrl // .url // empty')
|
|
|
|
if [ -n "$TOKEN" ]; then
|
|
echo "\nToken created (truncated): ${TOKEN:0:40}..."
|
|
fi
|
|
if [ -n "$URL" ]; then
|
|
echo "Returned URL: $URL"
|
|
fi
|
|
|
|
# Print a Broadcast Panel friendly URL that includes token in query (useful if INCLUDE_TOKEN_IN_REDIRECT flow is enabled)
|
|
if [ -n "$TOKEN" ]; then
|
|
echo "\nOpen this in Broadcast Panel to auto-open the StudioPortal overlay (if it's integrated):"
|
|
echo "${BROADCAST_URL}?token=${TOKEN}&url=${URL}&room=${ROOM}"
|
|
fi
|
|
|
|
# Also print a JS postMessage snippet you can paste in browser console to simulate the Broadcast Panel sending token to an open Broadcast/Studio page
|
|
if [ -n "$TOKEN" ]; then
|
|
cat <<JS
|
|
|
|
# Paste the following into the Broadcast Panel page console (or run with browser automation). It will postMessage the token to the current origin:
|
|
(function(){
|
|
const payload = { type: 'LIVEKIT_TOKEN', token: '${TOKEN}', url: '${URL}', room: '${ROOM}' };
|
|
window.postMessage(payload, window.location.origin);
|
|
console.log('Posted LIVEKIT_TOKEN to window', payload);
|
|
})();
|
|
|
|
JS
|
|
fi
|