From d38c2cd40d7fe574bbbf9f31d8f62b78724592f8 Mon Sep 17 00:00:00 2001 From: nathansmith117 Date: Sun, 16 Mar 2025 14:38:33 -0600 Subject: Be crime do gay --- cgi-bin/webring_redirect.cgi | 96 +++++++++++++++++++++++++++++++++++++++++++ guest_book.json | 8 ++++ images/do_gay.png | Bin 0 -> 2471 bytes images/pride.png | Bin 0 -> 1637 bytes index.html | 15 +++++++ 5 files changed, 119 insertions(+) create mode 100755 cgi-bin/webring_redirect.cgi create mode 100644 guest_book.json create mode 100644 images/do_gay.png create mode 100644 images/pride.png diff --git a/cgi-bin/webring_redirect.cgi b/cgi-bin/webring_redirect.cgi new file mode 100755 index 0000000..2b114cc --- /dev/null +++ b/cgi-bin/webring_redirect.cgi @@ -0,0 +1,96 @@ +#! /usr/bin/env python + +import cgi +import requests +import random +import json + +WEBSITE_URL = "http://nathansmith117.beevomit.org" + +def handle_be_crime_do_gay_webring(): + try: + # https://codeberg.org/artemislena/artemislena.eu#be-crime-do-gay-webring + req = requests.get("https://artemislena.eu/services/downloads/beCrimeDoGay.json", timeout=5) + req.raise_for_status + return req.json() + except requests.exceptions.Timeout: + return "Status: 503 Service Unavailable" + except Exception: + return "Status: 500 Internal Error" + +def handle_fields(): + form = cgi.FieldStorage() + + # Name of the webring name and direction. + name = form.getvalue("name") + direction = form.getvalue("direction") + + if name is None or direction is None: + return "Not enough optinos" + + # Callbacks to handle webrings. + webrings = { + "gay": handle_be_crime_do_gay_webring + } + + website_list = webrings[name]() + + if website_list == None or website_list == []: + return "Can't get website list for webring" + if type(website_list) is str: + return website_list + + # Find this website in webring. + position = 0 + + try: + position = website_list.index(WEBSITE_URL) + except ValueError: + return "Website not in webring" + + # Handle direction + redirect_website = "" + + if direction == "next": + redirect_website = website_list[(position + 1) % len(website_list)] + elif direction == "previous": + redirect_website = website_list[(position - 1) % len(website_list)] + elif direction == "random": + website_list.pop(position) + redirect_website = random.choice(website_list) + else: + return "Invalid direction" + + return [ + f"redirecting to {redirect_website}", + f"" + ] + +def display_html(fields_reponse): + print("Content-Type: text/html") + + html_text = """ + + + + + {redirect} + Webrings + + + + {fields_reponse} + + + """ + + if type(fields_reponse) is list: + html_text = html_text.format(fields_reponse=fields_reponse[0], redirect=fields_reponse[1]) + else: + html_text = html_text.format(fields_reponse=fields_reponse, redirect="") + + print(html_text) + +fields_reponse = handle_fields() +display_html(fields_reponse) + diff --git a/guest_book.json b/guest_book.json new file mode 100644 index 0000000..61b79f2 --- /dev/null +++ b/guest_book.json @@ -0,0 +1,8 @@ +[ + { + "name": "d", + "url": "", + "message": "d", + "date": "March, 16 2025" + } +] \ No newline at end of file diff --git a/images/do_gay.png b/images/do_gay.png new file mode 100644 index 0000000..d0b4dd6 Binary files /dev/null and b/images/do_gay.png differ diff --git a/images/pride.png b/images/pride.png new file mode 100644 index 0000000..1871829 Binary files /dev/null and b/images/pride.png differ diff --git a/index.html b/index.html index cdbf68f..cc16b17 100644 --- a/index.html +++ b/index.html @@ -95,6 +95,9 @@ table { a gray Windows 95 style dialog box titled 'The No AI Webring' with a little icon showing a computer chip in a rubbish bin. beside it are three clickable buttons, labeled Previous, Random... and Next +

+ +
@@ -102,6 +105,18 @@ table { rand next
+ +

+ + +
+ + pride flag + + prev + rand + next +
-- cgit v1.2.3