Kaynağa Gözat

Renamed alerts 'images' folder to 'assets'

deadtom 4 gün önce
ebeveyn
işleme
3048d416ee

+ 1 - 1
ownchatbot/__init__.py

@@ -35,7 +35,7 @@ def create_app(test_config=None):
     app.config.from_pyfile('todo.py', silent=True)
     app.config.from_object('ownchatbot.defaults.alerts')
     app.config.from_pyfile('alerts.py', silent=True)
-    app.config['ALERTS_FOLDER'] = os.path.join(app.instance_path, 'alerts')
+    app.config['ASSETS_FOLDER'] = os.path.join(app.instance_path, 'assets')
 
     if app.config['GUNICORN']:  # Gunicorn logging integration
         gunicorn_logger = logging.getLogger('gunicorn.error')

+ 1 - 1
ownchatbot/reward_handlers.py

@@ -309,7 +309,7 @@ def save_alerts(alerts_dict):  # Write alerts to alerts.py
 
 
 def del_alert_file(alert_file):
-    filepath = os.path.join(current_app.config['ALERTS_FOLDER'], alert_file)
+    filepath = os.path.join(current_app.config['ASSETS_FOLDER'], alert_file)
     try:
         os.remove(filepath)
         current_app.logger.info(f"Successfully removed \"{alert_file}\" from alerts folder.")

+ 2 - 2
ownchatbot/web_panels.py

@@ -627,7 +627,7 @@ def alert_upload(alert_type):
         current_app.logger.info(f'{alert_type} already set.')
         if del_alert_file(old_file):
             pass
-    filepath = os.path.join(current_app.config['ALERTS_FOLDER'], alert_file.filename)
+    filepath = os.path.join(current_app.config['ASSETS_FOLDER'], alert_file.filename)
     alert_file.save(filepath)
     alerts_dict[alert_type] = alert_file.filename
     if save_alerts(alerts_dict):  # Save new alerts.py
@@ -654,7 +654,7 @@ def del_alert(alert_type):
 
 @ocb.route('/alerts/<alert_name>')  # Route for displaying alert images
 def alerts(alert_name):
-    return send_from_directory(current_app.config['ALERTS_FOLDER'], alert_name)
+    return send_from_directory(current_app.config['ASSETS_FOLDER'], alert_name)
 
 
 @ocb.route('/alert/<alert_type>')  # Route for alerts overlay