-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: uritools
action: commit
revision:
path_from:
revision_from: 840a373b74a8202801126af195177b9964e8377a:
path_to:
revision_to:

git.thebackupbox.net

uritools

git://git.thebackupbox.net/uritools

commit 840a373b74a8202801126af195177b9964e8377a
Author: epoch <epoch@hack.thebackupbox.net>
Date:   Mon Oct 19 01:36:21 2020 +0000

    added support for gopher links of type 1 and 0

diff --git a/urititle b/urititle

index 6367473d8db77b048db305b2dc12a5dbac498f6c..

index ..7b159da1b38966a65a1cb836f50fd4287327c7df 100755

--- a/urititle
+++ b/urititle
@@ -59,6 +59,16 @@ magnet)
 ftp)
   curl "$1" 2>&1 | tail -n1
   ;;
+gopher)
+  type="$(printf "%s\n" "$1" | uricut -p | cut -b2- | cut -b1)"
+  if [ "$type" = 1 -o "$type" = "" ];then
+    printf "title: %s\n" "$(curl -s "$1" | grep ^i | head -n1 | cut -f1 | cut -b2-)"
+  elif [ "$type" = 0 ];then
+    printf "title: %s\n" "$(curl -s "$1" | head -n1)"
+  else
+    printf "title: don't know how to get title of non-1 gopher links"
+  fi
+  ;;
 ssh)
   if [ ! "$port" ];then
     port=22

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 15:05:26 2024