updated lace with timeout alpha
authorfrrobert2 <frrobert@stnectarios.org>
Tue, 27 Apr 2021 18:30:00 +0000 (14:30 -0400)
committerfrrobert2 <frrobert@stnectarios.org>
Tue, 27 Apr 2021 18:30:00 +0000 (14:30 -0400)
lace

diff --git a/lace b/lace
index 2f57350324b5713ebf50bce169e5174456a4b06b..8ac47c12de881656db410b01b91751fe2f5dcf32 100644 (file)
--- a/lace
+++ b/lace
@@ -4,6 +4,7 @@
 # https://raw.githubusercontent.com/frrobert2/lace/main/lace
 # Shows both how many days ago and date
 # Modified to work with Debian running Sed 3.7
+connectto=30
 if [ -z "$XDG_CONFIG_HOME" ];then
        config_place="$HOME/.config/lace"
 else
@@ -78,11 +79,11 @@ function timeline() {
                                url="$url/"
                        fi
                        domain=$(sed 's/\/.*$//' <<< "$domain")
-                       fav=$(openssl s_client -crlf -quiet -connect "$domain:1965" <<<"gemini://$domain/favicon.txt" 2>/dev/null | sed -e '1d')
+                       fav=$(timeout $connectto openssl s_client -crlf -quiet -connect "$domain:1965" <<<"gemini://$domain/favicon.txt" 2>/dev/null | sed -e '1d')
                        if [ ! -z "$fav" ];then
                                user="$fav $user"
                        fi
-                       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
+                       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
                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