restreamer-ui-v2/scripts/check_relay.sh
Cesar Mendivil 00e98a19b3 feat: add InternalWHIP component and associated tests
- Implemented the InternalWHIP component for managing WHIP server configurations.
- Added functionality to load live WHIP state from Core and handle OBS URL generation.
- Included polling for active streams and notifying parent components of state changes.
- Created comprehensive tests for the InternalWHIP component covering various scenarios including fallback mechanisms and state changes.

test: add integration tests for WHIP source component

- Developed end-to-end tests for the InternalWHIP component to verify its behavior under different configurations.
- Ensured that the component correctly handles the loading of WHIP state, displays appropriate messages, and emits the correct onChange events.

test: add Settings WHIP configuration tests

- Implemented tests for the WHIP settings tab to validate loading and saving of WHIP configurations.
- Verified that the correct values are sent back to the Core when the user saves changes.
- Ensured that the UI reflects the current state of the WHIP configuration after Core restarts or changes.
2026-03-14 12:27:53 -07:00

58 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Usage: ./scripts/check_relay.sh <CHANNEL_ID>
# Relies on .env REACT_APP_CORE_URL and optional API_TOKEN
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs) || true
fi
CORE_URL=${REACT_APP_CORE_URL:-http://localhost:8080}
API_TOKEN=${API_TOKEN:-}
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <CHANNEL_ID>"
exit 2
fi
CHANNEL_ID=$1
AUTH_HEADER=()
if [ -n "$API_TOKEN" ]; then
AUTH_HEADER+=( -H "Authorization: Bearer ${API_TOKEN}" )
fi
echo "Checking relay and ingest state for channel: ${CHANNEL_ID} (CORE: ${CORE_URL})"
echo -e "\n1) WebRTC relay (node) status -> /webrtc-relay/status"
curl -s ${AUTH_HEADER[@]} "${CORE_URL}/webrtc-relay/status" | jq '.' || echo "(no response)"
echo -e "\n2) RTMP channels -> /api/v3/rtmp"
curl -s ${AUTH_HEADER[@]} "${CORE_URL}/api/v3/rtmp" | jq '.' || echo "(no response)"
echo -e "\n3) Active sessions (ffmpeg,hls,rtmp,srt) -> /api/v3/session/active"
curl -s ${AUTH_HEADER[@]} -X POST "${CORE_URL}/api/v3/metrics" -H 'Content-Type: application/json' -d '{"query":{},"range":{}}' >/dev/null 2>&1 || true
# preferred: /api/v3/session/active?collectors=ffmpeg,hls,rtmp,srt
curl -s ${AUTH_HEADER[@]} "${CORE_URL}/api/v3/session/active?collectors=ffmpeg,hls,rtmp,srt" | jq '.' || echo "(no response)"
echo -e "\n4) Processes referencing channel -> /api/v3/process?reference=${CHANNEL_ID}"
curl -s ${AUTH_HEADER[@]} "${CORE_URL}/api/v3/process?reference=${CHANNEL_ID}" | jq '.' || echo "(no response)"
echo -e "\n5) Ingest process state/report (if any)"
# Try to extract ingest process id from process list
proc_ids=$(curl -s ${AUTH_HEADER[@]} "${CORE_URL}/api/v3/process?reference=${CHANNEL_ID}" | jq -r '.[]?.id' || true)
if [ -n "$proc_ids" ]; then
for id in $proc_ids; do
echo -e "\n--- process: $id ---"
curl -s ${AUTH_HEADER[@]} "${CORE_URL}/api/v3/process/${id}/state" | jq '.' || echo "(no state)"
curl -s ${AUTH_HEADER[@]} "${CORE_URL}/api/v3/process/${id}/report" | jq '.' || echo "(no report)"
done
else
echo "No processes found for reference ${CHANNEL_ID}"
fi
echo -e "\n6) MemFS files for channel -> /api/v3/fs/mem?glob=/${CHANNEL_ID}*"
curl -s ${AUTH_HEADER[@]} "${CORE_URL}/api/v3/fs/mem?glob=/%2F${CHANNEL_ID}%2A" | jq '.' || echo "(no response)"
echo -e "\nHint: Check server logs (node) for [webrtc-relay] and core logs for ffmpeg/process messages. If using Docker, run: docker-compose logs -f"