1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 08:56:17 +00:00

Added disclaimer before exporting playlist

This commit is contained in:
Alban Féron 2021-04-10 15:47:31 +02:00
parent 08329fc8bc
commit 9324025c41
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165
3 changed files with 28 additions and 6 deletions

View File

@ -40,6 +40,7 @@ def playlist_details(uid):
return render_template("playlist.html", playlist=playlist)
@frontend.route("/playlist/<uid>/export")
def playlist_export(uid):
try:
@ -57,11 +58,12 @@ def playlist_export(uid):
return Response(
render_template("playlist_export.m3u", playlist=playlist),
mimetype="audio/mpegurl",
headers={"Content-disposition": f"attachment; filename={playlist.name}.m3u"}
headers={
"Content-disposition": "attachment; filename={}.m3u".format(playlist.name)
},
)
@frontend.route("/playlist/<uid>", methods=["POST"])
def playlist_update(uid):
try:

View File

@ -12,6 +12,6 @@ $(function () {
$('[data-toggle="tooltip"]').tooltip()
});
$('#confirm-delete').on('show.bs.modal', function(e) {
$('.modal').on('show.bs.modal', function(e) {
$(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});

View File

@ -32,8 +32,8 @@
aria-label="Public playlist"></span>{% else %}<span
class="glyphicon glyphicon-unchecked"
aria-label="Private playlist"></span>{% endif %}</td>
<td><a href="{{ url_for('frontend.playlist_export', uid = p.id) }}">
<button class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-arrow-down" title="Export playlist"></span></button></a></td>
<td><button class="btn btn-primary btn-xs" data-href="{{ url_for('frontend.playlist_export', uid = p.id) }}" data-toggle="modal" data-target="#confirm-export" aria-label="Export playlist">
<span class="glyphicon glyphicon-arrow-down" aria-hidden="true" data-toggle="tooltip" data-placement="top" title="Export M3U playlist"></span></button></td>
<td><button class="btn btn-danger btn-xs" data-href="{{ url_for('frontend.playlist_delete', uid = p.id) }}" data-toggle="modal" data-target="#confirm-delete" aria-label="Delete playlist">
<span class="glyphicon glyphicon-remove-circle" aria-hidden="true" data-toggle="tooltip" data-placement="top" title="Delete playlist"></span></button></td>
</tr>
@ -77,4 +77,24 @@
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade" id="confirm-export" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Warning</h4>
</div>
<div class="modal-body">
<p>The exported playlist will use the same local paths the server uses itself. This means the playlist will only
work on the very same system the Supysonic server is running. If you were to export it from another machine it
won't be usable.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Oh ok. Forget it</button>
<a type="button" class="btn btn-primary btn-ok">Got it, export the playlist</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{% endblock %}