diff --git a/enable-expire-notifs.sh b/enable-expire-notifs.sh index 082f590..b7fa48f 100755 --- a/enable-expire-notifs.sh +++ b/enable-expire-notifs.sh @@ -1,4 +1,14 @@ #!/bin/bash -[ -z "$1" ] && echo "You need to provide your api key fot this thing to work. -It is strongly advised enabling privacy mode (\`/privacy\`) for the time of execution" && exit 1 \ No newline at end of file +API_HOST="https://api.ssh.surf" +API_KEY="$1" + +[ -z $API_KEY ] && echo "You need to provide your api key fot this thing to work. +It is strongly advised enabling privacy mode (\`/privacy\`) for the time of execution" && exit 1 + +hello=$(curl -w %{http_code} -sH "x-ssh-auth: $API_KEY" $API_HOST/hello -o /dev/null) + +if [[ hello -ne 200 ]]; then + echo "token not valid, exiting" + exit 1 +fi