-- 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: 307c24fb08c43b4b4638fd16fed685829922c3dc:
path_to:
revision_to:

git.thebackupbox.net

uritools

git://git.thebackupbox.net/uritools

commit 307c24fb08c43b4b4638fd16fed685829922c3dc
Author: epoch <epoch@hack.thebackupbox.net>
Date:   Fri Dec 3 15:30:11 2021 +0000

    dns URIs can now use the "class" param and added file URI support that outputs the mime-type

diff --git a/urititle b/urititle

index 18897847baaf989f945965a2566ef68795c5908c..

index ..efac51461726a7c8fdda64067c85f94442509f40 100755

--- a/urititle
+++ b/urititle
@@ -74,8 +74,13 @@ magnet)
   ;;
 dns)
   if [ "$qs" ] ; then
-    export QUERY_STRING="$qs"
-    type="-t $(query_param "type")"
+    export QUERY_STRING="$(printf "%s\n" "$qs" | tr 'A-Z' 'a-z' | tr ';' '&')"
+    if [ "$(query_param type)" ];then
+      type="-t $(query_param "type")"
+    fi
+    if [ "$(query_param class)" ];then
+      class="-c $(query_param "class")"
+    fi
   fi
   if [ "$domain" ];then
     server="@$domain"
@@ -83,7 +88,7 @@ dns)
   else
     server=""
   fi
-  dig $type "$path" +short $server | tr '\n' ' '
+  dig $class $type "$path" +short $server | tr '\n' ' '
   echo # the tr above strips out the trailing \n
   ;;
 ftp)
@@ -136,6 +141,14 @@ ssh)
   fi
   printf "title: %s\n" "$(printf "" | nc "$domain" "$port" | head -n1)"
   ;;
+file)
+  file="$(uriunescape "$path")"
+  if [ -e "$file" ];then
+    mime-type -v "$file"
+  else
+    printf "file '%s' doesn't exist.\n" "$file"
+  fi
+  ;;
 *)
   printf "DONT KNOW HOW TO GET TITLE FOR THIS URL: %s\n" "$1"
 esac

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

-- Response ended

-- Page fetched on Sun Jun 2 16:08:01 2024