X-Git-Url: https://software.frrobert.com/lace/blobdiff_plain/7c6c6abf41f724929802185a43362267a5c90529..HEAD:/lace diff --git a/lace b/lace index 3929cac..2b7ad41 100755 --- a/lace +++ b/lace @@ -90,28 +90,32 @@ function timeline() { url="$url/" 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') + timeout $connectto openssl s_client -crlf -quiet -connect "$domain:1965" <<<"$url" 2>/dev/null > $tmpfile3 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 > $tmpfile3 - local newuser=$(cat $tmpfile3 | sed -n '/# /{n;p;}' | grep -e author | awk '{print $2}' ) - local newavatar=$(cat $tmpfile3 | sed -n '/# /{n;n;p;}' | grep -e avatar | awk '{print $2}' ) + local newuser=$(cat $tmpfile3 | grep -m 1 author: | awk -F ":" '{print $2}' ) + local newavatar=$(cat $tmpfile3 | grep -m 1 avatar: | awk -F ":" '{print $2}' ) if [[ $newuser != "" ]] then - - user="$newavatar $newuser" + newuser=$(echo "$newuser" | xargs) + newavatar=$(echo "$newavatar" | xargs) + user="$newavatar $newuser" + else + 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 + fi cat $tmpfile3 | 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 + 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' > $tmpfile3 +cp $tmpfile3 $tmpfile # removed segment of code | sed "s/^\([0-9]\+\)$/{reldate \1 $now_unix;}/e" | sed "s/^\([0-9]* [a-z]* ago\)$/${esc}$blue\1${esc}$nc/g" while read line; do @@ -150,7 +154,7 @@ elif [[ "$1" == "unsub" ]];then elif [[ "$1" == "subs" ]];then awk '{print $2" ("$1")"}' $subsfile elif [[ "$1" == "update" ]];then - curl https://raw.githubusercontent.com/frrobert2/lace/main/lace > "${BASH_SOURCE[0]}" + curl https://gitlab.com/frrobert2/lace/-/raw/dev/lace > "${BASH_SOURCE[0]}" else now_unix="$(date +'%s')" if [[ "$1" == "nope" ]];then