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'
10 tmpfile=$(mktemp /tmp/not.XXXXXX)
11 url="gemini://station.martinrue.com/frrobert"
20 if [[ "$url" != *://* ]];then
24 domain=$(sed 's/gemini:\/\///' <<< "$url")
26 if [[ "$url" != *.*/*.* ]] && [[ $url != */ ]];then
29 domain=$(sed 's/\/.*$//' <<< "$domain")
30 timeout $connectto openssl s_client -crlf -quiet -key $key -cert $cert -connect "$domain:1965" <<<"$url" 2>/dev/null >> $tmpfile
34 IFS=' ' read -ra my_array <<< $(cat $tmpfile | grep '/notifications')
35 notifications=${my_array[2]}
37 if [[ $notifications -gt $lasttime ]]; then
38 new=$(expr $notifications - $lasttime)
40 echo "You have $notifications notifications and $new new notifications!"
41 read -p "Press enter to continue, or either type amfora or lagrange to go to notifications" answer
55 echo "waiting for new notifications"
56 lasttime=$notifications