userpanel.html 13 KB

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