From 29fce1215d049686be1d941620d5e361b4a629e8 Mon Sep 17 00:00:00 2001 From: piair Date: Tue, 3 Oct 2023 12:01:59 +0200 Subject: [PATCH] =?UTF-8?q?je=20tente=20des=20truc=20mais=20on=20a=20jamai?= =?UTF-8?q?s=20=C3=A9t=C3=A9=20si=20proche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 + Flask/app.py | 28 ++++++++++++++-------------- config/config.sh | 2 ++ requirements.txt | 1 + version | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 10a328e..657ad22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ RUN curl -sSLO https://piair.xyz/download/chrome.deb \ && git clone https://gitea.augustin64.fr/piair/MsRewards-Reborn \ && python3 -m pip install -r MsRewards-Reborn/requirements.txt \ && wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key \ + && curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg \ && echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | tee -a /etc/apt/sources.list.d/grafana.list \ && echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb bullseye main" | tee /etc/apt/sources.list.d/redis.list \ && apt update \ diff --git a/Flask/app.py b/Flask/app.py index a706de9..22c28ce 100644 --- a/Flask/app.py +++ b/Flask/app.py @@ -12,18 +12,18 @@ import json import re from requests import get import redis +from flask_sse import sse - -# redis part for live update -redis_client = redis.StrictRedis(host='127.0.0.1', port=6379, db=0) -pubsub = redis_client.pubsub() -pubsub.subscribe('console') - -def generate_output(): - for message in pubsub.listen(): - if message['type'] == 'message': - print(message) - yield f"data: {message['data'].decode()}\n\n" +## redis part for live update +#redis_client = redis.StrictRedis(host='127.0.0.1', port=6379, db=0) +#pubsub = redis_client.pubsub() +#pubsub.subscribe('console') +# +#def generate_output(): +# for message in pubsub.listen(): +# if message['type'] == 'message': +# print(message) +# yield f"data: {message['data'].decode()}\n\n" # the end @@ -124,6 +124,7 @@ def inject_default_variables(): #Login stuff """ # config +app.config["REDIS_URL"] = "redis://localhost" app.config["TEMPLATES_AUTO_RELOAD"] = True app.config.update( SECRET_KEY = secret @@ -145,9 +146,8 @@ class User(UserMixin): users = [User(1)] -@app.route('/stream') -def stream(): - return Response(generate_output(), content_type='text/event-stream') + +app.register_blueprint(sse, url_prefix='/stream') @app.route("/login/", methods=["GET", "POST"]) diff --git a/config/config.sh b/config/config.sh index 1c316b1..086a29d 100644 --- a/config/config.sh +++ b/config/config.sh @@ -44,6 +44,8 @@ server { proxy_set_header X-Forwarded-For \$remote_addr; proxy_set_header Host \$http_host; proxy_pass "http://127.0.0.1:6666"; + chunked_transfer_encoding off; + proxy_buffering off; } } diff --git a/requirements.txt b/requirements.txt index 584abaa..1f048c8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,7 @@ pyvirtualdisplay undetected_chromedriver requests flask +flask_sse enquiries EasyProcess pyotp diff --git a/version b/version index 6755a54..49ea1df 100644 --- a/version +++ b/version @@ -1 +1 @@ -v6.6.45 +v6.6.46