userpanel.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>OCB - Stream Points and Rewards</title>
  5. <link rel="icon" type="image/x-icon" href="/static/img/favicon.ico">
  6. <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
  7. </head>
  8. <script src="/static/userpanel.js"></script>
  9. <div class="navbar">
  10. <div class="tab">
  11. <button class="tablinks" data-tab="ocbinfo" onclick="openTab(event, 'ocbinfo')">OwnchatBot Info</button>
  12. <button class="tablinks" data-tab="rewards" onclick="openTab(event, 'rewards')">Points and Rewards</button>
  13. <button class="tablinks" data-tab="queue" onclick="openTab(event, 'queue')">Redeems Queue</button>
  14. </div>
  15. <img src="/static/img/ownchatbotwide.png">
  16. </div>
  17. <div id='ocbinfo' class="tabcontent">
  18. <h3>OwnchatBot Info</h3>
  19. <h4>Reward types</h4>
  20. <ul>
  21. <li><u>Redeems</u> are standard stream point redeems. They get added to the queue for the streamer to fulfill.</li>
  22. <li><u>Votes</u> are just that, votes. You vote on them.</li>
  23. <li><u>Goals</u> are rewards that everyone in chat can contribute to. The streamer fulfills the reward when the goal is reached.</li>
  24. </ul>
  25. <h4>Chat commands</h4>
  26. <ul>
  27. <li>{{ prefix }}help - Shows the help message.</li>
  28. <li>{{ prefix }}points - Shows your current points.</li>
  29. <li>{{ prefix }}rewards - Shows you the list of active rewards.</li>
  30. </ul>
  31. {% if kofi_integration %}
  32. {% for user in users %}
  33. {% set points_label = 'point' if tip_points == 1 else 'points' %}
  34. <h4>Kofi</h4>
  35. <div>
  36. {% if user['user_authed'] %}
  37. <a href="{{ kofi_settings['kofi_url'] }}/tip" target="new"><img src="/static/img/kofi/{{ kofi_settings['kofi_logo'] }}"></a><br>
  38. {% if kofi_settings['tips'] %}
  39. You are awarded {{ kofi_settings['tip_points'] }} {{ points_label }} for every dollar you tip on Kofi.<br>
  40. {% endif %}
  41. OwnchatBot recognizes your Kofi account by your email address. In order for OwnchatBot to award your tip points, you must enter the email address associated with your Kofi account here.<br><br>
  42. <form method="POST" action="/set_viewer_email">
  43. <label for="new_email">Your Kofi email address:</label>
  44. <input type="text" name="new_email" value="{{ user[4] }}" size="40">
  45. <input type="hidden" name="instance" value="{{ instance }}">
  46. <input type="hidden" name="user_name" value="{{ username }}">
  47. <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>
  48. <input type="hidden" name="user_id" value="{{ user[0] }}"> <button class="button button2" type="submit">Save Email</button>
  49. </form><br>
  50. {% else %}
  51. <i>You must authenticate with Owncast to get Kofi rewards.</i><br>
  52. {% endif %}
  53. </div>
  54. {% endfor %}
  55. {% endif %}
  56. <h4>Other stuff</h4>
  57. <div>
  58. OwnchatBot can be downloaded from <a href=https://git.deadtom.me/deadtom/OwnchatBot>https://git.deadtom.me/deadtom/OwnchatBot</a>.<br>
  59. If you are thrilled to death with OwnchatBot, and want to throw a little monetary love his way, <a href=https://ko-fi.com/deadtom>he's on Kofi</a>.<br>
  60. 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>.
  61. </div>
  62. </div>
  63. <div id='rewards' class="tabcontent">
  64. <body>
  65. <h3>Points and Rewards</h3>
  66. {% for user in users %}
  67. {% set points_label = 'point' if points_award == 1 else 'points' %}
  68. {% set minutes_label = 'minute' if points_interval == 1 else 'minutes' %}
  69. &nbsp;&nbsp;{{ user[1] }}, you currently have {{ user[2] }} {{ points_label }}.<br>
  70. &nbsp;&nbsp;You are accruing {{ points_award }} {{ points_label }} every {{ points_interval }} {{ minutes_label }}.
  71. {% if kofi_integration %}
  72. {% if kofi_settings['tips'] %}
  73. {% set points_label = 'point' if tip_points == 1 else 'points' %}
  74. <br>&nbsp;&nbsp;You can also get {{ kofi_settings['tip_points'] }} {{ points_label }} for every dollar you tip me on Kofi. 🤑
  75. {% endif %}
  76. {% endif %}
  77. {% endfor %}
  78. <h3>Active Votes</h3>
  79. {% if votes %}
  80. <table>
  81. <thead>
  82. <tr>
  83. <th style="width: 20%;">Name</th>
  84. <th style="width: 40%;">Description</th>
  85. <th style="width: 20%;">Price</th>
  86. <th style="width: 20%;">Current Tally</th>
  87. </tr>
  88. </thead>
  89. <tbody>
  90. {% for vote in votes %}
  91. <tr>
  92. <td> {{ prefix }}{{ vote[0] }} </td>
  93. <td> {{ vote[2] }} </td>
  94. {% set points_label = 'point' if rewards[vote[0]]["price"] == 1 else 'points' %}
  95. <td> {{ rewards[vote[0]]["price"] }} {{ points_label }}</td>
  96. {% set votes_label = 'vote' if vote[1] == 1 else 'votes' %}
  97. <td> {{ vote[1] }} {{ votes_label }}</td>
  98. </tr>
  99. {% endfor %}
  100. </tbody>
  101. </table>
  102. {% else %}
  103. &nbsp;&nbsp;There are currently no active votes
  104. <br>
  105. {% endif %}
  106. <h3>Active Goals</h3>
  107. {% if goals %}
  108. <table>
  109. <thead>
  110. <tr>
  111. <th style="width: 20%;">Name</th>
  112. <th style="width: 40%;">Description</th>
  113. <th style="width: 25%;">Progress</th>
  114. <th></th>
  115. </tr>
  116. </thead>
  117. <tbody>
  118. {% for goal in goals %}
  119. <tr>
  120. <td> {{ prefix }}{{ goal[0] }} </td>
  121. <td> {{ goal[3] }} </td>
  122. {% set progress = goal[1] / goal[2] * 100 %}
  123. <td><div class="bar-light-grey bar-tiny bar-round">
  124. <div class="bar-round bar-blue" style="text-align: center; width:{{ goal[1] / goal[2] * 100 }}%;">{{ '%0.0f'| format(progress| float) }}%</div></td>
  125. {% if goal[1] == goal[2] %}
  126. <td> {{ goal[1] }} / {{ goal[2] }} <img src=/static/img/tada.png style="width: 24px; height: 24px;"></td>
  127. {% else %}
  128. <td> {{ goal[1] }} / {{ goal[2] }} </td>
  129. {% endif %}
  130. </tr>
  131. {% endfor %}
  132. </tbody>
  133. </table>
  134. {% else %}
  135. &nbsp;&nbsp;There are currently no active goals
  136. <br>
  137. {% endif %}
  138. </body>
  139. <body>
  140. <h3>Active Redeems</h3>
  141. {% if rewards %}
  142. <table>
  143. <thead>
  144. <tr>
  145. <th style="width: 20%;">Name</th>
  146. <th style="width: 40%;">Description</th>
  147. <th>Cool down</th>
  148. <th style="width: 25%;">Price</th>
  149. <th></th>
  150. </tr>
  151. </thead>
  152. <tbody>
  153. {% for reward, reward_info in rewards.items() %}
  154. {% if reward_info["type"] == "redeem" or reward_info["type"] == "special" %}
  155. <tr>
  156. <td>{{ prefix }}{{ reward }}</td>
  157. <td>{{ reward_info["info"] }}</td>
  158. {% if reward_info["cooldown"] > 0 %}
  159. {% set minutes_label = 'minute' if reward_info["cooldown"] == 1 else 'minutes' %}
  160. <td>{{ reward_info["cooldown"] }} {{ minutes_label }}</td>
  161. {% else %}
  162. <td>None</td>
  163. {% endif %}
  164. {% set points_label = 'point' if reward_info["price"] == 1 else 'points' %}
  165. <td>{{ reward_info["price"] }} {{ points_label }}</td>
  166. <td></td>
  167. </tr>
  168. {% endif %}
  169. {% endfor %}
  170. </tbody>
  171. </table>
  172. {% else %}
  173. &nbsp;&nbsp;There are currently no active redeems
  174. {% endif %}
  175. <br><br>
  176. </body>
  177. </div>
  178. <div id='queue' class="tabcontent">
  179. <body>
  180. <h3>Queue</h3>
  181. {% if queue %}
  182. <table>
  183. <thead>
  184. <tr>
  185. <th>Time</th>
  186. <th>Name</th>
  187. <th>Description</th>
  188. <th>User</th>
  189. <th></th>
  190. </tr>
  191. </thead>
  192. <tbody>
  193. {% for row in queue %}
  194. {% if not row[4] %}
  195. <tr>
  196. <td>{{ row[1].replace(tzinfo=utc_timezone).astimezone().strftime("%H:%M") }}</td>
  197. <td>{{ prefix }}{{ row[2] }}</td>
  198. <td>{{ all_rewards[row[2]]["info"] }}</td>
  199. {% if row[6] %}
  200. <td>{{ row[6] }}</td>
  201. {% else %}
  202. <td></td>
  203. {% endif %}
  204. </tr>
  205. {% endif %}
  206. {% endfor %}
  207. </tbody>
  208. </table>
  209. {% else %}
  210. &nbsp;&nbsp;The queue is currently empty
  211. {% endif %}
  212. </body>
  213. <br><br>
  214. </div>
  215. <script>
  216. setTimeout(refreshPage, 30 * 1000);
  217. </script>
  218. </html>