Преглед на файлове

More GiveButter configuration

deadtom преди 1 месец
родител
ревизия
98f12ba08d
променени са 5 файла, в които са добавени 48 реда и са изтрити 34 реда
  1. 2 1
      TODO.md
  2. BIN
      ownchatbot/static/img/givebutter.png
  3. 6 11
      ownchatbot/templates/mgmt.html
  4. 39 21
      ownchatbot/templates/userpanel.html
  5. 1 1
      ownchatbot/web_panels.py

+ 2 - 1
TODO.md

@@ -1,5 +1,6 @@
 * GiveButter integration
  * Modify references to Ko-fi on any other templates. Include GiveButter.
- * Make sure anonymous donations are honored in all the logs
+ * Need separate Ko-fi and GB email address fields in the database.
+ * Test secret verification.
 * Screen reader - how to deal with auto refresh
 * Short video tutorials on configuring OwnchatBot.

BIN
ownchatbot/static/img/givebutter.png


+ 6 - 11
ownchatbot/templates/mgmt.html

@@ -16,8 +16,8 @@
             <button tabindex="4" class="tablinks" data-tab="announcements" onclick="openTab(event, 'announcements')">Announcements</button>
             <button tabindex="5" class="tablinks" data-tab="todolist" onclick="openTab(event, 'todolist')">To-Do List</button>
             <button tabindex="6" class="tablinks" data-tab="alerts" onclick="openTab(event, 'alerts')">Alerts</button>
-            <button tabindex="7" class="tablinks" data-tab="settings" onclick="openTab(event, 'settings')">Settings</button>
-            <button class="tablinks" data-tab="donations" onclick="openTab(event, 'donations')">Donations</button>
+            <button tabindex="7" class="tablinks" data-tab="donations" onclick="openTab(event, 'donations')">Donations</button>
+            <button tabindex="8" class="tablinks" data-tab="settings" onclick="openTab(event, 'settings')">Settings</button>
         </div>
         <img alt="Ownchat Bot logo, whimsical robot" src="/static/img/ownchatbotwide.png">
     </div>
@@ -377,7 +377,7 @@
         OwnchatBot can integrate with Ko-fi and GiveButter, awarding viewers points for donations and monthly subscriptions.
             <form id='kofi-settings_form' method="POST" action="/mgmt/ksettings">
                 <table>
-                <h3><u>Kofi</u></h3>
+                <h3><u>Ko-fi</u></h3>
                 
                 <h4> Donations </h4>
                     <thead>
@@ -389,18 +389,13 @@
                     </thead>
                     <tr>
                         <td> <label for="k_integration">Enable:</label> </td>
-                        {% if kofi_settings['integration'] %}
                         <td> <input id="k_integration" type="checkbox" name="k_integration" value="{{ kofi_settings['integration'] }}" checked> </td>
                         <td>Enable Ko-fi integration.</td>
-                        {% else %}
-                        <td> <input id="k_integration" type="checkbox" name="k_integration" value="{{ kofi_settings['integration'] }}"> </td>
-                        <td>Enable Ko-fi integration. ("Kofi Settings" button will appear in the navigation bar when enabled.)</td>
-                        {% endif %}
                     </tr>
                     <tr>
                         <td> <label for="k_token">Verification Token:</label> </td>
                         <td style="padding: 5px;"> <input id="k_token" type="password" name="k_token" value="{{ kofi_settings['token'] }}" size="40"> </td>
-                        <td>Get from Kofi -> More -> API -> Webhooks -> Advanced -> Verification Token.</td>
+                        <td>Get from Ko-fi -> More -> API -> Webhooks -> Advanced -> Verification Token.</td>
                     </tr>
                     <tr>
                         <td> <label for="k_enable_donations">Enable points for donations:</label> </td>
@@ -417,9 +412,9 @@
                         <td>How many points should viewers recieve, for every dollar they donate?</td>
                     </tr>
                     <tr>
-                        <td> <label for="kofi_url">Kofi Page:</label> </td>
+                        <td> <label for="kofi_url">Ko-fi URL:</label> </td>
                         <td style="padding: 5px;"> <input id="kofi_url" type="text" name="kofi_url" value="{{ kofi_settings['kofi_url'] }}" size="30"> </td>
-                        <td>What is your Kofi page URL?</td>
+                        <td>What is your Ko-fi URL?</td>
                     </tr>
                     <tr>
                         <table>

+ 39 - 21
ownchatbot/templates/userpanel.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 <head>
-    <title>OCB - Stream Points and Rewards</title>
+    <title>OwnchatBot</title>
     <link rel="icon" type="image/x-icon" href="/static/img/favicon.ico">
     <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
 </head>
@@ -35,32 +35,45 @@
         </ul>
         
         <hr>
-        {% if kofi_integration %}
-            <h4><a href="{{ kofi_settings['kofi_url'] }}/donate" target="new"><img alt="Kofi Coffee Cup" src="/static/img/kofi_symbol.png"></a> Kofi Integration</h4>
+        <table>
+        {% if kofi_settings['donations'] %}
+            <tr style="border-bottom: none;">
+            <td><h4><a href="{{ kofi_settings['kofi_url'] }}/donate" target="new"><img style="height: 25px; width: auto; padding-right: 8px; !important" alt="Coffee Cup Logo" src="/static/img/kofi_symbol.png"></a> Ko-fi</h4></td>
             
             {% if kofi_settings['donations'] %}
-                {% set d_points_label = 'point' if donation_points == 1 else 'points' %}
-                You are awarded {{ kofi_settings['donation_points'] }} {{ d_points_label }} for every dollar you donate on Kofi.<br>
+                {% set d_points_label = 'point' if kofi_settings['donation_points'] == 1 else 'points' %}
+                <td>You are awarded {{ kofi_settings['donation_points'] }} {{ d_points_label }} for every dollar donated.<br></td>
             {% endif %}
-            
+            </tr>
+            <tr style="border-bottom: none;">            
             {% if kofi_settings['subs'] %}
-                {% set s_points_label = 'point' if sub_points == 1 else 'points' %}
-                Kofi subscribers get {{ kofi_settings['sub_points'] }} {{ s_points_label }} every month.<br>
+                {% set s_points_label = 'point' if kofi_settings['sub_points'] == 1 else 'points' %}
+                <td>Ko-fi subscribers get {{ kofi_settings['sub_points'] }} {{ s_points_label }} every month.<br></td>
             {% endif %}
-            <i> You must be authenticated with Owncast to earn points for donations.</i><br>
-            
+            </tr>
+        {% endif %}
+        
+        {% if gb_settings['donations'] %}
+            <tr style="border-bottom: none;">
+            <td><h4><a href="{{ gb_settings['gb_url'] }}" target="new"><img style="height: 25px; width: auto; padding-right: 8px; !important" alt="Give Butter Logo" src="/static/img/givebutter.png"></a> GiveButter</h4></td>
+            {% set d_points_label = 'point' if gb_settings['donation_points'] == 1 else 'points' %}
+            <td>You are awarded {{ gb_settings['donation_points'] }} {{ d_points_label }} for every dollar donated.<br></td>
+            </tr>
+        {% endif %}
+        </table>
+            <br><i> You must be authenticated with Owncast to earn points for donations.</i><br>
             {% for user in users %}
             
             <div>
                 {% if user['user_authed'] %}
                     <br>
-                    OwnchatBot recognizes your Kofi account by your email address. In order for OwnchatBot to award your donation points, you must enter the email address associated with your Kofi account here.<br><br>
+                    OwnchatBot recognizes your Ko-fi and GiveButter accounts by your email address. In order for OwnchatBot to award your donation points, you must supply your email address.<br><br>
                     
                     {% with messages = get_flashed_messages(with_categories=true) %}
                         {% if messages %}
                             {% for category, message in messages %}
                                 {% if category == 'failure' %}
-                                    <span style="color: red;">{{ message }}</span>
+                                    <span style="color: orange;">{{ message }}</span>
                                 {% endif %}
                                 {% if category == 'success' %}
                                     <span style="color: yellow;">{{ message }}</span>
@@ -70,25 +83,30 @@
                     {% endwith %}
                     
                     <form id="code" method="POST" action="/set_viewer_email">
-                        <label for="code">Type !reg_mail into the chat, and enter the code it gives you here:</label>
-                        <input id="code" type="number" name="code" size="6" aria-required="true" required><br>
-                        <label for="new_email">Enter the email address associated with your Kofi account:</label>
-                        <input id="code" type="text" name="new_email" value="{{ user[4] }}" size="40" aria-required="true" aria-label="Enter email address" required>
-                        <input type="hidden" name="instance" value="{{ instance }}">
-                        <input type="hidden" name="user_name" value="{{ username }}">
-                        <br>Email addresses are <b>ONLY</b> used for Kofi integration. They are not sent to any other individual or company, and will not be used to create or send mailing lists of any kind.<br>
+                    <table>
+                        <tr style="border-bottom: none;">
+                            <td><label for="reg_code">Type !reg_mail into the chat, and enter the code it gives you here:</label></td>
+                            <td><input id="reg_code" type="number" name="code" size="6" aria-required="true" required></td>
+                        </tr>
+                        <tr style="border-bottom: none;">
+                            <td><label for="email">Enter your email address:</label></td>
+                            <td><input id="email" type="text" name="new_email" value="{{ user[4] }}" size="40" aria-required="true" aria-label="Enter email address" required></td>
+                        </tr>
+                    </table>
+                        <input id="code" type="hidden" name="instance" value="{{ instance }}">
+                        <input id="code" type="hidden" name="user_name" value="{{ username }}">
                         <input id="code" type="hidden" name="user_id" value="{{ user[0] }}"> <button class="button button2" type="submit">Save Email</button>
                     </form><br>
+                        <i>Email addresses are ONLY used for Ko-fi and GiveButter integration. They are not sent to any other individual or company, and will not be used to create or send mailing lists of any kind. Ever.</i>
                 {% endif %}
                 </div>
             {% endfor %}
-        {% endif %}
 
         <hr>
         <h4>Other stuff</h4>
         <div>
             OwnchatBot can be downloaded from <a href=https://git.deadtom.me/deadtom/OwnchatBot>https://git.deadtom.me/deadtom/OwnchatBot</a>.<br>
-            If you are thrilled to death with OwnchatBot, and want to throw a little monetary love the developer's way, <a href=https://ko-fi.com/deadtom>he's on Kofi</a>.<br>
+            If you are thrilled to death with OwnchatBot, and want to throw a little monetary love the developer's way, <a href=https://ko-fi.com/deadtom>he's on Ko-fi</a>.<br>
             OwnchatBot © 2025 by <a href=https://www.deadtom.me>DeadTOm</a> is licensed under <a href=https://creativecommons.org/licenses/by-sa/4.0/>Creative Commons Attribution-ShareAlike 4.0 International</a>.
         </div>
         <br><br>

+ 1 - 1
ownchatbot/web_panels.py

@@ -183,7 +183,7 @@ def user_panel():
                            all_rewards=all_rewards,
                            prefix=current_app.config['PREFIX'],
                            kofi_settings=current_app.config['KOFI_SETTINGS'],
-                           kofi_integration=current_app.config['KOFI_INTEGRATION'],
+                           gb_settings=current_app.config['GB_SETTINGS'],
                            points_interval=points_interval,
                            points_award=points_award,
                            username=username,