1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-24 18:47:23 +00:00

Fix visibility for sending to reader without download permissions (fix for #2847)

This commit is contained in:
Ozzie Isaacs 2023-07-29 15:15:38 +02:00
parent fda62dde1d
commit 279f0569e4
2 changed files with 25 additions and 24 deletions

View File

@ -40,6 +40,7 @@ $(".sendbtn-form").click(function() {
$.ajax({ $.ajax({
method: 'post', method: 'post',
url: $(this).data('href'), url: $(this).data('href'),
data: {csrf_token: $("input[name='csrf_token']").val()},
success: function (data) { success: function (data) {
handleResponse(data) handleResponse(data)
} }

View File

@ -43,30 +43,30 @@
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endif %} {% if current_user.kindle_mail and entry.email_share_list %}
{% if current_user.kindle_mail and entry.email_share_list %} <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> {% if entry.email_share_list.__len__() == 1 %}
{% if entry.email_share_list.__len__() == 1 %} <div class="btn-group" role="group">
<div class="btn-group" role="group"> <button id="sendbtn" class="btn btn-primary sendbtn-form" data-href="{{url_for('web.send_to_ereader', book_id=entry.id, book_format=entry.email_share_list[0]['format'], convert=entry.email_share_list[0]['convert'])}}">
<button id="sendbtn" class="btn btn-primary sendbtn-form" data-href="{{url_for('web.send_to_ereader', book_id=entry.id, book_format=entry.email_share_list[0]['format'], convert=entry.email_share_list[0]['convert'])}}"> <span class="glyphicon glyphicon-send"></span> {{entry.email_share_list[0]['text']}}
<span class="glyphicon glyphicon-send"></span> {{entry.email_share_list[0]['text']}} </button>
</button> </div>
</div> {% else %}
{% else %} <div class="btn-group" role="group">
<div class="btn-group" role="group"> <button id="sendbtn2" type="button" class="btn btn-primary dropdown-toggle"
<button id="sendbtn2" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-send"></span>{{ _('Send to eReader') }}
<span class="glyphicon glyphicon-send"></span>{{ _('Send to eReader') }} <span class="caret"></span>
<span class="caret"></span> </button>
</button> <ul class="dropdown-menu" aria-labelledby="send-to-ereader">
<ul class="dropdown-menu" aria-labelledby="send-to-ereader"> {% for format in entry.email_share_list %}
{% for format in entry.email_share_list %} <li>
<li> <a class="sendbtn-form" data-href="{{url_for('web.send_to_ereader', book_id=entry.id, book_format=format['format'], convert=format['convert'])}}">{{ format['text'] }}</a>
<a class="sendbtn-form" data-href="{{url_for('web.send_to_ereader', book_id=entry.id, book_format=format['format'], convert=format['convert'])}}">{{ format['text'] }}</a> </li>
</li> {% endfor %}
{% endfor %} </ul>
</ul> </div>
</div> {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if entry.reader_list and current_user.role_viewer() %} {% if entry.reader_list and current_user.role_viewer() %}