- 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
102 lines
3.2 KiB
Bash
Executable File
102 lines
3.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# scripts/start-chrome-new-profile.sh
|
|
# Crea un perfil nuevo y arranca Chrome (google-chrome-stable) con remote debugging
|
|
# Uso:
|
|
# ./scripts/start-chrome-new-profile.sh [start|foreground|headless]
|
|
# Ejemplos:
|
|
# ./scripts/start-chrome-new-profile.sh start
|
|
# ./scripts/start-chrome-new-profile.sh foreground
|
|
# ./scripts/start-chrome-new-profile.sh headless
|
|
|
|
set -euo pipefail
|
|
MODE=${1:-start}
|
|
TIMESTAMP=$(date +%s)
|
|
PROFILE_DIR="$HOME/.config/avanzacast-remote-profile-new-$TIMESTAMP"
|
|
CHROME_BIN=${CHROME_BIN:-/usr/bin/google-chrome-stable}
|
|
PORT=${PORT:-9222}
|
|
LOG=avanzacast-chrome-new-$TIMESTAMP.log
|
|
ERR=avanzacast-chrome-new-$TIMESTAMP.err
|
|
|
|
if [ ! -x "$CHROME_BIN" ]; then
|
|
echo "ERROR: Chrome binary not found or not executable: $CHROME_BIN"
|
|
echo "Please install Chrome or set CHROME_BIN to the path of your Chrome binary."
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$PROFILE_DIR"
|
|
chmod 700 "$PROFILE_DIR"
|
|
|
|
# Kill previous debug listeners
|
|
lsof -ti :$PORT | xargs -r kill -9 || true
|
|
|
|
case "$MODE" in
|
|
foreground)
|
|
echo "Running Chrome in foreground with profile: $PROFILE_DIR"
|
|
exec "$CHROME_BIN" \
|
|
--remote-debugging-port=$PORT \
|
|
--remote-debugging-address=127.0.0.1 \
|
|
--user-data-dir="$PROFILE_DIR" \
|
|
--no-first-run \
|
|
--no-default-browser-check \
|
|
--disable-dev-shm-usage \
|
|
--disable-gpu \
|
|
--start-maximized \
|
|
--v=1
|
|
;;
|
|
headless)
|
|
echo "Starting Chrome headless with profile: $PROFILE_DIR (logs: $LOG, $ERR)"
|
|
nohup "$CHROME_BIN" \
|
|
--headless \
|
|
--remote-debugging-port=$PORT \
|
|
--remote-debugging-address=127.0.0.1 \
|
|
--user-data-dir="$PROFILE_DIR" \
|
|
--no-sandbox --disable-gpu --disable-dev-shm-usage \
|
|
> "$LOG" 2> "$ERR" &
|
|
echo $! > /tmp/avanzacast-chrome-new-$TIMESTAMP.pid
|
|
sleep 2
|
|
echo "PID: $(cat /tmp/avanzacast-chrome-new-$TIMESTAMP.pid)"
|
|
echo "curl http://127.0.0.1:$PORT/json/version"
|
|
curl -sS "http://127.0.0.1:$PORT/json/version" || true
|
|
echo "Tail of logs ($LOG / $ERR):"
|
|
tail -n 200 "$LOG" || true
|
|
tail -n 200 "$ERR" || true
|
|
;;
|
|
start)
|
|
echo "Starting Chrome in background with profile: $PROFILE_DIR (logs: $LOG, $ERR)"
|
|
nohup "$CHROME_BIN" \
|
|
--remote-debugging-port=$PORT \
|
|
--remote-debugging-address=127.0.0.1 \
|
|
--user-data-dir="$PROFILE_DIR" \
|
|
--no-first-run --no-default-browser-check \
|
|
--disable-dev-shm-usage --disable-gpu \
|
|
> "$LOG" 2> "$ERR" &
|
|
PID=$!
|
|
echo $PID > /tmp/avanzacast-chrome-new-$TIMESTAMP.pid
|
|
sleep 2
|
|
echo "PID: $PID"
|
|
echo "curl http://127.0.0.1:$PORT/json/version"
|
|
curl -sS "http://127.0.0.1:$PORT/json/version" || true
|
|
echo "Tail of logs ($LOG / $ERR):"
|
|
tail -n 200 "$LOG" || true
|
|
tail -n 200 "$ERR" || true
|
|
;;
|
|
*)
|
|
echo "Unknown mode: $MODE"
|
|
echo "Usage: $0 [start|foreground|headless]"
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
echo "Profile dir created: $PROFILE_DIR"
|
|
|
|
# Print helpful next steps
|
|
cat <<EOF
|
|
Next steps:
|
|
- Verify debugger: curl http://127.0.0.1:$PORT/json/version
|
|
- If responds, run E2E script:
|
|
cd packages/broadcast-panel
|
|
npm install puppeteer-core --no-audit --no-fund
|
|
DEBUG_BROWSER_URL='http://127.0.0.1:9222' BROADCAST_URL='http://localhost:5175' node --input-type=module e2e/puppeteer_connect_debug.mjs
|
|
EOF
|
|
|