added logic for only one request to nonresponsive website
authorfrrobert2 <frrobert@stnectarios.org>
Wed, 28 Apr 2021 19:00:02 +0000 (15:00 -0400)
committerfrrobert2 <frrobert@stnectarios.org>
Wed, 28 Apr 2021 19:00:02 +0000 (15:00 -0400)
lace

diff --git a/lace b/lace
index 7357342c106886c0081de279da23f209c6f59fbd..14d218329d25a0fd403adac3b1dfa4a9b947e47e 100755 (executable)
--- a/lace
+++ b/lace
@@ -8,6 +8,7 @@
 # it is the time lace will wait to connect to a site before it stops the connection
 #  default is 30 seconds you can change it what you want
 connectto=30
+set -o pipefail
 if [ -z "$XDG_CONFIG_HOME" ];then
        config_place="$HOME/.config/lace"
 else
@@ -83,11 +84,14 @@ function timeline() {
                        fi
                        domain=$(sed 's/\/.*$//' <<< "$domain")
                        fav=$(timeout $connectto openssl s_client -crlf -quiet -connect "$domain:1965" <<<"gemini://$domain/favicon.txt" 2>/dev/null | sed -e '1d')
+                       timeoutstatus=${PIPESTATUS[0]}
+                       if [ $timeoutstatus -ne 124 ];then
                        if [ ! -z "$fav" ];then
                                user="$fav $user"
                        fi
                        timeout $connectto openssl s_client -crlf -quiet -connect "$domain:1965" <<<"$url" 2>/dev/null | sed -e '1d' | sed -n '/##/,$p' | sed -e "s/^\(## .*\)$/\1\n${esc}$red$user${esc}$nc ($domain)/g" >> $tmpfile
                        [[ ! -z $(sed -n '$p' $tmpfile) ]] && echo "" >> $tmpfile
+                       fi
                done <"$subsfile"
                cat $tmpfile | sed -r ':r;/(^|\n)$/!{$!{N;br}};s/\n/\v/g' | sed -rn '/^## .*/p' | sed -e 's/\v/\n/g' | sed -e "s/^## \(.*\)/date -d '\1' +%s/e" | sed -r ':r;/(^|\n)$/!{$!{N;br}};s/\n/\v/g' | sort -r | sed -e 's/\v/\n/g'  > $tmpfile