- 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
56 lines
1.8 KiB
Bash
Executable File
56 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# scripts/check_token_server.sh
|
|
# Uso: ./scripts/check_token_server.sh <TOKEN_SERVER_BASE_URL> [ROOM] [USERNAME]
|
|
# Ejemplo: ./scripts/check_token_server.sh https://avanzacast-servertokens.bfzqqk.easypanel.host myroom alice
|
|
|
|
set -euo pipefail
|
|
SERVER=${1:-}
|
|
ROOM=${2:-test-room}
|
|
USER=${3:-e2e-user}
|
|
|
|
if [ -z "$SERVER" ]; then
|
|
echo "Usage: $0 <TOKEN_SERVER_BASE_URL> [ROOM] [USERNAME]"
|
|
echo "Example: $0 https://localhost:4000 myroom alice"
|
|
exit 2
|
|
fi
|
|
|
|
SESSION_URL="$SERVER/api/session"
|
|
|
|
echo "=== Token server diagnostics ==="
|
|
echo "Server: $SERVER"
|
|
echo "Session endpoint: $SESSION_URL"
|
|
|
|
echo "\n--- OPTIONS (CORS preflight) ---"
|
|
curl -i -X OPTIONS "$SESSION_URL" -H "Origin: http://localhost:5176" || true
|
|
|
|
echo "\n--- POST /api/session (create) ---"
|
|
HTTP=$(curl -s -w "%{http_code}" -o /tmp/curl_out.txt -X POST "$SESSION_URL" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{ \"room\": \"$ROOM\", \"username\": \"$USER\" }" || true)
|
|
|
|
echo "HTTP status: $HTTP"
|
|
echo "Body:"
|
|
cat /tmp/curl_out.txt || true
|
|
|
|
# If creation returned id, try GET token
|
|
if [ "$HTTP" -ge 200 ] && [ "$HTTP" -lt 400 ]; then
|
|
BODY=$(cat /tmp/curl_out.txt)
|
|
# Try to parse id or sessionId
|
|
ID=$(echo "$BODY" | python3 -c "import sys, json; d=json.load(sys.stdin); print(d.get('id') or d.get('sessionId') or d.get('session_id') or '')" 2>/dev/null || true)
|
|
echo "Parsed session id: '$ID'"
|
|
if [ -n "$ID" ]; then
|
|
TOKEN_URL="$SERVER/api/session/$ID/token"
|
|
echo "\n--- GET $TOKEN_URL ---"
|
|
curl -i "$TOKEN_URL" || true
|
|
else
|
|
echo "No session id found in create response; inspect body."
|
|
fi
|
|
else
|
|
echo "Session creation failed (status $HTTP). Check backend logs and CORS."
|
|
fi
|
|
|
|
# Cleanup
|
|
rm -f /tmp/curl_out.txt
|
|
|
|
echo "\nDiagnostics complete. If you see 'Access-Control-Allow-Origin' missing or response status 0/0, likely CORS or network issue."
|