summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc.txt10
-rwxr-xr-xlink.cgi23
2 files changed, 33 insertions, 0 deletions
diff --git a/doc.txt b/doc.txt
index 32f9ad9..6a196d0 100644
--- a/doc.txt
+++ b/doc.txt
@@ -29,6 +29,16 @@ the pulsating animation on the word "GEORGE" is disabled if the CSS prefers-redu
---
+GET https://george.gh0.pw/link.cgi?from=membername&dir=next|prev
+redirects to the page of the GEORGE member in the selected direction from the given member.
+this can be used if you want to construct your own GEORGE widget, for whatever reason.
+for example, if your member name is 'example', you could do something like
+<a href="https//george.gh0.pw/link.cgi?from=example&dir=next">NEXT</a>
+<a href="https//george.gh0.pw/link.cgi?from=example&dir=prev">PREV</a>
+and these links will always go to the right place relative to your current position in the webring.
+
+---
+
GET https://coral.shoes/george-status/george-status-json
returns current status information about the GEORGE webring, including which members currently haven't correctly embedded the GEORGE widget onto their page.
diff --git a/link.cgi b/link.cgi
new file mode 100755
index 0000000..c0b40a5
--- /dev/null
+++ b/link.cgi
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+from georgedata import george
+order = list(george.keys())
+
+from os import getenv
+from urllib.parse import parse_qs
+qs = getenv("QUERY_STRING")
+query = parse_qs(qs)
+try:
+ member = query["from"][0]
+ dir = query["dir"][0]
+ ind = order.index(member)
+ offs = {"next":1,"prev":-1}[dir]
+except (ValueError,KeyError):
+ print("Status: 400")
+ print("Content-Type: text/html")
+ print()
+ print("<h1 style=\"color:red\">bad request</h1>")
+else:
+ l=len(order)
+ m = george[order[(ind+offs)%l]]
+ print("Location: "+m)