💾 Archived View for qd.discordian.de captured on 2020-11-07 at 01:16:41. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2020-09-24)

➡️ Next capture (2021-11-26)

🚧 View Differences

-=-=-=-=-=-=-

!/usr/local/bin/python3

from howdoi import howdoi

import os

import urllib.parse

import sys

print("20 text/gemini\r\n")

serverName = os.getenv("SERVER_NAME")

if not serverName:

serverName = ""

serverPort = os.getenv("SERVER_PORT")

if not serverPort:

serverPort = ""

scriptName = "gemini://" + serverName + ":" + serverPort + "/cgi-bin/howdoi.cgi";

queryString_escaped = os.getenv("QUERY_STRING")

if not queryString_escaped:

queryString_escaped = ""

queryString_unescaped = ""

if queryString_escaped:

queryString_unescaped = urllib.parse.unquote(queryString_escaped)

if not queryString_escaped:

print("20 text/gemini; charset=UTF-8; lang=en_US", end = "\r\n")

print("# HowDoI for Gemini", end = "\r\n")

print("", end = "\n")

print("=> gemini://" + serverName + ":" + serverPort + "/ Home", end = "\n")

print("=> " + scriptName + "?search" + " Search", end = "\n")

elif queryString_escaped == "search":

print("10 Enter a Search Query:", end = "\r\n")

else:

query = queryString_unescaped

output = howdoi.howdoi(query)

print("20 text/gemini; charset=UTF-8; lang=en_US", end = "\n")

print("", end = "\n")

print(output, end = "\n")