Update server.py

This commit is contained in:
Nova Cat 2025-01-13 16:17:08 -08:00
parent 9a23e0ff24
commit 90cb7e93fe

View file

@ -92,6 +92,7 @@ def relay():
prse = urlparse(goto)
extra = ""
print(goto)
extracomment = goto
if prse.netloc == "" and prse.scheme == "":
isdir = url[len(url) - 1] == "/"
if isdir:
@ -102,17 +103,19 @@ def relay():
goto = f"/gem?gemini={tempurl}"
print(goto)
elif prse.scheme != "gemini":
extra = "<img height=\"6\" src=\"/external.png\">"
extra = "<img height=\"12\" src=\"/external.png\">"
extracomment = f"This link points to an address that isn't gemini ({prse.scheme})"
else:
if prse.hostname != urlparse(fulladdr).hostname:
extra = "<img height=\"6\" src=\"/cross-server.png\">"
extra = "<img height=\"12\" src=\"/cross-server.png\">"
extracomment = f"This link points to an address that isn't from the server you're currently connecting to ({prse.hostname})"
goto = goto.replace("gemini://", "")
goto = f"/gem?gemini={goto}"
if temp.split(" ") == 1:
comment = goto
else:
comment = " ".join(temp.split(" ")[1:])
code += f"<p><a href=\"{goto}\">{comment} {extra}</a></p>\n"
code += f"<p title=\"{extracomment}\"><a href=\"{goto}\">{comment} {extra}</a></p>\n"
else:
code += f"<p>{i}</p>\n"
if title == "Something went wrong...":