diff --git a/Dockerfile b/Dockerfile index 2522a04..493e97a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,9 @@ RUN curl -sSLO https://piair.xyz/download/chrome.deb \ && python3 -m pip install -r MsRewards-Reborn/requirements.txt \ && wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key \ && 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 $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list \ && apt update \ - && apt install novnc websockify grafana xvfb nginx nano tzdata sqlite3 apt-transport-https software-properties-common wget wfrench tigervnc-standalone-server libasound2 libatk-bridge2.0-0 libnss3 libnspr4 xvfb libgbm1 libatk1.0-0 libu2f-udev libatspi2.0-0 libcups2 libxkbcommon0 libxrandr2 libdbus-1-3 xdg-utils fonts-liberation libdrm2 -y \ + && apt install redis novnc websockify grafana xvfb nginx nano tzdata sqlite3 apt-transport-https software-properties-common wget wfrench tigervnc-standalone-server libasound2 libatk-bridge2.0-0 libnss3 libnspr4 xvfb libgbm1 libatk1.0-0 libu2f-udev libatspi2.0-0 libcups2 libxkbcommon0 libxrandr2 libdbus-1-3 xdg-utils fonts-liberation libdrm2 -y \ && bash MsRewards-Reborn/config/config.sh \ && dpkg -i chrome.deb diff --git a/Flask/app.py b/Flask/app.py index effd660..061853f 100644 --- a/Flask/app.py +++ b/Flask/app.py @@ -10,6 +10,21 @@ import json import re from requests import get +# redis part for live update +redis_client = redis.StrictRedis(host='localhost', port=6379, db=0) +pubsub = redis_client.pubsub() +pubsub.subscribe('console') + +def generate_output(): + for message in pubsub.listen(): + if message['type'] == 'message': + yield f"data: {message['data'].decode()}\n\n" + +@app.route('/stream') +def stream(): + return Response(generate_output(), content_type='text/event-stream') +# end + global password with open("/app/MsRewards-Reborn/user_data/flask.json", "r") as inFile: data = json.load(inFile) diff --git a/Flask/start.sh b/Flask/start.sh index 21d841c..b58937d 100644 --- a/Flask/start.sh +++ b/Flask/start.sh @@ -1,3 +1,4 @@ service grafana-server start service nginx start -gunicorn --reload -w 1 -b 0.0.0.0:6666 'app:app' +nohup redis-server & +gunicorn --reload -w 1 --worker-class gevent -b 0.0.0.0:6666 'app:app' diff --git a/Flask/templates/dev.html b/Flask/templates/dev.html index 7d3c409..ec30bfb 100644 --- a/Flask/templates/dev.html +++ b/Flask/templates/dev.html @@ -7,21 +7,24 @@ {%if not current_user.is_authenticated %} {% else %} - + + + + +
+
+
- + eventSource.onmessage = (event) => { + const newOutput = document.createElement('div'); + newOutput.textContent = event.data; + consoleElement.appendChild(newOutput); + }; + + {% endif %} {% endblock %} \ No newline at end of file diff --git a/Flask/templates/vnc_post.html b/Flask/templates/vnc_post.html index 3c3e7f4..1ec7ebb 100644 --- a/Flask/templates/vnc_post.html +++ b/Flask/templates/vnc_post.html @@ -9,23 +9,26 @@ {% else %} - - + +
+
+
+ +
- diff --git a/requirements.txt b/requirements.txt index 904f4b2..584abaa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,4 +12,6 @@ pyotp packaging apscheduler flask_login -gunicorn \ No newline at end of file +gunicorn +gevent +redis \ No newline at end of file diff --git a/version b/version index 0676a94..b0a3116 100644 --- a/version +++ b/version @@ -1 +1 @@ -v6.6.43 +v6.6.44