Skip to content

Instantly share code, notes, and snippets.

@ds82
Created December 9, 2018 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ds82/205251717bc715f439eb3b161c8d0a66 to your computer and use it in GitHub Desktop.
Save ds82/205251717bc715f439eb3b161c8d0a66 to your computer and use it in GitHub Desktop.
#!/bin/bash
# pushover api
APP_TOKEN=""
USER_KEY=""
DEVICE=""
# apple pay country code
CC="DE"
FOUND=false
function check {
RET=$(curl -s https://smp-device-content.apple.com/static/region/v2/config.json | jq .SupportedRegions.$CC)
([ $?==0 ] && echo $RET) || echo "null"
}
function push {
curl -s \
--form-string "token=$APP_TOKEN" \
--form-string "user=$USER_KEY" \
--form-string "device=DEVICE" \
--form-string "message=Apple Pay in $CC is finally active" \
https://api.pushover.net/1/messages.json
}
while [ $FOUND = false ]; do
R=$(check)
if [ "$R" != "null" ]; then
push
echo $R
FOUND=true
else
echo "No Apple Pay in $CC :("
fi
sleep 15;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment