From a08f848d56bc2a418999ef5d82fe6a006eb19d31 Mon Sep 17 00:00:00 2001 From: Redume Date: Wed, 23 Oct 2024 17:01:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=95=D1=81=D0=BB=D0=B8=20=D0=B2=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B5=20=D0=BD=D0=B5=D1=82=20?= =?UTF-8?q?=D1=82=D0=BE=D0=BA=D0=B5=D0=BD=D0=B0=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B0=D0=BD=D0=B0=D0=BB=D0=B8=D1=82=D0=B8=D0=BA=D0=B8,=20?= =?UTF-8?q?=D1=82=D0=BE=20=D0=BE=D0=BD=D0=B0=20=D0=BD=D0=B5=20=D0=B1=D1=83?= =?UTF-8?q?=D0=B4=D0=B5=D1=82=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D1=82?= =?UTF-8?q?=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 7815266..e087e51 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,5 @@ +import http + import uvicorn import yaml @@ -13,7 +15,8 @@ from src.routes import wallpaper app = FastAPI() -app.middleware('http')(PlausibleAnalytics()) +if config['analytics']['token']: + app.middleware('http')(PlausibleAnalytics()) app.include_router(index.router) app.include_router(wallpaper.router) @@ -34,7 +37,7 @@ async def robots_txt(): @app.exception_handler(404) async def not_found(req, __): - return FileResponse('./src/web/html/error/404.html') + return FileResponse('./src/web/html/error/404.html', status_code=http.HTTPStatus.NOT_FOUND) if __name__ == '__main__': uvicorn.run(app,