mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-11-04 07:33:53 +01:00 
			
		
		
		
	je comprend pas pk ca marche pas
This commit is contained in:
		
							
								
								
									
										36
									
								
								Flask/app.py
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								Flask/app.py
									
									
									
									
									
								
							@@ -1,3 +1,5 @@
 | 
			
		||||
import gevent.monkey
 | 
			
		||||
gevent.monkey.patch_all()
 | 
			
		||||
from time import sleep
 | 
			
		||||
import subprocess
 | 
			
		||||
import os
 | 
			
		||||
@@ -9,6 +11,8 @@ from werkzeug.utils import secure_filename
 | 
			
		||||
import json
 | 
			
		||||
import re
 | 
			
		||||
from requests import get
 | 
			
		||||
import redis
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# redis part for live update
 | 
			
		||||
redis_client = redis.StrictRedis(host='localhost', port=6379, db=0)
 | 
			
		||||
@@ -16,13 +20,13 @@ 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"
 | 
			
		||||
    try:
 | 
			
		||||
        for message in pubsub.listen():
 | 
			
		||||
            if message['type'] == 'message':
 | 
			
		||||
                yield f"data: {message['data'].decode()}\n\n"
 | 
			
		||||
    except redis.exceptions.ConnectionError as e:
 | 
			
		||||
        print(f"Error connecting to Redis: {e}")
 | 
			
		||||
 | 
			
		||||
@app.route('/stream')
 | 
			
		||||
def stream():
 | 
			
		||||
    return Response(generate_output(), content_type='text/event-stream')
 | 
			
		||||
# end
 | 
			
		||||
 | 
			
		||||
global password
 | 
			
		||||
@@ -142,6 +146,11 @@ class User(UserMixin):
 | 
			
		||||
 | 
			
		||||
users = [User(1)]
 | 
			
		||||
 | 
			
		||||
@app.route('/stream')
 | 
			
		||||
def stream():
 | 
			
		||||
    return Response(generate_output(), content_type='text/event-stream')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route("/login/", methods=["GET", "POST"])
 | 
			
		||||
def login():
 | 
			
		||||
    if request.method == 'POST':
 | 
			
		||||
@@ -232,21 +241,6 @@ def discord_post():
 | 
			
		||||
 | 
			
		||||
@app.route("/dev/")
 | 
			
		||||
def dev2():
 | 
			
		||||
    with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile:
 | 
			
		||||
        j = json.load(inFile)
 | 
			
		||||
    new_proxy = {"address": "ADDRESS", "port": "PORT", "name":"NAME"}
 | 
			
		||||
    max_index = 0
 | 
			
		||||
    for i in range(1, 50):
 | 
			
		||||
        try :
 | 
			
		||||
            print(j[str(i)])
 | 
			
		||||
        except :
 | 
			
		||||
            print(f"found {i - 1} proxys")
 | 
			
		||||
            max_index = i
 | 
			
		||||
            break
 | 
			
		||||
    j[f"{max_index}"] = new_proxy
 | 
			
		||||
    print(j)
 | 
			
		||||
    with open("/app/MsRewards-Reborn/user_data/proxy.json", "w") as outfile:
 | 
			
		||||
        json.dump(j, outfile)
 | 
			
		||||
    return(render_template("dev.html"))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,7 @@
 | 
			
		||||
    const eventSource = new EventSource('/stream');
 | 
			
		||||
 | 
			
		||||
    eventSource.onmessage = (event) => {
 | 
			
		||||
        console.log("etqhbbqetbqedrtqberzegr");
 | 
			
		||||
        const newOutput = document.createElement('div');
 | 
			
		||||
        newOutput.textContent = event.data;
 | 
			
		||||
        consoleElement.appendChild(newOutput);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user