Update script to function

This commit is contained in:
Christopher Cookman 2025-10-03 22:14:51 -06:00
parent 76bd32a19f
commit b08c610a8f

View file

@ -4,7 +4,7 @@
# Requires: curl
# Configuration
API_KEY="your_api_key_here" # Replace with your AstroCom API Key!
API_KEY="Your ASTROCOM API Key" # Replace with your AstroCom API Key!
@ -16,7 +16,4 @@ if [[ -z "$CURRENT_IP" ]]; then
fi
echo "Current IP: $CURRENT_IP"
# Update IP via AstroCom API PATCH https://astrocom.tel/api/v1/user/update; JSON body: {"server": "current_ip"}
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X PATCH https://astrocom.tel/api/v1/user/update \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d "{\"server\": \"$CURRENT_IP\"}"
curl -s -X PATCH https://astrocom.tel/api/v1/user/update -H "Content-Type: application/json" -H "Authorization: Bearer $API_KEY" -d "{\"server\": \"$CURRENT_IP\"}"