Update server.py

This commit is contained in:
Nova Cat 2025-01-13 22:09:09 -08:00
parent f4aef49b1b
commit 957c95e378

View file

@ -126,6 +126,7 @@ def relay():
tempurl = url + goto tempurl = url + goto
else: else:
tempurl = "/".join(url.split("/")[:-1]) + "/" + goto tempurl = "/".join(url.split("/")[:-1]) + "/" + goto
tempurl = quote(tempurl, safe='')
goto = f"/gem?gemini={tempurl}" goto = f"/gem?gemini={tempurl}"
elif prse.scheme != "gemini": elif prse.scheme != "gemini":
extra = "<img height=\"19\" src=\"/external.png\">" extra = "<img height=\"19\" src=\"/external.png\">"
@ -135,12 +136,12 @@ def relay():
extra = "<img height=\"19\" src=\"/cross-server.png\">" extra = "<img height=\"19\" 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})" 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 = goto.replace("gemini://", "")
goto = quote(goto, safe='')
goto = f"/gem?gemini={goto}" goto = f"/gem?gemini={goto}"
if temp.split(" ") == 1: if temp.split(" ") == 1:
comment = goto comment = goto
else: else:
comment = " ".join(temp.split(" ")[1:]) comment = " ".join(temp.split(" ")[1:])
goto = quote(goto, safe='')
code += f"<p title=\"{extracomment}\"><a href=\"{goto}\">{comment} {extra}</a></p>\n" code += f"<p title=\"{extracomment}\"><a href=\"{goto}\">{comment} {extra}</a></p>\n"
elif i[0:2] == "> ": elif i[0:2] == "> ":
code += f"<p class='greentext'>{i}</p>\n" code += f"<p class='greentext'>{i}</p>\n"