Administrator can now disable misbehaving servers

This commit is contained in:
Jeremy Zhang
2018-01-05 08:52:22 +00:00
parent 6c4b850669
commit bf47f9457c
14 changed files with 253 additions and 6 deletions

View File

@ -0,0 +1,58 @@
{% extends 'site_layout.html.j2' %}
{% set title="Editing Disabled Servers" %}
{% block content %}
<h1>Administrating Disabled Servers</h1>
<div class="row">
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<p class="flow-text">Add an entry</p>
<table class="bordered striped">
<thead>
<tr>
<th>Server ID</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="input-field inline">
<input id="new_guild_id" placeholder="Server ID">
</div>
</td>
<td>
<a class="waves-effect waves-light btn" id="new_submit">Submit</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<table class="bordered striped">
<thead>
<tr>
<th>Remove</th>
<th>Server ID</th>
</tr>
</thead>
<tbody>
{% for guild in guilds %}
<tr>
<td><a class="waves-effect waves-light btn red" onclick="delete_guild('{{ guild }}');">Remove</a></td>
<td>{{ guild }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}
{% block script %}
<script type="text/javascript" src="{{ url_for('static', filename='js/admin_disabled_guilds.js') }}"></script>
{% endblock %}

View File

@ -27,5 +27,12 @@
<a class="waves-effect waves-light btn" href="{{ url_for('admin.manage_titan_tokens') }}">Manage</a>
</div>
</div>
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<h4>Disabled Servers</h4>
<p class="flow-text">Block or reinstate servers from using Titan Embeds.</p>
<a class="waves-effect waves-light btn" href="{{ url_for('admin.get_disabled_guilds') }}">Manage</a>
</div>
</div>
</div>
{% endblock %}

View File

@ -17,6 +17,19 @@
.</p>
<div class="row">
{% if disabled %}
<div class="col s12">
<div class="card horizontal red-text red lighten-5 z-depth-3 hoverable">
<div class="card-stacked">
<div class="card-content">
<strong class="flow-text">This server is currently disabled on the platform.</strong>
<p>You will not be able to embed the server for the time being. To have this action lifted, <em>please see an administrator</em>.</p>
</div>
</div>
</div>
</div>
{% endif %}
<div class="col s12">
<h2 class="header">Embed URLs</h2>

View File

@ -371,6 +371,7 @@
{% endraw %}
<script>
const disabled = {{ disabled|tojson|safe }};
const guild_id = "{{ guild_id }}";
const bot_client_id = "{{ client_id }}";
const visitors_enabled = {% if visitors_enabled %}true{% else %}false{% endif %};