userpanel.html 13 KB

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