mgmt.html.0.2.4 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>OCB Management Panel</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/mgmtpanel.js"></script>
  9. <div class="navbar">
  10. <div class="tab">
  11. <button class="tablinks" onclick="window.open('{{ url_for('web_panels.mgmtqueue') }}', '_blank')">Rewards Queue Management</button>
  12. <button class="tablinks" data-tab="managerewards" onclick="openTab(event, 'managerewards')">Rewards</button>
  13. <button class="tablinks" data-tab="categories" onclick="openTab(event, 'categories')">Categories</button>
  14. <button class="tablinks" data-tab="accounts" onclick="openTab(event, 'accounts')">Manage Accounts</button>
  15. <button class="tablinks" data-tab="announcements" onclick="openTab(event, 'announcements')">Announcements</button>
  16. <button class="tablinks" data-tab="settings" onclick="openTab(event, 'settings')">Settings</button>
  17. {% if kofi_integration %}
  18. <button class="tablinks" data-tab="kofi-settings" onclick="openTab(event, 'kofi-settings')">Kofi Settings</button>
  19. {% endif %}
  20. </div>
  21. <img src="/static/img/ownchatbotwide.png">
  22. </div>
  23. <div id='managerewards' class="tabcontent">
  24. <h3>Manage Rewards</h3>
  25. <body>
  26. <div>
  27. <h4>Reward Types:</h4>
  28. <ul>
  29. <li><u>Redeems</u> are standard stream point redeems. They get added to the queue for the streamer to fulfill.</li>
  30. <li><u>Specials</u> are redeems, but they run system commands and scripts. This enables you to integrate a lot of other fun things, such as letting your viewers control lighting, activate devices, trigger webhooks, etc. Specials do not go into the queue, because they happen automagically.</li>
  31. <ul>
  32. <li>Be careful with this one. It does require some more advanced scripting/command line knowledge. Make sure you test your specials before letting viewers use them.</li>
  33. </ul>
  34. <li><u>Votes</u> are just that, votes. Your viewers can vote on them.</li>
  35. <li><u>Goals</u> are rewards that everyone in chat can contribute to. The streamer fulfills the reward when the goal is reached.</li>
  36. <li>Add rewards to categories to enable and disable groups of rewards.</li>
  37. <li>Rewards with no categories are inactive.</li>
  38. </ul>
  39. </div>
  40. <table>
  41. <tr>
  42. <td>
  43. </td>
  44. <td>
  45. </td>
  46. <td>
  47. </td>
  48. <td>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td>
  53. <a href="{{ url_for('web_panels.add', reward_type='redeem') }}"><button class="button button2" onclick="openTab(event, 'managerewards')">Create a Redeem</button></a><br>
  54. </td>
  55. <td>
  56. <a href="{{ url_for('web_panels.add', reward_type='special') }}"><button class="button button2" onclick="openTab(event, 'managerewards')">Create a Special</button></a><br>
  57. </td>
  58. <td>
  59. <a href="{{ url_for('web_panels.add', reward_type='vote') }}"><button class="button button2" onclick="openTab(event, 'managerewards')">Create a Vote</button></a><br>
  60. </td>
  61. <td>
  62. <a href="{{ url_for('web_panels.add', reward_type='goal') }}"><button class="button button2" onclick="openTab(event, 'managerewards')">Create a Goal</button></a><br>
  63. </td>
  64. </tr>
  65. </table>
  66. <br>
  67. {% if rewards %}
  68. Rewards in <span style="color: red !important;">red</span> are inactive. To activate a reward, add it to an active category.
  69. <table>
  70. <thead>
  71. <tr>
  72. <th style="width:15%">Name</th>
  73. <th>Target</th>
  74. <th>Price</th>
  75. <th>Info</th>
  76. <th>Cool down</th>
  77. <th>Category</th>
  78. <th style="width:15%">Actions</th>
  79. </tr>
  80. </thead>
  81. <tbody>
  82. {% for reward, reward_info in rewards.items() %}
  83. {% if reward in active_rewards %}
  84. <tr>
  85. {% else %}
  86. <tr style="color: red;">
  87. {% endif %}
  88. <td>{{ prefix }}{{ reward }}</td>
  89. {% if reward_info["type"] == "goal" %}
  90. <td>{{ reward_info["target"] }}</td>
  91. {% else %}
  92. <td>N/A</td>
  93. {% endif %}
  94. {% if reward_info["type"] == "goal" %}
  95. <td>N/A</td>
  96. {% else %}
  97. <td>{{ reward_info["price"] }}</td>
  98. {% endif %}
  99. <td>{{ reward_info["info"] }}</td>
  100. {% if reward_info["cooldown"] > 0 %}
  101. {% set minutes_label = 'minute' if reward_info["cooldown"] == 1 else 'minutes' %}
  102. <td>{{ reward_info["cooldown"] }} {{ minutes_label }}</td>
  103. {% else %}
  104. <td>None</td>
  105. {% endif %}
  106. <td>{{ reward_info["categories"] | join(', ') }}</td>
  107. <td>
  108. <a href="{{ url_for('web_panels.edit', reward_name=reward) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: green;">Edit</span></button></a>&nbsp
  109. <a href="{{ url_for('web_panels.delete', reward_name=reward) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: red;">Delete</span></button></a>&nbsp
  110. {% if reward_info["type"] == "goal" or reward_info["type"] == "vote" %}
  111. <a href="{{ url_for('web_panels.reset', reward_name=reward, reward_type=reward_info["type"]) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: orange;">Reset</span></button></a>
  112. {% endif %}
  113. </td>
  114. </tr>
  115. {% endfor %}
  116. </tbody>
  117. </table>
  118. {% endif %}
  119. </body>
  120. </div>
  121. <div id='accounts' class="tabcontent">
  122. <body>
  123. <h3>Manage Viewer Accounts</h3>
  124. {% if users %}
  125. <table>
  126. <thead>
  127. <tr>
  128. <th>User</th>
  129. <th>Points balance</th>
  130. <th>Email</th>
  131. <th>Authed</th>
  132. <th></th>
  133. </tr>
  134. </thead>
  135. <tbody>
  136. {% for user in users %}
  137. <tr>
  138. <td> {{ user[1] }} </td>
  139. {% set points_label = 'point' if user[2] == 1 else 'points' %}
  140. <td>{{ user[2] }} {{ points_label }}</td>
  141. {% if user[4] %}
  142. <td>{{ user[4] }}</td>
  143. {% else %}
  144. <td>none</td>
  145. {% endif %}
  146. {% if user[3] %}
  147. <td>Yes</td>
  148. {% else %}
  149. <td>No</td>
  150. {% endif %}
  151. <td> <a href="/mgmt/edit_account/{{ user[0] }}?name={{ user[1] }}&points={{ user[2] }}&email={{ user[4] }}"><button class="button button2" onclick="openTab(event, 'panel')">Edit</button></a> </td>
  152. </tr>
  153. {% endfor %}
  154. </tbody>
  155. </table>
  156. {% endif %}
  157. </body>
  158. </div>
  159. <div id='categories' class="tabcontent">
  160. <body>
  161. <h3>Manage Categories</h3>
  162. <div>
  163. &nbsp;&nbsp;<a href="{{ url_for('web_panels.add', reward_type='category') }}"><button class="button button2" onclick="openTab(event, 'categories')">Create a new category</button></a><br>
  164. <table>
  165. <thead>
  166. <tr>
  167. <th style="width: 50%;"><h3>Active Categories</h3></th>
  168. <th style="width: 50%;"><h3>Inactive Categories</h3></th>
  169. </tr>
  170. </thead>
  171. <tbody>
  172. <tr>
  173. <td>
  174. {% for cat in active_categories %}
  175. &nbsp;&nbsp;{{ cat }} - <a href="/mgmt/deactivate/{{ cat }}"><span style="color: green;">Deactivate</span></a>&nbsp;<a href="/mgmt/delcat/{{ cat }}/active"><span style="color: red;">Delete</span></a><br>
  176. {% endfor %}
  177. </td>
  178. <td>
  179. {% for cat in inactive_categories %}
  180. &nbsp;&nbsp;{{ cat }} - <a href="/mgmt/activate/{{ cat }}"><span style="color: green;">Activate</span></a>&nbsp;<a href="/mgmt/delcat/{{ cat }}/inactive"><span style="color: red;">Delete</span></a><br>
  181. {% endfor %}
  182. </td>
  183. </tr>
  184. </tbody>
  185. </table>
  186. </div>
  187. </body>
  188. </div>
  189. <div id='announcements' class="tabcontent">
  190. <body>
  191. <form method="POST" action="/mgmt/announcements">
  192. <table>
  193. <h3>Manage Announcements</h3>
  194. <table>
  195. <thead>
  196. <tr style="border-bottom: none;">
  197. <th style="width: 20%;"></th>
  198. <th style="width: 50%;"></th>
  199. <th></th>
  200. </tr>
  201. </thead>
  202. <tr>
  203. <td> <label for="announce_enable">Enable:</label> </td>
  204. {% if settings_info[9] %}
  205. <td> <input type="checkbox" name="announce_enable" value="{{ settings_info[9] }}" checked> </td>
  206. {% else %}
  207. <td> <input type="checkbox" name="announce_enable" value="{{ settings_info[9] }}"> </td>
  208. {% endif %}
  209. <td>Enable periodic announcements</td>
  210. </tr>
  211. <tr>
  212. <td> <label for="announce_interval">Interval:</label> </td>
  213. <td> <input type="number" name="announce_interval" value="{{ settings_info[10] }}" size="2" required> minutes</td>
  214. <td>How long between each announcement?</td>
  215. </tr>
  216. <tr>
  217. <td> <label for="announcements">Announcements:</label> </td>
  218. <td>
  219. <textarea name="announcements" rows="5" cols="50">{{ announcements | join('\n') }}</textarea>
  220. </td>
  221. <td>Enter your announcements, one per line. May contain html <a href=https://www.w3schools.com/tags/tag_img.asp>IMG tags</a> to display images.</td>
  222. </tr>
  223. </table>
  224. <br><button class="button button2" type="submit">Save Changes</button><br>
  225. </form>
  226. <br><br>
  227. </body>
  228. </div>
  229. <div id='settings' class="tabcontent">
  230. <body style="text-align: left;">
  231. <form method="POST" action="/mgmt/settings">
  232. <table>
  233. <h3>OwnchatBot Settings</h3>
  234. <thead>
  235. <tr style="border-bottom: none;">
  236. <th style="width: 20%;"></th>
  237. <th></th>
  238. <th style="width: 50%;"></th>
  239. </tr>
  240. </thead>
  241. <tr>
  242. <td> <label for="points_interval">Points Interval:</label> </td>
  243. <td> <input type="number" name="points_interval" value="{{ settings_info[1] }}" size="5" required> minutes</td>
  244. <td>How often do you want to award your viewers points?</td>
  245. </tr>
  246. <tr>
  247. <td> <label for="points_award">Points Award:</label> </td>
  248. <td> <input type="number" name="points_award" value="{{ settings_info[2] }}" size="5" required> points</td>
  249. <td>How many points do you want to award them?</td>
  250. </tr>
  251. <tr>
  252. <td> <label for="follow_points">Follow Points:</label> </td>
  253. <td> <input type="number" name="follow_points" value="{{ settings_info[11] }}" size="5" required> points</td>
  254. <td>How many points do you want to award viewers for following your stream?</td>
  255. </tr>
  256. <tr>
  257. <td> <label for="gunicorn_logging">Gunicorn Logging:</label> </td>
  258. {% if settings_info[3] %}
  259. <td> <input type="checkbox" name="gunicorn_logging" value="{{ settings_info[3] }}" checked> </td>
  260. {% else %}
  261. <td> <input type="checkbox" name="gunicorn_logging" value="{{ settings_info[3] }}"> </td>
  262. {% endif %}
  263. <td>Enable Gunicorn logging integration.</td>
  264. </tr>
  265. <tr>
  266. <td> <label for="prefix">Chat Command Prefix:</label> </td>
  267. <td> <input type="text" name="prefix" maxlength="1" size="1" value="{{ settings_info[4] }}" required> </td>
  268. <td>Character that preceeds chat commands, so OwnchatBot knows what to look for.<br>Example: "{{ settings_info[4] }}points"</td>
  269. </tr>
  270. </table>
  271. <h3>Owncast Integration</h3>
  272. <table>
  273. <thead>
  274. <tr style="border-bottom: none;">
  275. <th style="width: 20%;"></th>
  276. <th></th>
  277. <th style="width: 50%;"></th>
  278. </tr>
  279. </thead>
  280. <tr>
  281. <td> <label for="access_id">Access Token Name:</label> </td>
  282. <td style="padding: 5px;"> <input type="text" name="access_id" value="{{ settings_info[0] }}" size="40"> </td>
  283. <td>Create in Owncast Admin panel. Integrations -> Access Tokens (check all three boxes)</td>
  284. </tr>
  285. <tr>
  286. <td> <label for="access_token">Access Token:</label> </td>
  287. <td style="padding: 5px;"> <input type="text" name="access_token" value="{{ settings_info[5] }}" size="40"> </td>
  288. <td>The token you created above.</td>
  289. </tr>
  290. <tr>
  291. <td> <label for="owncast_url">Your Owncast URL:</label> </td>
  292. <td> <input type="text" name="owncast_url" value="{{ settings_info[6] }}" size="40"> </td>
  293. <td>The external URL of your Owncast instance, with "http://" or "https://".</td>
  294. </tr>
  295. </table>
  296. <h3>Kofi Integration</h3>
  297. <table>
  298. <thead>
  299. <tr style="border-bottom: none;">
  300. <th style="width: 20%;"></th>
  301. <th></th>
  302. <th style="width: 50%;"></th>
  303. </tr>
  304. </thead>
  305. <tr>
  306. <td> <label for="kofi_integration">Enable:</label> </td>
  307. {% if settings_info[8] %}
  308. <td> <input type="checkbox" name="kofi_integration" value="{{ settings_info[8] }}" checked> </td>
  309. <td>Enable Ko-fi integration.</td>
  310. {% else %}
  311. <td> <input type="checkbox" name="kofi_integration" value="{{ settings_info[8] }}"> </td>
  312. <td>Enable Ko-fi integration. ("Kofi Settings" button will appear in the navigation bar when enabled.)</td>
  313. {% endif %}
  314. </tr>
  315. <tr>
  316. <td> <label for="kofi_token">Verification Token:</label> </td>
  317. <td style="padding: 5px;"> <input type="text" name="kofi_token" value="{{ settings_info[7] }}" size="40"> </td>
  318. <td>Get from Kofi -> More -> API -> Webhooks -> Advanced -> Verification Token.</td>
  319. </tr>
  320. </table>
  321. <br><button class="button button2" type="submit">Save Changes</button><br>
  322. </form>
  323. <br><br>
  324. </body>
  325. </div>
  326. <div id='kofi-settings' class="tabcontent">
  327. <body style="text-align: left;">
  328. <form method="POST" action="/mgmt/ksettings">
  329. <table>
  330. <h3>Kofi Settings</h3>
  331. <h4> Donations </h4>
  332. <thead>
  333. <tr style="border-bottom: none;">
  334. <th style="width: 20%;"></th>
  335. <th></th>
  336. <th style="width: 50%;"></th>
  337. </tr>
  338. </thead>
  339. <tr>
  340. <td> <label for="enable_donations">Enable points for donations:</label> </td>
  341. {% if kofi_settings['donations'] %}
  342. <td> <input type="checkbox" name="enable_donations" value="{{ kofi_settings['donations'] }}" checked> </td>
  343. {% else %}
  344. <td> <input type="checkbox" name="enable_donations" value="{{ kofi_settings['donations'] }}"> </td>
  345. {% endif %}
  346. <td>Enable awarding points for donations</td>
  347. </tr>
  348. <tr>
  349. <td> <label for="set_donation_points">Points per dollar:</label> </td>
  350. <td> <input type="number" name="set_donation_points" value="{{ kofi_settings['donation_points'] }}" size="5" required> points</td>
  351. <td>How many points should viewers recieve, for every dollar they donate?</td>
  352. </tr>
  353. <tr>
  354. <td> <label for="kofi_url">Kofi Page:</label> </td>
  355. <td style="padding: 5px;"> <input type="text" name="kofi_url" value="{{ kofi_settings['kofi_url'] }}" size="30"> </td>
  356. <td>What is your Kofi page URL?</td>
  357. </tr>
  358. <tr>
  359. <table>
  360. <h4> Subscriptions </h4>
  361. <tbody>
  362. <tr>
  363. <td> <label for="enable_subs">Enable points for subscriptions:</label> </td>
  364. {% if kofi_settings['subs'] %}
  365. <td> <input type="checkbox" name="enable_subs" value="{{ kofi_settings['subs'] }}" checked> </td>
  366. {% else %}
  367. <td> <input type="checkbox" name="enable_subs" value="{{ kofi_settings['subs'] }}"> </td>
  368. {% endif %}
  369. <td>Enable awarding points for monthly subscriptions</td>
  370. </tr>
  371. <tr>
  372. <td> <label for="sub_points">Points per month:</label> </td>
  373. <td> <input type="number" name="sub_points" value="{{ kofi_settings['sub_points'] }}" size="6" required> points</td>
  374. <td>How many points should subscribers recieve every month?</td>
  375. </tr>
  376. </tbody>
  377. </table>
  378. </tr>
  379. <tr>
  380. <table>
  381. <h4> Logo </h4>
  382. <tbody>
  383. <tr style="border-bottom: none;">
  384. Which logo would you like to use?
  385. </tr>
  386. {% for kofi_logo in kofi_logos %}
  387. {% if loop.index0 % 8 == 0 %}
  388. <tr style="border-bottom: none;">
  389. {% endif %}
  390. <td>
  391. <label for="kofi_logo"><img src="/static/img/kofi/{{ kofi_logo }}"></label>
  392. {% if kofi_logo == kofi_settings['kofi_logo'] %}
  393. <input type="radio" name="kofi_logo" value="{{ kofi_logo }}" checked>
  394. {% else %}
  395. <input type="radio" name="kofi_logo" value="{{ kofi_logo }}">
  396. {% endif %}
  397. </td>
  398. {% if loop.index0 % 8 == 7 or loop.last %}
  399. </tr> <!-- Close the row after 8 items or at the end -->
  400. {% endif %}
  401. {% endfor %}
  402. </tbody>
  403. </table>
  404. </tr>
  405. </table>
  406. <br><button class="button button2" type="submit">Save Changes</button><br>
  407. </form>
  408. <br><br>
  409. <i>Kofi subscription tier support coming soon.</i>
  410. </body>
  411. </div>
  412. </html>