userpanel.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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. <li><u>Milestones</u> are smaller goals inside a goal, to celebrate and/or reward progress toward the larger goal.</li>
  25. </ul>
  26. <h4>Chat commands</h4>
  27. <ul>
  28. <li>{{ prefix }}help - Shows the help message.</li>
  29. <li>{{ prefix }}points - Shows your current points.</li>
  30. <li>{{ prefix }}rewards - Shows you the list of active rewards.</li>
  31. </ul>
  32. {% if kofi_integration %}
  33. {% for user in users %}
  34. {% set points_label = 'point' if tip_points == 1 else 'points' %}
  35. <h4>Kofi</h4>
  36. <div>
  37. {% if user['user_authed'] %}
  38. <a href="{{ kofi_settings['kofi_url'] }}/tip" target="new"><img src="/static/img/kofi/{{ kofi_settings['kofi_logo'] }}"></a><br>
  39. {% if kofi_settings['tips'] %}
  40. You are awarded {{ kofi_settings['tip_points'] }} {{ points_label }} for every dollar you tip on Kofi.<br>
  41. {% endif %}
  42. 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>
  43. <form method="POST" action="/set_viewer_email">
  44. <label for="code">Type !reg_mail into the chat, and enter the code it gives you here:</label>
  45. <input type="number" name="code" size="6" required><br>
  46. <label for="new_email">Enter the email address associated with your Kofi account:</label>
  47. <input type="text" name="new_email" value="{{ user[4] }}" size="40" required>
  48. <input type="hidden" name="instance" value="{{ instance }}">
  49. <input type="hidden" name="user_name" value="{{ username }}">
  50. <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>
  51. <input type="hidden" name="user_id" value="{{ user[0] }}"> <button class="button button2" type="submit">Save Email</button>
  52. </form><br>
  53. {% else %}
  54. <i>You must authenticate with Owncast to get Kofi rewards.</i><br>
  55. {% endif %}
  56. </div>
  57. {% endfor %}
  58. {% endif %}
  59. <h4>Other stuff</h4>
  60. <div>
  61. OwnchatBot can be downloaded from <a href=https://git.deadtom.me/deadtom/OwnchatBot>https://git.deadtom.me/deadtom/OwnchatBot</a>.<br>
  62. 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>
  63. 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>.
  64. </div>
  65. </div>
  66. <div id='rewards' class="tabcontent">
  67. <body>
  68. <h3>Points and Rewards</h3>
  69. {% for user in users %}
  70. {% set points_label = 'point' if points_award == 1 else 'points' %}
  71. {% set minutes_label = 'minute' if points_interval == 1 else 'minutes' %}
  72. &nbsp;&nbsp;{{ user[1] }}, you currently have {{ user[2] }} {{ points_label }}.<br>
  73. &nbsp;&nbsp;You are accruing {{ points_award }} {{ points_label }} every {{ points_interval }} {{ minutes_label }}.
  74. {% if kofi_integration %}
  75. {% if kofi_settings['tips'] %}
  76. {% set points_label = 'point' if tip_points == 1 else 'points' %}
  77. <br>&nbsp;&nbsp;You can also get {{ kofi_settings['tip_points'] }} {{ points_label }} for every dollar you tip me on Kofi. 🤑
  78. {% endif %}
  79. {% endif %}
  80. {% endfor %}
  81. <h3>Active Votes</h3>
  82. {% if votes %}
  83. <table>
  84. <thead>
  85. <tr>
  86. <th style="width: 20%;">Name</th>
  87. <th style="width: 40%;">Description</th>
  88. <th style="width: 20%;">Price</th>
  89. <th style="width: 20%;">Current Tally</th>
  90. </tr>
  91. </thead>
  92. <tbody>
  93. {% for vote in votes %}
  94. <tr>
  95. <td> {{ prefix }}{{ vote[0] }} </td>
  96. <td> {{ vote[2] }} </td>
  97. {% set points_label = 'point' if rewards[vote[0]]["price"] == 1 else 'points' %}
  98. <td> {{ rewards[vote[0]]["price"] }} {{ points_label }}</td>
  99. {% set votes_label = 'vote' if vote[1] == 1 else 'votes' %}
  100. <td> {{ vote[1] }} {{ votes_label }}</td>
  101. </tr>
  102. {% endfor %}
  103. </tbody>
  104. </table>
  105. {% else %}
  106. &nbsp;&nbsp;There are currently no active votes
  107. <br>
  108. {% endif %}
  109. <h3>Active Goals</h3>
  110. {% if goals %}
  111. <table>
  112. <thead>
  113. <tr>
  114. <th style="width: 20%;">Name</th>
  115. <th style="width: 40%;">Description</th>
  116. <th style="width: 25%;">Progress</th>
  117. <th></th>
  118. </tr>
  119. </thead>
  120. <tbody>
  121. {% for goal in goals %}
  122. <tr>
  123. <td> {{ prefix }}{{ goal[0] }} </td>
  124. <td> {{ goal[3] }} </td>
  125. {% set progress = goal[1] / goal[2] * 100 %}
  126. <td>
  127. <div class="bar-light-grey bar-tiny bar-round" style="position: relative;">
  128. <div class="bar-round bar-blue" style="text-align: center; width:{{ progress }}%;">{{ '%0.0f'| format(progress| float) }}%
  129. </div>
  130. {% set milestones = rewards[goal[0]]["milestones"] %}
  131. {% for milestone_key, milestone in milestones.items() %}
  132. {% if milestones[milestone_key][0] and milestones[milestone_key][1] %}
  133. {% if milestones[milestone_key][1] < goal[2] %}
  134. {% set milestone_progress = milestones[milestone_key][1] / goal[2] * 100 %}
  135. <div class="milestone-marker" style="position: absolute; left: {{ milestone_progress }}%; transform: translateX(-50%);">
  136. <img src="/static/img/milestone.png" style="width: 16px; height: 16px;" title="{{ milestones[milestone_key][1] }} points. {{ milestones[milestone_key][0] }}">
  137. </div>
  138. {% endif %}
  139. {% endif %}
  140. {% endfor %}
  141. </div>
  142. </td>
  143. {% if goal[1] == goal[2] %}
  144. <td> {{ goal[1] }} / {{ goal[2] }} <img src=/static/img/tada.png style="width: 24px; height: 24px;"></td>
  145. {% else %}
  146. <td> {{ goal[1] }} / {{ goal[2] }} </td>
  147. {% endif %}
  148. </tr>
  149. {% endfor %}
  150. <tr style="border-bottom: none;">
  151. <td></td>
  152. <td></td>
  153. <td style="font-size: small;">
  154. (Mouse over flags for milestone details)
  155. </td>
  156. </tr>
  157. </tbody>
  158. </table>
  159. {% else %}
  160. &nbsp;&nbsp;There are currently no active goals
  161. <br>
  162. {% endif %}
  163. </body>
  164. <body>
  165. <h3>Active Redeems</h3>
  166. {% if rewards %}
  167. <table>
  168. <thead>
  169. <tr>
  170. <th style="width: 20%;">Name</th>
  171. <th style="width: 40%;">Description</th>
  172. <th>Cool down</th>
  173. <th style="width: 25%;">Price</th>
  174. <th></th>
  175. </tr>
  176. </thead>
  177. <tbody>
  178. {% for reward, reward_info in rewards.items() %}
  179. {% if reward_info["type"] == "redeem" or reward_info["type"] == "special" %}
  180. <tr>
  181. <td>{{ prefix }}{{ reward }}</td>
  182. <td>{{ reward_info["info"] }}</td>
  183. {% if reward_info["cooldown"] > 0 %}
  184. {% set minutes_label = 'minute' if reward_info["cooldown"] == 1 else 'minutes' %}
  185. <td>{{ reward_info["cooldown"] }} {{ minutes_label }}</td>
  186. {% else %}
  187. <td>None</td>
  188. {% endif %}
  189. {% set points_label = 'point' if reward_info["price"] == 1 else 'points' %}
  190. <td>{{ reward_info["price"] }} {{ points_label }}</td>
  191. <td></td>
  192. </tr>
  193. {% endif %}
  194. {% endfor %}
  195. </tbody>
  196. </table>
  197. {% else %}
  198. &nbsp;&nbsp;There are currently no active redeems
  199. {% endif %}
  200. <br><br>
  201. </body>
  202. </div>
  203. <div id='queue' class="tabcontent">
  204. <body>
  205. <h3>Queue</h3>
  206. {% if queue %}
  207. <table>
  208. <thead>
  209. <tr>
  210. <th>Time</th>
  211. <th>Name</th>
  212. <th>Description</th>
  213. <th>User</th>
  214. <th></th>
  215. </tr>
  216. </thead>
  217. <tbody>
  218. {% for row in queue %}
  219. {% if not row[4] %}
  220. <tr>
  221. <td>{{ row[1].replace(tzinfo=utc_timezone).astimezone().strftime("%H:%M") }}</td>
  222. <td>{{ prefix }}{{ row[2] }}</td>
  223. <td>{{ all_rewards[row[2]]["info"] }}</td>
  224. {% if row[6] %}
  225. <td>{{ row[6] }}</td>
  226. {% else %}
  227. <td></td>
  228. {% endif %}
  229. </tr>
  230. {% endif %}
  231. {% endfor %}
  232. </tbody>
  233. </table>
  234. {% else %}
  235. &nbsp;&nbsp;The queue is currently empty
  236. {% endif %}
  237. </body>
  238. <br><br>
  239. </div>
  240. <script>
  241. setTimeout(refreshPage, 30 * 1000);
  242. </script>
  243. </html>