diff --git a/deploy/pytorrent.service b/deploy/pytorrent.service index 0374ac4..253a061 100644 --- a/deploy/pytorrent.service +++ b/deploy/pytorrent.service @@ -13,7 +13,7 @@ Group=pytorrent WorkingDirectory=/opt/pyTorrent Environment="PYTHONUNBUFFERED=1" EnvironmentFile=/opt/pyTorrent/.env -ExecStart=/opt/pyTorrent/venv/bin/gunicorn --worker-class gthread --workers 1 --threads 32 --bind ${PYTORRENT_HOST}:${PYTORRENT_PORT} --access-logfile - --error-logfile - wsgi:app +ExecStart=/opt/pyTorrent/venv/bin/gunicorn -c /opt/pyTorrent/gunicorn.conf.py --worker-class gthread --workers 1 --threads 32 --bind ${PYTORRENT_HOST}:${PYTORRENT_PORT} --access-logfile - --error-logfile - wsgi:app Restart=always RestartSec=3 KillSignal=SIGINT diff --git a/gunicorn.conf.py b/gunicorn.conf.py new file mode 100644 index 0000000..2c44506 --- /dev/null +++ b/gunicorn.conf.py @@ -0,0 +1,2 @@ +import gunicorn +gunicorn.SERVER_SOFTWARE = "pyTorrent" \ No newline at end of file diff --git a/pytorrent/__init__.py b/pytorrent/__init__.py index 89a45e2..7e63408 100644 --- a/pytorrent/__init__.py +++ b/pytorrent/__init__.py @@ -64,9 +64,7 @@ def create_app() -> Flask: if request.endpoint == "static": response.headers["Cache-Control"] = "public, max-age=31536000, immutable" else: - response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" - response.headers["Pragma"] = "no-cache" - response.headers["Expires"] = "0" + response.headers["Cache-Control"] = "no-store, private" return response from .routes.main import bp as main_bp diff --git a/pytorrent/routes/main.py b/pytorrent/routes/main.py index add9c09..f1f1ffa 100644 --- a/pytorrent/routes/main.py +++ b/pytorrent/routes/main.py @@ -325,4 +325,4 @@ def openapi(): if path != "/api/auth/login": for operation in methods.values(): operation.setdefault("security", [{"sessionCookie": []}]) - return jsonify({"openapi": "3.0.3", "info": {"title": "pyTorrent API", "version": "0.2.0"}, "paths": paths, "components": components}) + return jsonify({"openapi": "3.0.3", "info": {"title": "pyTorrent API", "version": "0.0.1"}, "paths": paths, "components": components}) diff --git a/systemd/pytorrent.service b/systemd/pytorrent.service index 4f22db5..28e3291 100644 --- a/systemd/pytorrent.service +++ b/systemd/pytorrent.service @@ -13,7 +13,7 @@ WorkingDirectory=/opt/pyTorrent Environment="PYTHONUNBUFFERED=1" EnvironmentFile=/opt/pyTorrent/.env # Note: threaded Gunicorn preserves Flask-SocketIO background tasks without running Werkzeug in production. -ExecStart=/opt/pyTorrent/venv/bin/gunicorn --worker-class gthread --workers 1 --threads 32 --bind ${PYTORRENT_HOST}:${PYTORRENT_PORT} --access-logfile - --error-logfile - wsgi:app +ExecStart=/opt/pyTorrent/venv/bin/gunicorn -c /opt/pyTorrent/gunicorn.conf.py --worker-class gthread --workers 1 --threads 32 --bind ${PYTORRENT_HOST}:${PYTORRENT_PORT} --access-logfile - --error-logfile - wsgi:app Restart=always RestartSec=3 KillSignal=SIGINT