Update server.py
This commit is contained in:
parent
23cdd2f7b0
commit
b61f1e4c38
1 changed files with 9 additions and 6 deletions
15
server.py
15
server.py
|
@ -12,15 +12,15 @@ def root():
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="https://swee.codes/style.css">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<title>Gem2Browser</title>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<h1>Gem2Browser</h1>
|
||||
<form action="/gem">
|
||||
<p style="font-size: 15pt;">gemini://<input class="input" value="geminiprotocol.net" type="text" name="gemini"></p><br>
|
||||
<input type="submit" class="download" value="Go!">
|
||||
<p>gemini://<input class="input" value="geminiprotocol.net" type="text" name="gemini"></p><br>
|
||||
<input type="submit" class="go" value="Go!">
|
||||
</form>
|
||||
</center>
|
||||
</body>
|
||||
|
@ -30,6 +30,9 @@ def root():
|
|||
def external():
|
||||
return send_file("external.png")
|
||||
@app.route("/cross-server.png")
|
||||
def crosserver():
|
||||
return send_file("cross-server.png")
|
||||
@app.route("/style.css")
|
||||
def crosserver():
|
||||
return send_file("cross-server.png")
|
||||
@app.route("/gem")
|
||||
|
@ -95,9 +98,9 @@ def relay():
|
|||
tempurl = "/".join(url.split("/")[:-1]) + "/" + goto
|
||||
goto = f"/gem?gemini={tempurl}"
|
||||
elif prse.scheme != "gemini":
|
||||
extra = "<img src=\"/external.png\">"
|
||||
extra = "<img height=\"6\" src=\"/external.png\">"
|
||||
elif prse.hostname != urlparse(fulladdr).hostname:
|
||||
extra = "<img src=\"/cross-server.png\">"
|
||||
extra = "<img height=\"6\" src=\"/cross-server.png\">"
|
||||
if temp.split(" ") == 1:
|
||||
comment = goto
|
||||
else:
|
||||
|
@ -109,7 +112,7 @@ def relay():
|
|||
title = "gemini://" + url
|
||||
except:
|
||||
code += traceback.format_exc()
|
||||
return f'<!DOCTYPE html>\n<html><head><meta charset="UTF-8"><link rel="stylesheet" href="https://swee.codes/style.css"><title>{title}</title></head><body>{code}</body></html>'
|
||||
return f'<!DOCTYPE html>\n<html><head><meta charset="UTF-8"><link rel="stylesheet" href="/style.css"><title>{title}</title></head><body>{code}</body></html>'
|
||||
|
||||
# Run the Hypercorn ASGI server
|
||||
conf = Config()
|
||||
|
|
Loading…
Add table
Reference in a new issue