22 lines
523 B
Python
22 lines
523 B
Python
from flask import Flask, request, jsonify
|
|
import os
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.route('/debug', methods=['POST'])
|
|
def toggle_debug():
|
|
data = request.json
|
|
if 'enable' not in data:
|
|
return jsonify({'error': 'Invalid request'}), 400
|
|
|
|
if data['enable']:
|
|
open('debug_mode.txt', 'w').close()
|
|
else:
|
|
if os.path.exists('debug_mode.txt'):
|
|
os.remove('debug_mode.txt')
|
|
|
|
return jsonify({'success': True})
|
|
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0', port=5000)
|