Files
Toju/dev-peer.sh
T
myxelium e49b3ec112 chore: dev-stack switches, shared e2e harness, and desktop shell rules
- `LIVE_RELOAD=false npm run dev` keeps the renderer alive across a machine
  suspend; the reload client otherwise destroys the session under test.
- `dev-peer.sh` plus a separate userdata dir runs a second local peer.
- `tools/voice-probe.js` samples peer state and RTP counters from a live
  window, persisting to localStorage so a renderer reload cannot erase it.
- e2e helpers for voice pairs, peer-role election, and a TURN relay.
- Electron single-instance and dev-client-load decisions move into rules
  files with colocated specs.
2026-08-14 03:19:29 +02:00

43 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Launch one more Electron window against an already-running dev stack.
#
# Electron's single-instance lock is scoped to the userData directory, so a peer
# window only gets its own lock — and its own identity — when it gets its own
# --user-data-dir. Without that, tools/launch-electron.js hands its argv to the
# running instance and the dev-reload path just reloads window A instead.
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
PEER_NAME="${1:-peer}"
PEER_DATA_DIR="$DIR/.dev-userdata/$PEER_NAME"
if [ -f "$DIR/.env" ]; then
set -a
source "$DIR/.env"
set +a
fi
SSL="${SSL:-false}"
if [ "$SSL" = "true" ]; then
CLIENT_URL="https://127.0.0.1:4200"
export NODE_TLS_REJECT_UNAUTHORIZED=0
else
CLIENT_URL="http://127.0.0.1:4200"
fi
if ! npx wait-on --timeout 5000 "$CLIENT_URL" >/dev/null 2>&1; then
echo "No dev client at $CLIENT_URL — start the stack with 'npm run dev' first." >&2
exit 1
fi
mkdir -p "$PEER_DATA_DIR"
echo "Launching peer window '$PEER_NAME' (data dir: $PEER_DATA_DIR)"
echo "Reminder: a fresh peer needs https://localhost:3001 added under Settings -> signal servers."
exec npx cross-env NODE_ENV=development SSL="$SSL" node tools/launch-electron.js . \
--no-sandbox \
--disable-dev-shm-usage \
--user-data-dir="$PEER_DATA_DIR"