Merge pull request #35 from UniversityRadioYork/marks/restart-confirm

This commit is contained in:
Marks Polakovs 2021-10-26 13:18:43 +01:00 committed by GitHub
commit 8896dc4f83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View file

@ -0,0 +1,9 @@
{% extends 'base.html' %}
{% block content_inner %}
<div class="text-center">
<p class="lead text-gray-800 mb-2">Hang on a second!</p>
<p class="text-gray-900 mb-3">Something is currently playing. Restarting will interrupt it! Are you sure?</p>
<a href="/status" class="btn btn-info">Cancel</a>
<a href="/restart?confirm=true" class="btn btn-danger">Confirm</a>
</div>
{% endblock %}

View file

@ -496,6 +496,11 @@ def quit(request):
@app.route("/restart")
def restart(request):
if request.args.get("confirm", '') != "true":
for i in range(server_state.get()["num_channels"]):
state = status(i)
if state["playing"]:
return render_template("restart-confirm.html", data=None)
server_state.update("running_state", "restarting")
data = {