mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-11-04 07:33:53 +01:00 
			
		
		
		
	uéuéué ca test des trucs (un viewer de logs)
This commit is contained in:
		
							
								
								
									
										11
									
								
								Flask/app.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Flask/app.py
									
									
									
									
									
								
							@@ -48,7 +48,7 @@ scheduler.add_job(                  # on relance le job
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def start_ms(i):
 | 
					def start_ms(i):
 | 
				
			||||||
    print("\033[32m" + f"Starting config {i}" + "\033[0m")
 | 
					    print("\033[32m" + f"Starting config {i}" + "\033[0m")
 | 
				
			||||||
    log = open(f"/app/MsRewards-Reborn/user_data/logs/{i}.txt", 'a')  # so that data written to it will be appended
 | 
					    log = open(f"/app/MsRewards-Reborn/Flask/static/logs/{i}.txt", 'a')  # so that data written to it will be appended
 | 
				
			||||||
    subprocess.Popen([f"python3 -u /app/MsRewards-Reborn/V6.py -c {i}"], stdout=log, stderr=log, shell=True)
 | 
					    subprocess.Popen([f"python3 -u /app/MsRewards-Reborn/V6.py -c {i}"], stdout=log, stderr=log, shell=True)
 | 
				
			||||||
    log.close()
 | 
					    log.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -137,13 +137,16 @@ def login():
 | 
				
			|||||||
            user = User(id)
 | 
					            user = User(id)
 | 
				
			||||||
            login_user(user)
 | 
					            login_user(user)
 | 
				
			||||||
            if password == "ChangeMe":
 | 
					            if password == "ChangeMe":
 | 
				
			||||||
                return(render_template("change_password.html"))
 | 
					                return(redirect('/change_password'))
 | 
				
			||||||
            return(redirect('override'))
 | 
					            return(redirect('/override'))
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            return abort(401)
 | 
					            return abort(401)
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        return(render_template("login.html"))
 | 
					        return(render_template("login.html"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@app.route("/logs/", methods=["GET"])
 | 
				
			||||||
 | 
					def login():
 | 
				
			||||||
 | 
					    return(render_template("logs.html"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route("/change_password/", methods=["GET", "POST"])
 | 
					@app.route("/change_password/", methods=["GET", "POST"])
 | 
				
			||||||
@login_required
 | 
					@login_required
 | 
				
			||||||
@@ -157,7 +160,7 @@ def change_password():
 | 
				
			|||||||
                "secret": secret
 | 
					                "secret": secret
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            json.dump(data, inFile)   
 | 
					            json.dump(data, inFile)   
 | 
				
			||||||
    return(render_template("override.html"))
 | 
					    return(render_template("change_password.html"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# handle login failed
 | 
					# handle login failed
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								Flask/static/logs/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Flask/static/logs/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					*.txt
 | 
				
			||||||
@@ -1 +1,44 @@
 | 
				
			|||||||
<iframe src="../user_data/log1.txt" width=200 height=200 frameborder=0 id="frame">
 | 
					{% extends "base.html" %}
 | 
				
			||||||
 | 
					{% block left_pannel %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<table>
 | 
				
			||||||
 | 
					    <tr>
 | 
				
			||||||
 | 
					        <td>
 | 
				
			||||||
 | 
					            <button class="unselected" onclick="location.href = '/override';">override</button>
 | 
				
			||||||
 | 
					        </td>
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					    <tr>
 | 
				
			||||||
 | 
					        <td>
 | 
				
			||||||
 | 
					            <button class="unselected" onclick="location.href = '/config';">config</button>
 | 
				
			||||||
 | 
					        </td>  
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					    <tr>
 | 
				
			||||||
 | 
					        <td>
 | 
				
			||||||
 | 
					            <button class="unselected" onclick="location.href = '/discord';">discord</button>
 | 
				
			||||||
 | 
					        </td>
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					    <tr>
 | 
				
			||||||
 | 
					        <td>
 | 
				
			||||||
 | 
					            <button class="unselected" onclick="location.href = '/proxy';">proxy</button>
 | 
				
			||||||
 | 
					        </td>  
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					    <tr>
 | 
				
			||||||
 | 
					        <td>
 | 
				
			||||||
 | 
					            <button class="unselected" onclick="location.href = '/grafana';">stats</button>
 | 
				
			||||||
 | 
					        </td>  
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					    <tr>
 | 
				
			||||||
 | 
					        <td>
 | 
				
			||||||
 | 
					            <button class="unselected" onclick="location.href = '/settings';">settings</button>
 | 
				
			||||||
 | 
					        </td>
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					</table>
 | 
				
			||||||
 | 
					{% endblock %}
 | 
				
			||||||
 | 
					{% block content %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{%if not current_user.is_authenticated %}
 | 
				
			||||||
 | 
					    <h1>Already logged in</h1>
 | 
				
			||||||
 | 
					{% else %}
 | 
				
			||||||
 | 
					<embed type="text/html" src="https://piair.xyz/download/1.log">
 | 
				
			||||||
 | 
					{% endif %}
 | 
				
			||||||
 | 
					{% endblock %}
 | 
				
			||||||
@@ -59,10 +59,12 @@
 | 
				
			|||||||
    <li>reorder config</li>
 | 
					    <li>reorder config</li>
 | 
				
			||||||
    <li>real override</li>
 | 
					    <li>real override</li>
 | 
				
			||||||
    <li>ban button</li>
 | 
					    <li>ban button</li>
 | 
				
			||||||
    <li>pourquoi tout ne se lance pas bien ?</li>
 | 
					    <li>pourquoi tout ne se lance pas bien ? - </li>
 | 
				
			||||||
    <li>logs viewer</li>
 | 
					    <li>avoir un afficheur de logs</li>
 | 
				
			||||||
 | 
					    <li>permettre de changer le mot de passe</li>
 | 
				
			||||||
 | 
					    <li>synchroniser le mot de passe de grafana et celui du bot</li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
<br>
 | 
					<br><br>
 | 
				
			||||||
<h2>Backup config files</h2>
 | 
					<h2>Backup config files</h2>
 | 
				
			||||||
<ul>
 | 
					<ul>
 | 
				
			||||||
    <li><a href="/download/configs.json">download account config</a></li>
 | 
					    <li><a href="/download/configs.json">download account config</a></li>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user