commit 0c2f3847e885cd7c1914e6f9445e6ca0c43ea117 parent b57eb13700ea5067c20a7f9a0ebd5d06c1dca28f Author: Alex Balgavy <alex@balgavy.eu> Date: Sat, 31 Jul 2021 11:45:20 +0200 w3m: add gemini support via proxies Diffstat:
A | surfraw/elvi/geminispace | | | 26 | ++++++++++++++++++++++++++ |
A | w3m/cgi-bin/gemini.cgi | | | 15 | +++++++++++++++ |
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/surfraw/elvi/geminispace b/surfraw/elvi/geminispace @@ -0,0 +1,26 @@ +#!/bin/sh +# AUTHOR: thezeroalpha +# +# DATE: 2021-07-31 +# +# DESC: Elvi to search Gemini space +# elvis: geminispace -- Search Geminispace (geminispace.info) +. surfraw || exit 1 + +w3_usage_hook () { + cat <<EOF +Usage: $w3_argv0 [options] [search words]... +Description: + Search Geminispace (geminispace.info) +EOF + w3_global_usage +} + +w3_config +w3_parse_args "$@" +if test -z "$w3_args"; then + w3_browse_url "gemini://geminispace.info" +else + escaped_args=`w3_url_of_arg $w3_args` + w3_browse_url "gemini://geminispace.info/search?${escaped_args}" +fi diff --git a/w3m/cgi-bin/gemini.cgi b/w3m/cgi-bin/gemini.cgi @@ -0,0 +1,15 @@ +#!/bin/sh +# gemini://gempaper.strangled.net/mirrorlist/ +# gemini://simplynews.metalune.xyz +# gemini://geminispace.info/search?tmux + +# remove gemini:// header +QUERY_STRING=${QUERY_STRING#gemini://} + +testproxy() { curl --connect-timeout 1 -s -I -w '%{http_code}' "$1" | head -n1 | grep 200 > /dev/null; } + +if testproxy "https://portal.mozz.us/about"; then + echo "W3m-control: GOTO https://portal.mozz.us/gemini/$QUERY_STRING" +else + echo "W3m-control: GOTO https://proxy.vulpes.one/gemini/$QUERY_STRING" +fi