diff options
| -rw-r--r-- | Makefile | 1 | ||||
| -rwxr-xr-x | copy_start_nevermind.sh | 6 | ||||
| -rwxr-xr-x | urnresolve | 35 | 
3 files changed, 41 insertions, 1 deletions
| @@ -43,5 +43,6 @@ install: all  	install -t $(PREFIX)/bin data_handler  	install -t $(PREFIX)/bin unshorten.sh  	install -t $(PREFIX)/bin shorten +	install -t $(PREFIX)/bin urnresolve  	install -t $(PREFIX)/bin urnstart  	chgrp shorten $(PREFIX)/bin/shorten && chmod g+s $(PREFIX)/bin/shorten diff --git a/copy_start_nevermind.sh b/copy_start_nevermind.sh index 0e4b60f..3f7f7af 100755 --- a/copy_start_nevermind.sh +++ b/copy_start_nevermind.sh @@ -5,7 +5,7 @@ if [ "${uri}" != "${uri:0:64}" ];then    prompt="${uri:0:64}..."  fi  scheme="$(uricut -s <<< "$uri")" -selection="$(printf "start with: %s\ncopy\nshorten\nverbose\nforget\n%s\n" "$(urigetline "$uri")" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \ +selection="$(printf "start with: %s\ncopy\nshorten\nverbose\nforget\nQR\n%s\n" "$(urigetline "$uri")" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \               | choose "${prompt}")"  #            | choose "$(printf "uri: '%s'\nwill be ran with: %s\n" "$uri" "$(urigetline "$uri")" )" -default start )"  echo "$selection" @@ -44,6 +44,10 @@ shorten)    exit 0    ;; +QR) +  x-terminal-emulator -hold -e qr "$uri" +  ;; +  *)    exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i    ;; diff --git a/urnresolve b/urnresolve new file mode 100755 index 0000000..864859b --- /dev/null +++ b/urnresolve @@ -0,0 +1,35 @@ +#!/bin/sh +echo "urnstart: working on:" "$1" >&2 +urn="$(printf '%s\n' "$1" | cut -d: -f1)" +if [ "$urn" != "urn" ];then +  echo "this isn't a urn. wtf are you waking me up for? I'm going back to bed. fuck this shit." >&2 +  exit 1 +fi + +nid="$(printf '%s\n' "$1" | cut -d: -f2)" +nss="$(printf '%s\n' "$1" | cut -d: -f3)" +nss2="$(printf '%s\n' "$1" | cut -d: -f4-)" + +if [ "$nid" = "anonet" ];then +  if [ "$nss" = "asn" ];then +    echo "whois://whois.ano/AS${nss2}" +  elif [ "$nss" = "ip4" -o "$nss" = "ip6" -o "$nss" = "dom" ];then +    echo "whois://whois.ano/${nss2}" +  fi +fi + +if [ "$nid" = "ietf" ];then +  if [ "$nss" = "rfc" ];then +    echo gopher://thebackupbox.net:70/0/rfc/rfc${nss2}.txt +  fi +fi + +if [ "$nid" = "xkcd" ];then +  echo "https://xkcd.com/${nss}" +fi + +if [ "$nid" = "fcc" ];then +  if [ "$nss" = "frs" ];then +    grep "^$nss2\s" $PREFIX/share/urn/fcc:frs | cut -f2 +  fi +fi | 
