Update server.py

This commit is contained in:
Nova Cat 2025-01-13 16:27:15 -08:00
parent 501d87bfa3
commit 8dc5d8398c

View file

@ -1,7 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
import asyncio, traceback, socket, ssl import asyncio, traceback, socket, ssl
from urllib.parse import urlparse from urllib.parse import urlparse
from flask import Flask, request, redirect, send_file from flask import Flask, request, redirect, send_file, Response
from hypercorn.config import Config from hypercorn.config import Config
from hypercorn.asyncio import serve from hypercorn.asyncio import serve
app = Flask(__name__) app = Flask(__name__)
@ -69,7 +69,7 @@ def relay():
else: else:
firstline = False firstline = False
if i.split(" ")[1] != "text/gemini": if i.split(" ")[1] != "text/gemini":
return " ".join(received.split("\n")[1:]) return Response(" ".join(received.split("\n")[1:]), mimetype=i.split(" ")[1])
else: else:
if i[0:2] == "# ": if i[0:2] == "# ":
if title == "Something went wrong...": if title == "Something went wrong...":