123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>OCB Management Panel</title>
- <link rel="icon" type="image/x-icon" href="/static/img/favicon.ico">
- <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
- </head>
- <script src="/static/mgmtpanel.js"></script>
-
- <div class="navbar">
- <div class="tab">
- <button class="tablinks" data-tab="queue" onclick="openTab(event, 'queue')">Queue</button>
- <button class="tablinks" data-tab="balances" onclick="openTab(event, 'balances')">Points Balances</button>
- <button class="tablinks" data-tab="managerewards" onclick="openTab(event, 'managerewards')">Rewards</button>
- <button class="tablinks" data-tab="categories" onclick="openTab(event, 'categories')">Categories</button>
- <button class="tablinks" data-tab="settings" onclick="openTab(event, 'settings')">Settings</button>
- </div>
- <img src="/static/img/ownchatbotwide.png">
- </div>
-
- <div id='queue' class="tabcontent">
- <body>
- {% if votes %}
- <table>
- <thead>
- <tr>
- <th style="width: 20%;">Active Votes</th>
- <th style="width: 40%;">Description</th>
- <th style="width: 20%;">Price</th>
- <th style="width: 20%;">Current Tally</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {% for vote in votes %}
- <tr>
- <td> {{ prefix }}{{ vote[0] }} </td>
- <td> {{ vote[2] }} </td>
-
- {% set points_label = 'point' if rewards[vote[0]]["price"] == 1 else 'points' %}
- <td> {{ rewards[vote[0]]["price"] }} {{ points_label }}</td>
-
- {% set votes_label = 'vote' if vote[1] == 1 else 'votes' %}
-
- <td> {{ vote[1] }} {{ votes_label }}</td>
- <td></td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% else %}
- <h3> You currently have no active votes. </h3>
- {% endif %}
- <br>
- <hr>
- {% if goals %}
- <table>
- <thead>
- <tr>
- <th style="width: 20%;">Active Goals</th>
- <th style="width: 40%;">Description</th>
- <th style="width: 25%;">Progress</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {% for goal in goals %}
- <tr>
- <td> {{ prefix }}{{ goal[0] }} </td>
- <td> {{ goal[3] }} </td>
- {% set progress = goal[1] / goal[2] * 100 %}
- <td><div class="bar-light-grey bar-tiny bar-round">
- <div class="bar-round bar-blue" style="text-align: center; width:{{ goal[1] / goal[2] * 100 }}%;">{{ '%0.0f'| format(progress| float) }}%</div></td>
- {% if goal[1] == goal[2] %}
- <td> {{ goal[1] }} / {{ goal[2] }} <img src=/static/img/tada.png style="width: 24px; height: 24px;"></td>
- {% else %}
- <td> {{ goal[1] }} / {{ goal[2] }} </td>
- {% endif %}
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% else %}
- <h3> You currently have no active goals. </h3>
- {% endif %}
- <br>
- <hr>
- <h3>Redeems Queue</h3>
- {% if queue %}
- <a href="/mgmt/clearfulfilled"><button class="button button2" onclick="openTab(event, 'queue')">Clear Fullfilled Rewards</button></a> <a href="/mgmt/clearqueue"><button class="button button2" onclick="openTab(event, 'queue')">Clear All Rewards</button></a>
- <table>
- <thead>
- <tr>
- <th>Time</th>
- <th>Reward</th>
- <th>User</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {% for row in queue %}
- <tr>
- <td>{{ row[1].replace(tzinfo=utc_timezone).astimezone().strftime("%H:%M") }}</td>
- {% if row[4] %}
- <td><s>{{ rewards[row[2]]["info"] }}</s></td>
- {% else %}
- <td>{{ rewards[row[2]]["info"] }}</td>
- {% endif %}
- <td>{{ row[6] }}</td>
- {% if row[4] %}
- {% if row[5] %}
- <td>Refunded</td>
- {% else %}
- <td><a href="/mgmt/refund?reward={{ row[2] }}&username={{ row[6] }}&rewarder_id={{ row[3] }}&reward_id={{ row[0] }} "><button class="button button2" onclick="openTab(event, 'queue')">Refund</button></a></td>
- {% endif %}
- {% else %}
- <td><a href="/mgmt/fulfill?reward_id={{ row[0] }}&username={{ row[6] }}"><button class="button button2" onclick="openTab(event, 'queue')">Fulfill</button></a></td>
- {% endif %}
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% else %}
- <p>There are currently no rewards waiting in the queue.</p>
- {% endif %}
- </body>
- </div>
- <div id='balances' class="tabcontent">
- <body>
- <h3>Viewer points balances</h3>
- {% if users %}
- <table>
- <thead>
- <tr>
- <th>User</th>
- <th>Points balance</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {% for user in users %}
- <tr>
- <td> {{ user[0] }} </td>
- {% set points_label = 'point' if user[1] == 1 else 'points' %}
-
- <td>{{ user[1] }} {{ points_label }}</td>
- <td> <a href="/mgmt/adjust/{{ user[2] }}?name={{ user[0] }}&points={{ user[1] }}"><button class="button button2" onclick="openTab(event, 'panel')">Adjust Points</button></a> </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endif %}
- </body>
- </div>
- <div id='managerewards' class="tabcontent">
- <h3>Manage rewards</h3>
- <body>
- <div>
- <h4>Reward Types:</h4>
- <ul>
-
- <li><u>Redeems</u> are standard stream point redeems. They get added to the queue for the streamer to fulfill.</li>
- <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>
- <ul>
- <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>
- </ul>
- <li><u>Votes</u> are just that, votes. Your viewers can vote on them.</li>
- <li><u>Goals</u> are rewards that everyone in chat can contribute to. The streamer fulfills the reward when the goal is reached.</li>
- <li>Add rewards to categories to enable and disable groups of rewards.</li>
- <li>Rewards with no categories are inactive.</li>
- </ul>
- </div>
- <table>
- <tr>
- <td>
- </td>
- <td>
- </td>
- <td>
- </td>
- <td>
- </td>
- </tr>
- <tr>
- <td>
- <a href="{{ url_for('web_panels.add', reward_type='redeem') }}"><button class="button button2" onclick="openTab(event, 'managerewards')">Create a Redeem</button></a><br>
- </td>
- <td>
- <a href="{{ url_for('web_panels.add', reward_type='special') }}"><button class="button button2" onclick="openTab(event, 'managerewards')">Create a Special</button></a><br>
- </td>
- <td>
- <a href="{{ url_for('web_panels.add', reward_type='vote') }}"><button class="button button2" onclick="openTab(event, 'managerewards')">Create a Vote</button></a><br>
- </td>
- <td>
- <a href="{{ url_for('web_panels.add', reward_type='goal') }}"><button class="button button2" onclick="openTab(event, 'managerewards')">Create a Goal</button></a><br>
- </td>
- </tr>
- </table>
- <br>
- {% if rewards %}
- Rewards in <span style="color: red !important;">red</span> are inactive. To activate a reward, add it to an active category.
- <table>
- <thead>
- <tr>
- <th style="width:15%">Name</th>
- <th>Target</th>
- <th>Price</th>
- <th>Type</th>
- <th>Info</th>
- <th>Cool down</th>
- <th>Category</th>
- <th style="width:15%">Actions</th>
- </tr>
- </thead>
- <tbody>
- {% for reward, reward_info in rewards.items() %}
- {% if reward in active_rewards %}
- <tr>
- {% else %}
- <tr style="color: red;">
- {% endif %}
- <td>{{ prefix }}{{ reward }}</td>
- {% if reward_info["type"] == "goal" %}
- <td>{{ reward_info["target"] }}</td>
- {% else %}
- <td>N/A</td>
- {% endif %}
- {% if reward_info["type"] == "goal" %}
- <td>N/A</td>
- {% else %}
- <td>{{ reward_info["price"] }}</td>
- {% endif %}
- <td>{{ reward_info["type"] }}</td>
- <td>{{ reward_info["info"] }}</td>
- {% if reward_info["cooldown"] > 0 %}
- {% set minutes_label = 'minute' if reward_info["cooldown"] == 1 else 'minutes' %}
- <td>{{ reward_info["cooldown"] }} {{ minutes_label }}</td>
- {% else %}
- <td>None</td>
- {% endif %}
- <td>{{ reward_info["categories"] | join(', ') }}</td>
- <td>
- <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> 
- <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> 
- {% if reward_info["type"] == "goal" or reward_info["type"] == "vote" %}
- <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>
- {% endif %}
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endif %}
- </body>
- </div>
- <div id='categories' class="tabcontent">
- <body>
- <h3>Manage Categories</h3>
- <div>
- <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>
- <table>
- <thead>
- <tr>
- <th style="width: 50%;"><h3>Active Categories</h3></th>
- <th style="width: 50%;"><h3>Inactive Categories</h3></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- {% for cat in active_categories %}
- {{ cat }} - <a href="/mgmt/deactivate/{{ cat }}"><span style="color: green;">Deactivate</span></a> <a href="/mgmt/delcat/{{ cat }}/active"><span style="color: red;">Delete</span></a><br>
- {% endfor %}
- </td>
- <td>
- {% for cat in inactive_categories %}
- {{ cat }} - <a href="/mgmt/activate/{{ cat }}"><span style="color: green;">Activate</span></a> <a href="/mgmt/delcat/{{ cat }}/inactive"><span style="color: red;">Delete</span></a><br>
- {% endfor %}
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </body>
- </div>
- <div id='settings' class="tabcontent">
- <body style="text-align: left;">
- <form method="POST" method="POST" action="/mgmt/settings">
- <table>
- <h3>OwnchatBot Settings</h3>
- <thead>
- <tr style="border-bottom: none;">
- <th style="width: 20%;"></th>
- <th></th>
- <th style="width: 50%;"></th>
- </tr>
- </thead>
- <tr>
- <td> <label for="mgmt_auth">Management Auth Code:</label> </td>
- <td style="padding: 5px;"> <input type="textr" name="mgmt_auth" value="{{ settings_info[0] }}" size="30" required> </td>
- <td>Pregenerated during install. Goes in your management panel URL. Keep it secret. Keep it safe.<br>
- http://localhost:5000/mgmt?auth={{ settings_info[0] }}</td>
- </tr>
- <tr>
- <td> <label for="points_interval">Points Interval:</label> </td>
- <td> <input type="number" name="points_interval" value="{{ settings_info[1] }}" size="5" required> minutes</td>
- <td>How often do you want to award your viewers points?</td>
- </tr>
- <tr>
- <td> <label for="points_award">Points Award:</label> </td>
- <td> <input type="number" name="points_award" value="{{ settings_info[2] }}" size="5" required> points</td>
- <td>How many points do you want to award them?</td>
- </tr>
- <tr>
- <td> <label for="gunicorn_logging">Gunicorn Logging:</label> </td>
- {% if settings_info[3] %}
- <td> <input type="checkbox" name="gunicorn_logging" value="{{ settings_info[3] }}" checked> </td>
- {% else %}
- <td> <input type="checkbox" name="gunicorn_logging" value="{{ settings_info[3] }}"> </td>
- {% endif %}
- <td>Enable Gunicorn logging integration.</td>
- </tr>
- <tr>
- <td> <label for="prefix">Chat Command Prefix:</label> </td>
- <td> <input type="text" name="prefix" maxlength="1" size="1" value="{{ settings_info[4] }}" required> </td>
- <td>Character that preceeds chat commands, so OwnchatBot knows what to look for.<br>Example: "{{ settings_info[4] }}points"</td>
- </tr>
- </table>
- <h3>Owncast Integration</h3>
- <table>
- <thead>
- <tr style="border-bottom: none;">
- <th style="width: 20%;"></th>
- <th></th>
- <th style="width: 50%;"></th>
- </tr>
- </thead>
- <tr>
- <td> <label for="access_token">Access Token:</label> </td>
- <td style="padding: 5px;"> <input type="text" name="access_token" value="{{ settings_info[5] }}" size="30" required> </td>
- <td>Create in Owncast Admin panel. Integrations -> Access Tokens</td>
- </tr>
- <tr>
- <td> <label for="owncast_url">Your Owncast URL:</label> </td>
- <td> <input type="text" name="owncast_url" value="{{ settings_info[6] }}" size="30" required> </td>
- <td>The address of your Owncast instance. Can be an internal address, such as "localhost" if that's the case.</td>
- </tr>
- </table>
- <br><button class="button button2" type="submit">Save Changes</button><br>
- </form>
- <br><br>
- </body>
- </div>
- </html>
|