fixxed flask blueprint names
This commit is contained in:
parent
f3679cbd29
commit
d7a43dfcc7
@ -11,7 +11,7 @@ def admin():
|
|||||||
return render_template('admin.html', configs=configs)
|
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):
|
def admin_edit_config(filename):
|
||||||
path = os.path.join(app.config['CONFIG_DIR'], 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)
|
return render_template('admin_edit.html', filename=filename, content=content)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@app.route('/delete/<filename>', methods=['POST'])
|
@admin_bp.route('/delete/<filename>', methods=['POST'])
|
||||||
def admin_delete_config(filename):
|
def admin_delete_config(filename):
|
||||||
path = os.path.join(app.config['CONFIG_DIR'], filename)
|
path = os.path.join(app.config['CONFIG_DIR'], filename)
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
@ -66,8 +66,8 @@ def admin_delete_config(filename):
|
|||||||
return jsonify({"success": False, "message": "Datei nicht gefunden"}), 404
|
return jsonify({"success": False, "message": "Datei nicht gefunden"}), 404
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@app.route('/logs')
|
@admin_bp.route('/logs')
|
||||||
@app.route('/logs/<date>')
|
@admin_bp.route('/logs/<date>')
|
||||||
def admin_logs(date=None):
|
def admin_logs(date=None):
|
||||||
if date is None:
|
if date is None:
|
||||||
date = datetime.now().strftime('%d')
|
date = datetime.now().strftime('%d')
|
||||||
|
|||||||
@ -5,7 +5,7 @@ from app.state import current_device, current_config
|
|||||||
|
|
||||||
api_bp = Blueprint('api', __name__)
|
api_bp = Blueprint('api', __name__)
|
||||||
|
|
||||||
@app.route('/connect', methods=['POST'])
|
@api_bp.route('/connect', methods=['POST'])
|
||||||
def api_connect():
|
def api_connect():
|
||||||
global current_hub, current_module, current_device
|
global current_hub, current_module, current_device
|
||||||
if current_config is None:
|
if current_config is None:
|
||||||
@ -63,7 +63,7 @@ def api_connect():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@app.route('/reconnect', methods=['POST'])
|
@api_bp.route('/reconnect', methods=['POST'])
|
||||||
def api_reconnect():
|
def api_reconnect():
|
||||||
global current_device, current_module, current_hub
|
global current_device, current_module, current_hub
|
||||||
if current_config is None:
|
if current_config is None:
|
||||||
@ -111,7 +111,7 @@ def api_reconnect():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@app.route('/control', methods=['POST'])
|
@api_bp.route('/control', methods=['POST'])
|
||||||
def api_control():
|
def api_control():
|
||||||
global current_device
|
global current_device
|
||||||
if current_device is None:
|
if current_device is None:
|
||||||
@ -155,7 +155,7 @@ def api_control():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@app.route('/stop_all', methods=['POST'])
|
@api_bp.route('/stop_all', methods=['POST'])
|
||||||
def api_stop_all():
|
def api_stop_all():
|
||||||
global current_device
|
global current_device
|
||||||
if current_device is None:
|
if current_device is None:
|
||||||
@ -172,7 +172,7 @@ def api_stop_all():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@app.route('/status', methods=['GET'])
|
@api_bp.route('/status', methods=['GET'])
|
||||||
def api_status():
|
def api_status():
|
||||||
global current_device
|
global current_device
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ def api_status():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@app.route('/play_sound', methods=['POST'])
|
@api_bp.route('/play_sound', methods=['POST'])
|
||||||
def api_play_sound():
|
def api_play_sound():
|
||||||
try:
|
try:
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@ -232,7 +232,7 @@ def api_play_sound():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@app.route('/stop_sound', methods=['POST'])
|
@api_bp.route('/stop_sound', methods=['POST'])
|
||||||
def api_stop_sound():
|
def api_stop_sound():
|
||||||
try:
|
try:
|
||||||
pygame.mixer.music.stop()
|
pygame.mixer.music.stop()
|
||||||
@ -244,7 +244,7 @@ def api_stop_sound():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@app.route('/set_volume', methods=['POST'])
|
@api_bp.route('/set_volume', methods=['POST'])
|
||||||
def api_set_volume():
|
def api_set_volume():
|
||||||
try:
|
try:
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
|
|||||||
@ -16,7 +16,7 @@ def index():
|
|||||||
return render_template('index.html', configs=load_configs())
|
return render_template('index.html', configs=load_configs())
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@app.route('/load_config/<filename>')
|
@main_bp.route('/load_config/<filename>')
|
||||||
def load_config(filename):
|
def load_config(filename):
|
||||||
global current_config
|
global current_config
|
||||||
path = os.path.join(app.config['CONFIG_DIR'], filename)
|
path = os.path.join(app.config['CONFIG_DIR'], filename)
|
||||||
@ -39,7 +39,7 @@ def load_config(filename):
|
|||||||
return "Fehler beim Laden der Konfiguration", 500
|
return "Fehler beim Laden der Konfiguration", 500
|
||||||
|
|
||||||
|
|
||||||
@app.route('/control')
|
@main_bp.route('/control')
|
||||||
def control_page():
|
def control_page():
|
||||||
if current_config is None:
|
if current_config is None:
|
||||||
logger.warning("current_config ist None → Redirect zu index")
|
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():
|
def soundboard():
|
||||||
if current_config is None or 'sounds' not in current_config:
|
if current_config is None or 'sounds' not in current_config:
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user