Commit 2852f57f authored by Luna's avatar Luna 📟

static: add handler for index using jinja / render_template

 - static: add index.html
 - run: remove index handler
parent 2ac2ac26
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__)
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))
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())
......@@ -335,9 +335,3 @@ async def handle_500(err):
'message': repr(err),
'internal_server_error': True,
}), 500
async def index():
"""sample index page."""
return 'hewwo'
{% 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.
<a href="">Litecord source code</a>
<a href="{{request.protocol}}/nodeinfo/2.0.json">This instance's nodeinfo</a>
{% endblock%}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment