2 # notifitcatorossl is a fork of https://github.com/ThatsRedacted/StationNotifier
3 # This program uses openssl rather than curl to connect to a gemini site`
5 key='/home/frrobert/.config/amfora/7debbb3fae40dbe77746aa465300febaec5abb778faa8a550f8e5924f0977983.key'
6 cert='/home/frrobert/.config/amfora/7debbb3fae40dbe77746aa465300febaec5abb778faa8a550f8e5924f0977983.crt'
9 tmpfile=$(mktemp /tmp/not.XXXXXX)
10 url="gemini://station.martinrue.com/frrobert"
19 if [[ "$url" != *://* ]];then
23 domain=$(sed 's/gemini:\/\///' <<< "$url")
25 if [[ "$url" != *.*/*.* ]] && [[ $url != */ ]];then
28 domain=$(sed 's/\/.*$//' <<< "$domain")
29 timeout $connectto openssl s_client -crlf -quiet -key $key -cert $cert -connect "$domain:1965" <<<"$url" 2>/dev/null >> $tmpfile
33 IFS=' ' read -ra my_array <<< $(cat $tmpfile | grep '/notifications')
34 notifications=${my_array[2]}
36 if [[ $notifications -gt $lasttime ]]; then
38 echo "You have new notifications!"
39 read -p "Press enter to continue or amfora to go to notifications" answer
41 amfora) $(amfora $url)
45 lasttime=$notifications