userpanel.html 14 KB

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