Update server.py

This commit is contained in:
Nova Cat 2025-01-13 16:19:28 -08:00
parent a3eef76bee
commit adcf698955

View file

@ -65,11 +65,11 @@ def relay():
if i.split(" ")[0][0] == "3":
return redirect("/gem?gemini=" + i.split(" ")[1][9:])
elif i.split(" ")[0][0] != "2":
return f'<!DOCTYPE html>\n<html><head><meta charset="UTF-8"><link rel="stylesheet" href="https://swee.codes/style.css"><title>Something went wrong...</title></head><body><h1>Something went wrong...</h1><p>The specified Gemini server returned a status of: {i}</p></body></html>'
return f'<!DOCTYPE html>\n<html><head><meta charset="UTF-8"><link rel="stylesheet" href="/style.css"><title>Something went wrong...</title></head><body><h1>Something went wrong...</h1><p>The specified Gemini server returned a status of: {i}</p></body></html>'
else:
firstline = False
if i.split(" ")[1] != "text/gemini":
return f'<!DOCTYPE html>\n<html><head><meta charset="UTF-8"><link rel="stylesheet" href="https://swee.codes/style.css"><title>Something went wrong...</title></head><body><h1>Something went wrong...</h1><p>This path returned a file that isn\'t Gemtext, which Gem2Browser doesn\'t support downloading files.</p></body></html>'
return f'<!DOCTYPE html>\n<html><head><meta charset="UTF-8"><link rel="stylesheet" href="/style.css"><title>Something went wrong...</title></head><body><h1>Something went wrong...</h1><p>This path returned a file that isn\'t Gemtext, which Gem2Browser doesn\'t support downloading files.</p></body></html>'
else:
if i[0:2] == "# ":
if title == "Something went wrong...":
@ -113,6 +113,8 @@ def relay():
else:
comment = " ".join(temp.split(" ")[1:])
code += f"<p title=\"{extracomment}\"><a href=\"{goto}\">{comment} {extra}</a></p>\n"
elif i[0:2] == ">":
code += f"<p class='greentext'>{i}</p>\n"
else:
code += f"<p>{i}</p>\n"
if title == "Something went wrong...":