diff --git a/litecord/blueprints/static.py b/litecord/blueprints/static.py index 8c5ae01..8b901c5 100644 --- a/litecord/blueprints/static.py +++ b/litecord/blueprints/static.py @@ -1,4 +1,4 @@ -from quart import Blueprint, current_app as app +from quart import Blueprint, current_app as app, render_template_string from pathlib import Path bp = Blueprint('static', __name__) @@ -6,8 +6,16 @@ bp = Blueprint('static', __name__) @bp.route('/') async def static_pages(path): + """Map requests from / to /static.""" if '..' in path: return 'no', 404 static_path = Path.cwd() / Path('static') / path return await app.send_static_file(str(static_path)) + + +@bp.route('/') +async def index_handler(): + """Handler for the index page.""" + index_path = Path.cwd() / Path('static') / 'index.html' + return await render_template_string(index_path.read_text()) diff --git a/run.py b/run.py index 0fdd6f1..d5b7888 100644 --- a/run.py +++ b/run.py @@ -335,9 +335,3 @@ async def handle_500(err): 'message': repr(err), 'internal_server_error': True, }), 500 - - -@app.route('/') -async def index(): - """sample index page.""" - return 'hewwo' diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..f86e5cd --- /dev/null +++ b/static/index.html @@ -0,0 +1,25 @@ +{% block body %} +
+

+ welcome to a Litecord instance +

+ +

+ Litecord is server software that implements + the Discord API. +

+ +

+ It supports nodeinfo, despise not being part + in any federated network. +

+ +

+ Litecord source code +

+

+ This instance's nodeinfo +

+ +
+{% endblock%}