diff --git a/app.py b/app.py index 8d7724d..025d2bf 100644 --- a/app.py +++ b/app.py @@ -5,7 +5,15 @@ from functools import wraps mimetypes.init() mimetypes.add_type("text/gemini",".gmi") +# The amount of recent entries to show on the homepage RECENT_ENTRIES_COUNT = 20 + +# Ships whose descriptions need to be quoted in a pre text block. Key is ship name, value is alt text. +DESC_PRE_SHIPS = { + "anon.hmm.st": """An ascii banner split in two halves. The left half reads "anon.hmm.st" in a figlet font. The right half lists the server as AnonServ 0.9.infinity, the readable frontends as QEC, Gemini, Gopher, and Web, as well as listing Email as a write-only frontend. The description under these listings reads "'Sup losers, it's your boy Phantom Override back at it again. They got us once but they'll never find us out amongst the stars. Lose lose." At the bottom of the banner it lists the email address for submissions, which is anonhmmst@cosmic.voyage.""" +} + +# Utility lambda to get line count LINE_COUNT = lambda fn: int((subprocess.run(["/usr/bin/wc","-l",fn],stdout=subprocess.PIPE).stdout or b"-1 somethingswrong").decode("utf-8").split()[0]) class DefaultToGopher(JetforceApplication): @@ -151,7 +159,13 @@ def ship(request,ship=None): def __generator(): description = os.path.join("/var/gopher",ship_unquoted,".description") if os.path.exists(description): + if ship_unquoted in DESC_PRE: + yield "```" + yield DESC_PRE[ship_unquoted] + yield "\n" yield from app.load_file(description) + if ship_unquoted in DESC_PRE: + yield "```" yield "\n" if os.path.exists(os.path.join("/var/gopher",ship_unquoted,"ABOUT")): yield f"=> /{ship}/ABOUT About {ship_unquoted}\n"