diff --git a/news/__pycache__/pool.cpython-312.pyc b/news/__pycache__/pool.cpython-312.pyc index b30e1df..31d0778 100644 Binary files a/news/__pycache__/pool.cpython-312.pyc and b/news/__pycache__/pool.cpython-312.pyc differ diff --git a/news/__pycache__/server.cpython-312.pyc b/news/__pycache__/server.cpython-312.pyc index 50389b6..b5319d9 100644 Binary files a/news/__pycache__/server.cpython-312.pyc and b/news/__pycache__/server.cpython-312.pyc differ diff --git a/news/main.py b/news/main.py index ffb4539..be43c6f 100644 --- a/news/main.py +++ b/news/main.py @@ -355,12 +355,12 @@ async def main(): raise RuntimeError("Set the DISCORD_TOKEN environment variable or add it to a .env file.") try: - web_task = server.app.run_task(host="0.0.0.0", port=8000, debug=False) - discord_task = start_discord() + web_task = asyncio.create_task(server.app.run_task(host="0.0.0.0", port=8000, debug=False)) + discord_task = asyncio.create_task(start_discord()) - await asyncio.gather(web_task, discord_task) + await asyncio.wait({web_task, discord_task}, return_when=asyncio.FIRST_COMPLETED) finally: - await PlaywrightPool.stop() + # await PlaywrightPool.stop() server.article_repository.close() if not bot.is_closed(): diff --git a/news/server.py b/news/server.py index f61e84e..628b381 100644 --- a/news/server.py +++ b/news/server.py @@ -1,4 +1,4 @@ -from quart import Quart, request, jsonify, abort +from quart import Quart, request, jsonify, abort, send_from_directory from pathlib import Path import logging @@ -12,6 +12,10 @@ article_repository = ArticleRepository() LOGGER = logging.getLogger("server") +@app.route("/") +async def index(): + return await send_from_directory("static", "index.html") + @app.route("/health") async def health(): return {"status": "ok"} diff --git a/news/static/index.html b/news/static/index.html new file mode 100644 index 0000000..e69de29