fixxed flask blueprint names

This commit is contained in:
oberon 2026-02-16 14:55:45 +01:00
parent f3679cbd29
commit d7a43dfcc7
3 changed files with 15 additions and 15 deletions

View File

@ -11,7 +11,7 @@ def admin():
return render_template('admin.html', configs=configs)
@app.route('/edit/<filename>', methods=['GET', 'POST'])
@admin_bp.route('/edit/<filename>', 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/<filename>', methods=['POST'])
@admin_bp.route('/delete/<filename>', 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/<date>')
@admin_bp.route('/logs')
@admin_bp.route('/logs/<date>')
def admin_logs(date=None):
if date is None:
date = datetime.now().strftime('%d')

View File

@ -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()

View File

@ -16,7 +16,7 @@ def index():
return render_template('index.html', configs=load_configs())
"""
@app.route('/load_config/<filename>')
@main_bp.route('/load_config/<filename>')
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'))