You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
708 B
Bash

#!/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