Update server.py
This commit is contained in:
parent
9a23e0ff24
commit
90cb7e93fe
1 changed files with 6 additions and 3 deletions
|
@ -92,6 +92,7 @@ def relay():
|
||||||
prse = urlparse(goto)
|
prse = urlparse(goto)
|
||||||
extra = ""
|
extra = ""
|
||||||
print(goto)
|
print(goto)
|
||||||
|
extracomment = goto
|
||||||
if prse.netloc == "" and prse.scheme == "":
|
if prse.netloc == "" and prse.scheme == "":
|
||||||
isdir = url[len(url) - 1] == "/"
|
isdir = url[len(url) - 1] == "/"
|
||||||
if isdir:
|
if isdir:
|
||||||
|
@ -102,17 +103,19 @@ def relay():
|
||||||
goto = f"/gem?gemini={tempurl}"
|
goto = f"/gem?gemini={tempurl}"
|
||||||
print(goto)
|
print(goto)
|
||||||
elif prse.scheme != "gemini":
|
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:
|
else:
|
||||||
if prse.hostname != urlparse(fulladdr).hostname:
|
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 = goto.replace("gemini://", "")
|
||||||
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:])
|
||||||
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:
|
else:
|
||||||
code += f"<p>{i}</p>\n"
|
code += f"<p>{i}</p>\n"
|
||||||
if title == "Something went wrong...":
|
if title == "Something went wrong...":
|
||||||
|
|
Loading…
Add table
Reference in a new issue