From 3a1e67e948ca0b0bcfbf55b7157c22545f345a3e Mon Sep 17 00:00:00 2001 From: gotbletu Date: Fri, 15 Oct 2021 02:22:44 -0700 Subject: [PATCH] gopher web proxy --- w3m_plugins/cgi-bin/gopher.cgi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 w3m_plugins/cgi-bin/gopher.cgi diff --git a/w3m_plugins/cgi-bin/gopher.cgi b/w3m_plugins/cgi-bin/gopher.cgi new file mode 100755 index 0000000..6309f27 --- /dev/null +++ b/w3m_plugins/cgi-bin/gopher.cgi @@ -0,0 +1,25 @@ +#!/usr/bin/env sh +# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry|odysee) +# https://www.youtube.com/user/gotbletu +# DESC: gopher web proxy to connect over http +# DEMO: https://youtu.be/5zDZm6hvbQ8 +# REQD: 1. touch ~/.w3m/urimethodmap +# 2. echo "gopher: file:/cgi-bin/gopher.cgi?%s" >> ~/.w3m/urimethodmap +# 3. chmod +x ~/.w3m/cgi-bin/gopher.cgi +# 4. sed -i 's@cgi_bin.*@cgi_bin ~/.w3m/cgi-bin:/usr/lib/w3m/cgi-bin:/usr/local/libexec/w3m/cgi-bin@g' ~/.w3m/config +# 5. sed -i 's@urimethodmap.*@urimethodmap ~/.w3m/urimethodmap, /usr/etc/w3m/urimethodmap@g' ~/.w3m/config +# 6. touch ~/.w3m/siteconf +# 7. echo 'url m!^gopher?://!' >> ~/.w3m/siteconf +# 8. echo 'substitute_url "file:/cgi-bin/gopher.cgi?"' >> ~/.w3m/siteconf + +# gopher://bitreich.org/1/lawn +# gopher://hngopher.com/ +# gopher://bay.parazy.de:666 + +proxycheck() { curl --connect-timeout 1 -s -I "$1" | head -n1 | grep 200 > /dev/null && echo $? ;} + +if [ "$(proxycheck "https://gopher.floodgap.com/gopher/")" = 0 ]; then + echo "W3m-control: GOTO https://gopher.floodgap.com/gopher/gw?$QUERY_STRING" +else + echo "W3m-control: GOTO https://gopherproxy.meulie.net/$QUERY_STRING" +fi