#!/bin/sh -e echo "Content-Type:text/plain" if [ "$REQUEST_METHOD" != POST ]; then echo "Status:405 Method Not Allowed" echo exit fi # case and printenv are used here to ensure there isn't a test # subprocess with the secret visible in its argv. case "$(printenv HTTP_AUTHORIZATION | sed -n 's/^basic //ip' | base64 -d)" in "$(cat -- "$CREDENTIALS_DIRECTORY/owncast-inbound")") ;; *) echo "Status:401 Unauthorized" echo exit ;; esac echo "Status:204 No Content" echo if [ "$(jq -r .type)" = STREAM_STARTED ]; then nc -N ::1 18770 <