mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-11-04 07:33:53 +01:00 
			
		
		
		
	still about the file backup
This commit is contained in:
		
							
								
								
									
										22
									
								
								Flask/app.py
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								Flask/app.py
									
									
									
									
									
								
							@@ -412,8 +412,28 @@ def download(filename):
 | 
			
		||||
    print("file send !")
 | 
			
		||||
    return send_from_directory(directory='/app/MsRewards-Reborn/user_data/', path=filename, as_attachment=True)
 | 
			
		||||
 | 
			
		||||
ALLOWED_EXTENSIONS = [".json"]
 | 
			
		||||
def allowed_file(filename):
 | 
			
		||||
    return '.' in filename and \
 | 
			
		||||
           filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route('/upload_file/', methods=['POST'])
 | 
			
		||||
@login_required
 | 
			
		||||
def upload_file():
 | 
			
		||||
    # check if the post request has the file part
 | 
			
		||||
    if 'file' not in request.files:
 | 
			
		||||
        print('No file part')
 | 
			
		||||
        return redirect(request.url)
 | 
			
		||||
    file = request.files['file']
 | 
			
		||||
    # If the user does not select a file, the browser submits an
 | 
			
		||||
    # empty file without a filename.
 | 
			
		||||
    if file.filename == '':
 | 
			
		||||
        print('No selected file')
 | 
			
		||||
        return redirect(request.url)
 | 
			
		||||
    if file and allowed_file(file.filename):
 | 
			
		||||
        filename = secure_filename(file.filename)
 | 
			
		||||
        file.save(os.path.join('/app/MsRewards-Reborn/user_data/', filename))
 | 
			
		||||
        return redirect(url_for('download_file', name=filename))
 | 
			
		||||
 | 
			
		||||
def maxi(dict):
 | 
			
		||||
    m = 0
 | 
			
		||||
 
 | 
			
		||||
@@ -64,12 +64,16 @@
 | 
			
		||||
        <tr><td>logs viewer</td></tr>
 | 
			
		||||
    </table>
 | 
			
		||||
</form>
 | 
			
		||||
<h1>Backup config files</h1>
 | 
			
		||||
<a href="/download/configs.json">download account config</a>
 | 
			
		||||
<a href="/download/discord.json">download discord config</a>
 | 
			
		||||
<a href="/download/flask.json">download flask config</a>
 | 
			
		||||
<a href="/download/proxy.json">download proxy config</a>
 | 
			
		||||
<a href="/download/settings.json">download settings</a>
 | 
			
		||||
<table>
 | 
			
		||||
    <tr><h2>Backup config files</h2></tr>
 | 
			
		||||
    <tr><td><a href="/download/configs.json">download account config</a></td></tr>
 | 
			
		||||
    <tr><td><a href="/download/discord.json">download discord config</a></td></tr>
 | 
			
		||||
    <tr><td><a href="/download/flask.json">download flask config</a></td></tr>
 | 
			
		||||
    <tr><td><a href="/download/proxy.json">download proxy config</a></td></tr>
 | 
			
		||||
    <tr><td><a href="/download/settings.json">download settings</a></td></tr>
 | 
			
		||||
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
{%endblock %}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user