25 lines
465 B
Bash
Executable File
25 lines
465 B
Bash
Executable File
#!/bin/sh
|
|
|
|
#required: socat
|
|
|
|
if [ -z "$i" ];then
|
|
if [ -n "$1" ];then #if command-line argument
|
|
i="$1"
|
|
else #ask user
|
|
printf "gemini:// URL: " >&2;
|
|
read -r i;
|
|
fi
|
|
fi
|
|
if [ -n "$i" ];then
|
|
echo "$i"|cut -d / -f 3-|{
|
|
read -r a
|
|
domain="$(echo "$a"|cut -d / -f 1)"
|
|
url="$(echo "$a"|cut -d / -f 2-)"
|
|
printf "%s\r\n" "gemini://$domain/$url"|
|
|
socat openssl-connect:"$domain":1965,verify=0 stdio,ignoreeof
|
|
}
|
|
else
|
|
echo "no gemini:// url detected!"
|
|
fi
|
|
i=""
|