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 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__": if __name__ == "__main__":
app.run( app.run(
host="0.0.0.0", host="0.0.0.0",

View File

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