Browse Source

Made gunicorn logging standard. Removed option to change it.

deadtom 1 tháng trước cách đây
mục cha
commit
d3f03fbbc1

+ 3 - 4
ownchatbot/__init__.py

@@ -37,10 +37,9 @@ def create_app(test_config=None):
     app.config.from_pyfile('alerts.py', silent=True)
     app.config['ASSETS_FOLDER'] = os.path.join(app.instance_path, 'assets')
 
-    if app.config['GUNICORN']:  # Gunicorn logging integration
-        gunicorn_logger = logging.getLogger('gunicorn.error')
-        app.logger.handlers = gunicorn_logger.handlers
-        app.logger.setLevel(gunicorn_logger.level)
+    gunicorn_logger = logging.getLogger('gunicorn.error')
+    app.logger.handlers = gunicorn_logger.handlers
+    app.logger.setLevel(gunicorn_logger.level)
 
     from . import webhooks  # Set up blueprints
     from . import web_panels

+ 0 - 1
ownchatbot/defaults/config.py

@@ -9,6 +9,5 @@ POINTS_INTERVAL = 5  # How long, in minutes, between points awards
 POINTS_AWARD = 5  # How many points awarded each interval?
 SECRET_KEY = ''  # Needed for internal flask stuff. Generated during setup. DO NOT CHANGE
 PREFIX = '!'  # Preceeds commands, so OwnchatBot knows what is a command
-GUNICORN = True    # Integrate OwnchatBot logging into Gunicorn
 KOFI_TOKEN = ''  # Needed to validate Ko-fi with OCB webhook. Get from Ko-fi Settings -> More -> API -> Webhooks -> Advanced - Verification Token.
 KOFI_INTEGRATION = False  # Integrate OwnchatBot with Ko-fi

+ 0 - 1
ownchatbot/reward_handlers.py

@@ -384,7 +384,6 @@ OCB_URL = '{config_dict['OCB_URL']}'\n\
 SECRET_KEY = '{secret_key}'  # Needed for internal Flask stuff. DO NOT DELETE.\n\
 POINTS_INTERVAL = {config_dict['POINTS_INTERVAL']}  # How long, in seconds, between points awards\n\
 POINTS_AWARD = {config_dict['POINTS_AWARD']}  # How many points awarded each interval?\n\
-GUNICORN = {config_dict['GUNICORN']}  # Integrate OwnchatBot logging into Gunicorn\n\
 PREFIX = '{config_dict['PREFIX']}'  # Preceeds commands, so OwnchatBot knows what is a command\n\
 KOFI_TOKEN = '{config_dict['KOFI_TOKEN']}'  # Needed to validate Ko-fi with OCB webhook. Get from Ko-fi Settings -> More -> API -> Webhooks -> Advanced - Verification Token.\n\
 KOFI_INTEGRATION = {config_dict['KOFI_INTEGRATION']}  # Integrate OwnchatBot with Ko-fi"

+ 13 - 23
ownchatbot/templates/mgmt.html

@@ -274,16 +274,16 @@
                     </thead>
                     <tr>
                         <td> <label for="announce_enable">Enable:</label> </td>
-                        {% if settings_info[9] %}
-                        <td> <input type="checkbox" name="announce_enable" value="{{ settings_info[9] }}" checked> </td>
+                        {% if settings_info[8] %}
+                        <td> <input type="checkbox" name="announce_enable" value="{{ settings_info[8] }}" checked> </td>
                         {% else %}
-                        <td> <input type="checkbox" name="announce_enable" value="{{ settings_info[9] }}"> </td>
+                        <td> <input type="checkbox" name="announce_enable" value="{{ settings_info[8] }}"> </td>
                         {% endif %}
                         <td>Enable periodic announcements</td>
                     </tr>
                     <tr>
                         <td> <label for="announce_interval">Interval:</label> </td>
-                        <td> <input type="number" name="announce_interval" value="{{ settings_info[10] }}" size="2" required> minutes</td>
+                        <td> <input type="number" name="announce_interval" value="{{ settings_info[9] }}" size="2" required> minutes</td>
                         <td>How long between each announcement?</td>
                     </tr>
                     <tr>
@@ -322,23 +322,14 @@
                         <td> <input type="number" name="points_award" value="{{ settings_info[2] }}" size="5"  required> points</td>
                         <td>How many points do you want to award them?</td>
                     </tr>
-                    <tr>
-                        <td> <label for="gunicorn_logging">Gunicorn Logging:</label> </td>
-                        {% if settings_info[3] %}
-                        <td> <input type="checkbox" name="gunicorn_logging" value="{{ settings_info[3] }}" checked> </td>
-                        {% else %}
-                        <td> <input type="checkbox" name="gunicorn_logging" value="{{ settings_info[3] }}"> </td>
-                        {% endif %}
-                        <td>Enable Gunicorn logging integration.</td>
-                    </tr>
                     <tr>
                         <td> <label for="prefix">Chat Command Prefix:</label> </td>
-                        <td> <input type="text" name="prefix" maxlength="1" size="1" value="{{ settings_info[4] }}" required> </td>
-                        <td>Character that preceeds chat commands, so OwnchatBot knows what to look for.<br>Example: "{{ settings_info[4] }}points"</td>
+                        <td> <input type="text" name="prefix" maxlength="1" size="1" value="{{ settings_info[3] }}" required> </td>
+                        <td>Character that preceeds chat commands, so OwnchatBot knows what to look for.<br>Example: "{{ settings_info[3] }}points"</td>
                     </tr>
                     <tr>
                         <td> <label for=ocb_url>External URL:</label> </td>
-                        <td> <input type="text" name="ocb_url" size="40" value="{{ settings_info[11] }}" required> </td>
+                        <td> <input type="text" name="ocb_url" size="40" value="{{ settings_info[10] }}" required> </td>
                         <td>What is the external URL of your OwnchatBot?</td>
                     </tr>
                         
@@ -360,12 +351,12 @@
                     </tr>
                     <tr>
                         <td> <label for="access_token">Access Token:</label> </td>
-                        <td style="padding: 5px;"> <input type="password" name="access_token" value="{{ settings_info[5] }}" size="40"> </td>
+                        <td style="padding: 5px;"> <input type="password" name="access_token" value="{{ settings_info[4] }}" size="40"> </td>
                         <td>The token you created above.</td>
                     </tr>
                     <tr>
                         <td> <label for="owncast_url">Your Owncast URL:</label> </td>
-                        <td> <input type="text" name="owncast_url" value="{{ settings_info[6] }}" size="40"> </td>
+                        <td> <input type="text" name="owncast_url" value="{{ settings_info[5] }}" size="40"> </td>
                         <td>The external URL of your Owncast instance, with "http://" or "https://".</td>
                     </tr>
                 </table>
@@ -381,17 +372,17 @@
                     </thead>
                     <tr>
                         <td> <label for="kofi_integration">Enable:</label> </td>
-                        {% if settings_info[8] %}
-                        <td> <input type="checkbox" name="kofi_integration" value="{{ settings_info[8] }}" checked> </td>
+                        {% if settings_info[7] %}
+                        <td> <input type="checkbox" name="kofi_integration" value="{{ settings_info[7] }}" checked> </td>
                         <td>Enable Ko-fi integration.</td>
                         {% else %}
-                        <td> <input type="checkbox" name="kofi_integration" value="{{ settings_info[8] }}"> </td>
+                        <td> <input type="checkbox" name="kofi_integration" value="{{ settings_info[7] }}"> </td>
                         <td>Enable Ko-fi integration. ("Kofi Settings" button will appear in the navigation bar when enabled.)</td>
                         {% endif %}
                     </tr>
                     <tr>
                         <td> <label for="kofi_token">Verification Token:</label> </td>
-                        <td style="padding: 5px;"> <input type="password" name="kofi_token" value="{{ settings_info[7] }}" size="40"> </td>
+                        <td style="padding: 5px;"> <input type="password" name="kofi_token" value="{{ settings_info[6] }}" size="40"> </td>
                         <td>Get from Kofi -> More -> API -> Webhooks -> Advanced -> Verification Token.</td>
                     </tr>
                 </table>
@@ -471,7 +462,6 @@
         </script>
         <body onload="focusInput()">
         <h1>To-Do List</h1>
-        &nbsp;&nbsp;To display your to-do list as an overlay, create a brower source in  your streaming software, and point it at /todo.
         <form id="todo-item-form" method="POST" onsubmit="focusInput()" action="/mgmt/addtodoitem">
             <input type="text" id="itemInput" name="item" placeholder="Add a new item">
             <button id="todo-item-form" class="button button2" type="submit">Add</button>

+ 0 - 4
ownchatbot/web_panels.py

@@ -98,7 +98,6 @@ def mgmt():
     all_cats = current_app.config['ALL_CAT']
     points_interval = current_app.config['POINTS_INTERVAL']
     points_award = current_app.config['POINTS_AWARD']
-    gunicorn_logging = current_app.config['GUNICORN']
     prefix = current_app.config['PREFIX']
     access_id = current_app.config['ACCESS_ID']
     access_token = current_app.config['ACCESS_TOKEN']
@@ -115,7 +114,6 @@ def mgmt():
         access_id,
         points_interval,
         points_award,
-        gunicorn_logging,
         prefix,
         access_token,
         owncast_url,
@@ -338,7 +336,6 @@ def settings():
     todolist_items = current_app.config['LIST']
     points_interval = int(request.form['points_interval'])
     points_award = int(request.form['points_award'])
-    gunicorn_logging = 'gunicorn_logging' in request.form
     prefix = request.form['prefix']
     access_id = request.form['access_id']
     access_token = request.form['access_token']
@@ -349,7 +346,6 @@ def settings():
     config_dict = {
         'POINTS_INTERVAL': points_interval,
         'POINTS_AWARD': points_award,
-        'GUNICORN': gunicorn_logging,
         'PREFIX': prefix,
         'OCB_URL': ocb_url,
         'ACCESS_ID': access_id,