diff --git a/src/pyfiche/classes/lines.py b/src/pyfiche/classes/lines.py index 59cf4d1..4fa8149 100644 --- a/src/pyfiche/classes/lines.py +++ b/src/pyfiche/classes/lines.py @@ -46,6 +46,13 @@ body {{ """ + INDEX_CONTENT = BASE_HTML.format( + content="""

PyFiche Lines

+

Welcome to PyFiche Lines, a HTTP server for PyFiche.

+

PyFiche Lines is a HTTP server for PyFiche. It allows you to view files uploaded through PyFiche in your browser.

+

For more information, see the PyFiche Git repo.

""" + ) + server_version = "PyFiche Lines/dev" def do_POST(self): @@ -162,6 +169,16 @@ body {{ url = urlparse(self.path.rstrip("/")) + # If the URL is /, display the index page + if url.path == "/": + self.send_response(200) + self.send_header("Content-Type", "text/html") + self.send_header("Content-Length", len(self.INDEX_CONTENT)) + self.end_headers() + + self.wfile.write(self.INDEX_CONTENT.encode("utf-8")) + return + # Discard any URLs that aren't of the form / or //raw if not len(url.path.split("/")) in [2, 3]: return self.not_found()