From d7a43dfcc719035720cc162ca61659b91e6f9ee3 Mon Sep 17 00:00:00 2001 From: oberon Date: Mon, 16 Feb 2026 14:55:45 +0100 Subject: [PATCH] fixxed flask blueprint names --- app/routes/admin.py | 8 ++++---- app/routes/api.py | 16 ++++++++-------- app/routes/main.py | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/routes/admin.py b/app/routes/admin.py index 290ed67..580ae1f 100644 --- a/app/routes/admin.py +++ b/app/routes/admin.py @@ -11,7 +11,7 @@ def admin(): return render_template('admin.html', configs=configs) -@app.route('/edit/', methods=['GET', 'POST']) +@admin_bp.route('/edit/', methods=['GET', 'POST']) def admin_edit_config(filename): path = os.path.join(app.config['CONFIG_DIR'], filename) @@ -52,7 +52,7 @@ def admin_edit_config(filename): return render_template('admin_edit.html', filename=filename, content=content) pass -@app.route('/delete/', methods=['POST']) +@admin_bp.route('/delete/', methods=['POST']) def admin_delete_config(filename): path = os.path.join(app.config['CONFIG_DIR'], filename) if os.path.exists(path): @@ -66,8 +66,8 @@ def admin_delete_config(filename): return jsonify({"success": False, "message": "Datei nicht gefunden"}), 404 pass -@app.route('/logs') -@app.route('/logs/') +@admin_bp.route('/logs') +@admin_bp.route('/logs/') def admin_logs(date=None): if date is None: date = datetime.now().strftime('%d') diff --git a/app/routes/api.py b/app/routes/api.py index 529e738..031f47e 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -5,7 +5,7 @@ from app.state import current_device, current_config api_bp = Blueprint('api', __name__) -@app.route('/connect', methods=['POST']) +@api_bp.route('/connect', methods=['POST']) def api_connect(): global current_hub, current_module, current_device if current_config is None: @@ -63,7 +63,7 @@ def api_connect(): pass -@app.route('/reconnect', methods=['POST']) +@api_bp.route('/reconnect', methods=['POST']) def api_reconnect(): global current_device, current_module, current_hub if current_config is None: @@ -111,7 +111,7 @@ def api_reconnect(): pass -@app.route('/control', methods=['POST']) +@api_bp.route('/control', methods=['POST']) def api_control(): global current_device if current_device is None: @@ -155,7 +155,7 @@ def api_control(): pass -@app.route('/stop_all', methods=['POST']) +@api_bp.route('/stop_all', methods=['POST']) def api_stop_all(): global current_device if current_device is None: @@ -172,7 +172,7 @@ def api_stop_all(): pass -@app.route('/status', methods=['GET']) +@api_bp.route('/status', methods=['GET']) def api_status(): global current_device @@ -189,7 +189,7 @@ def api_status(): pass -@app.route('/play_sound', methods=['POST']) +@api_bp.route('/play_sound', methods=['POST']) def api_play_sound(): try: data = request.get_json() @@ -232,7 +232,7 @@ def api_play_sound(): pass -@app.route('/stop_sound', methods=['POST']) +@api_bp.route('/stop_sound', methods=['POST']) def api_stop_sound(): try: pygame.mixer.music.stop() @@ -244,7 +244,7 @@ def api_stop_sound(): pass -@app.route('/set_volume', methods=['POST']) +@api_bp.route('/set_volume', methods=['POST']) def api_set_volume(): try: data = request.get_json() diff --git a/app/routes/main.py b/app/routes/main.py index 079345f..90482ef 100644 --- a/app/routes/main.py +++ b/app/routes/main.py @@ -16,7 +16,7 @@ def index(): return render_template('index.html', configs=load_configs()) """ -@app.route('/load_config/') +@main_bp.route('/load_config/') def load_config(filename): global current_config path = os.path.join(app.config['CONFIG_DIR'], filename) @@ -39,7 +39,7 @@ def load_config(filename): return "Fehler beim Laden der Konfiguration", 500 -@app.route('/control') +@main_bp.route('/control') def control_page(): if current_config is None: logger.warning("current_config ist None → Redirect zu index") @@ -58,7 +58,7 @@ def control_page(): ) -@app.route('/soundboard') +@main_bp.route('/soundboard') def soundboard(): if current_config is None or 'sounds' not in current_config: return redirect(url_for('index'))