-- Leo's gemini proxy

-- Connecting to capsule.wetterberg.nu:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

HTTP Proxy for the smolnet ignorant 👋


Surprise, not everyone uses gemini! Sharing something with your friends is nice, but it's even better if they can read it. So I created a proxy that translates my gemini stuff to http/html.


This gemlog over HTTP

The code


One upside with this proxy is that it can be configured so that the http/gemini pages are completely symmetric. Swap out gemini:// for https:// and whatever you want to share is avaliable outside of the plaintext nerddom.


It also provides an option for following gemsub over HTTP & Atom, if a page contains gemsub links an Atom feed link will be added at the end.


The state of the thing


At the moment the proxy is dumb as dirt. It views all non-success statuses from gemini as errors (including redirects and input requests). Much of the markup generation is hardcoded, and it pretty much completely lacks any knobs to tweak except the ability to run under a different port when using plaintext HTTP. But it gets the job done for now.


Formatting test


list

items consectetur adipiscing elit. Duis suscipit mi purus, in auctor nulla posuere in.

ftw


gemini://example.com

Example link


> Quote: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis suscipit mi purus, in auctor nulla posuere in. Morbi commodo tellus ex, non ultricies lectus tempus eu. Suspendisse aliquam nisl orci, vel consequat purus ornare sed. Vivamus semper lectus ut mi maximus, et cursus ligula tincidunt. Morbi tristique aliquet arcu vitae dictum.


Some code


title := getGeminiTitle(text)
if title == "" {
	title = req.Host
}

feedURL := req.URL.String() + ".gemsub.atom"

gp.render(w, "header", struct {
	Title   string
	FeedURL string
}{title, feedURL})

-- Response ended

-- Page fetched on Thu Apr 25 06:26:07 2024