userpanel.html 12 KB

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