feat: disable direct MP3 download from customer player page

- Add controlsList=nodownload to audio elements.
- Serve audio with Content-Disposition: inline to discourage browser save dialogs.
This commit is contained in:
Troll (Hermes Agent) 2026-08-03 18:49:26 +00:00
parent 1694b50160
commit 56493f5ea7
2 changed files with 6 additions and 3 deletions

5
app.py
View file

@ -649,7 +649,10 @@ def audio(token, version):
path = req.get(field)
if not path or not Path(path).exists():
abort(404)
return send_from_directory(Path(path).parent, Path(path).name)
response = send_from_directory(Path(path).parent, Path(path).name)
response.headers['Content-Disposition'] = 'inline'
response.headers['X-Content-Type-Options'] = 'nosniff'
return response
# ---------------------------------------------------------------------------

View file

@ -131,13 +131,13 @@
<!-- Version A player -->
<div class="player">
<h3>Version A</h3>
<audio controls src="{{ url_for('audio', token=req.player_token, version='a') }}"></audio>
<audio controls controlsList="nodownload" src="{{ url_for('audio', token=req.player_token, version='a') }}"></audio>
</div>
<!-- Version B player -->
<div class="player">
<h3>Version B</h3>
<audio controls src="{{ url_for('audio', token=req.player_token, version='b') }}"></audio>
<audio controls controlsList="nodownload" src="{{ url_for('audio', token=req.player_token, version='b') }}"></audio>
</div>
{% if req.status == 'revisions_requested' %}