-- 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: 59d1d3ebd78cb17d443877179c5fc9d74383a9d5:
path_to:
revision_to:

git.thebackupbox.net

uritools

git://git.thebackupbox.net/uritools

commit 59d1d3ebd78cb17d443877179c5fc9d74383a9d5
Author: epoch <epoch@hacking.allowed.org>
Date:   Sat Nov 2 05:44:17 2019 -0500

    commented out weird derp+merp scheme code. added urilaunch which is meant to be done similar to how dmenu_run gets launched. I use alt+u

diff --git a/urilaunch b/urilaunch
new file mode 100644
index 0000000000000000000000000000000000000000..a3495026b462bb7c38ea47cc14cae8aaf8848ded
--- /dev/null
+++ b/urilaunch
@@ -0,0 +1,3 @@
+#!/bin/sh
+#uristart.log /should/ already be uniq'd because of uristart's code now, but might as well not rely on it.
+uristart $(cat ~/.cache/uristart.log | sort | uniq | dmenu -p url\> | cut '-d ' -f1)
diff --git a/uristart b/uristart

index fdea9441e7cd560c79a3db69e6bccc898a614ae1..

index ..08eede342bc07c8f20ca7b19d6a7f78033fb170d 100755

--- a/uristart
+++ b/uristart
@@ -1,24 +1,26 @@
 #!/bin/bash
 ##might have to configure me.
 ASKUSER="dmenu -p"
-uri=$1
+uri="${1}"
 scheme="$(printf "%s\n" "$uri" | uricut -s)"
-if grep '\+' <<< "$scheme" 2>&1 >/dev/null;then
-  echo "dunno wtf yet"
-  scheme1="$(printf "%s\n" "$scheme" | cut -d+ -f1)+"
-  scheme2="+$(printf "%s\n" "$scheme" | cut -d+ -f2)"
-  echo $scheme1
-  echo $scheme2
-  line1="$(grep "^${scheme1}"$'\t' ~/.config/uristart.conf | cut -d: -f2- | sed 's/^[ \t]//g')"
-  line2="$(grep "^${scheme2}"$'\t' ~/.config/uristart.conf | cut -d: -f2- | sed 's/^[ \t]//g')"
-  echo $line1
-  echo $line2
-  pipeline1="$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line1")"
-  pipeline2="$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line2")"
-  echo $pipeline1
-  echo $pipeline2
-  socat "exec:bash -c 'eval \"$pipeline1\"'" "exec:bash -c 'eval \"$pipeline2\"'"
-else
+### experimental crap.. let's comment it out for now.
+#if grep '\+' <<< "$scheme" 2>&1 >/dev/null;then
+#  echo "dunno wtf yet"
+#  scheme1="$(printf "%s\n" "$scheme" | cut -d+ -f1)+"
+#  scheme2="+$(printf "%s\n" "$scheme" | cut -d+ -f2)"
+#  echo $scheme1
+#  echo $scheme2
+#  line1="$(grep "^${scheme1}:"$'\t' ~/.config/uristart.conf | tr -s '\t ' | cut -f2- | sed 's/^[ \t]//g' | sed 's/\\n/\\\\n/g')"
+#  line2="$(grep "^${scheme2}:"$'\t' ~/.config/uristart.conf | tr -s '\t ' | cut -f2- | sed 's/^[ \t]//g' | sed 's/\\n/\\\\n/g')"
+#  echo $line1
+#  echo $line2
+#  pipeline1="$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line1" )"
+#  pipeline2="$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line2" )"
+#  echo "$pipeline1"
+#  echo "$pipeline2"
+#  mknod /tmp/p p
+#  cat /tmp/p | bash -xc "$pipeline1" | bash -xc "$pipeline2" > /tmp/p
+#else
   line="$(grep "^${scheme}:" ~/.config/uristart.conf | cut -d: -f2- | sed 's/^[ \t]//g')"
   if printf "%s\n" "$uri" | urimatch nP >/dev/null;then
     proto="$(grep ^"$scheme"'[\t ]' /etc/services | tr -s '\t ' | cut -f2 | cut -d/ -f1 | head -n1)"
@@ -45,5 +47,10 @@ else
     fi
     printf '%s:\t%s\n' "${scheme}" "${line}" >> ~/.config/uristart.conf
   fi
+  ## uri *might* contain pattern matching special characters. :/
+  ## which could break things in weird and exciting ways
+  if ! cut '-d ' -f1 ~/.cache/uristart.log | grep -Fx "$uri" 2>&1 >/dev/null;then #only log URIs that aren't already listed
+    printf "%s\n" "$uri" >> ~/.cache/uristart.log
+  fi
   eval "$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line")"
-fi
+#fi

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

-- Response ended

-- Page fetched on Sun Jun 2 17:23:31 2024