commit c9d588e7e168dbc785d9ce5fa52c34b20a8da817
parent 8ce3f4d55921e668a413db6242496e8f3e30dab3
Author: Natalie Pendragon <natpen@natpen.net>
Date: Tue, 12 May 2020 08:18:40 -0400
[serve] Add page to show all known hosts
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/gus/serve.py b/gus/serve.py
@@ -58,12 +58,26 @@ def _render_index_statistics():
return d
+def _render_known_hosts():
+ d = [
+ "",
+ "# Known Gemini Hosts",
+ "",
+ "These are the hosts in Geminispace that GUS is aware of. Note that this list is auto-generated from the index, so if your host is not showing up here, it also won't have its content represented in GUS search results! There is a link at the bottom to add your host to the list of seeds for the next crawl of Geminispace though, after which your host should start showing up.",
+ "",
+ ]
+ for domain in last_index_statistics["domains"]:
+ d.append("=> {}".format(domain))
+ return d
+
+
@app.route("")
def index(request):
data = _render_header()
data.extend([
"=> /about About GUS",
"=> /statistics GUS Statistics",
+ "=> /known-hosts Known Gemini Hosts",
"=> gemini://gemini.circumlunar.space Gemini Project information"
])
data.extend(_render_footer())
@@ -119,6 +133,14 @@ def index(request):
return Response(Status.SUCCESS, "text/gemini", "\n".join(data))
+@app.route("/known-hosts")
+def index(request):
+ data = _render_header()
+ data.extend(_render_known_hosts())
+ data.extend(_render_footer())
+ return Response(Status.SUCCESS, "text/gemini", "\n".join(data))
+
+
def _search_index(query):
query = MultifieldParser(["content", "url", "prompt"], ix.schema).parse(query)
results = searcher.search(query)