Created
December 9, 2018 20:06
-
-
Save ds82/205251717bc715f439eb3b161c8d0a66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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