userpanel.html 14 KB

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