add kill endpoint

This commit is contained in:
bretello 2024-06-14 21:17:02 +02:00
parent 504a5a979f
commit 66bad99a4e
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
2 changed files with 18 additions and 2 deletions

9
app.py
View File

@ -108,6 +108,15 @@ def run(cassetta: str):
return response
@app.route("/kill", methods=["GET"])
def kill():
check_call(["pkill", "aplay"])
response = make_response(make_response("", 302))
response.headers["Location"] = "/"
return response
if __name__ == "__main__":
app.run(
host="0.0.0.0",

View File

@ -22,8 +22,13 @@
<thead>
<tr>
<th>Nome</th>
<th>
<a href="/kill">kill</a>
</th>
<!-- {% for header in headers %} -->
<!-- <th>{{ header }}</th> -->
<th>
{{ header }}
</th>
<!-- {% endfor %} -->
</tr>
</thead>
@ -31,7 +36,9 @@
{% for file in files %}
<tr>
<td>{{ file }}</td>
<td><a href="/run/{{ file }}">run</a></td>
<td>
<a href="/run/{{ file }}">run</a>
</td>
</tr>
{% endfor %}
</tbody>