master
Michael Murtaugh 5 years ago
parent a1623cb32c
commit c960b60cc1

@ -0,0 +1,32 @@
#!/bin/bash
echo "Content-type: text/html"
echo
if [ "$REQUEST_METHOD" = "POST" ]; then
if [ "$CONTENT_TYPE" = "application/json" ]; then
SECRET=$(jq -r ".secret")
if [ $SECRET = "SECRET" ]; then
cd /var/www/html/12
git pull
make
# cat > /usr/lib/cgi-bin/webhook.json
# read -n "$CONTENT_LENGTH" QUERY_STRING_POST
else
echo BAD SECRET
fi
else
echo NOT JSON
fi
else
echo NOT POST
fi
echo "done"
# Example: Using backslashes to do multiline...
# src: https://riptutorial.com/bash/example/29665/request-method--post--w-json
# echo "<hr>Script Error:"\
# "<br>Usage error, cannot complete request, REQUEST_METHOD!=GET."\
# "<br>Check your FORM declaration and be sure to use METHOD=\"GET\".<hr>"
# exit 1
Loading…
Cancel
Save