Fix #1181 and Fix #1182 handle removed "is_xhr" on werkzeug version 1.0.0

This commit is contained in:
Ozzie Isaacs
2020-02-08 14:40:13 +01:00
parent 2535bbbcf1
commit e04aa80fd6
4 changed files with 15 additions and 13 deletions
+2 -2
View File
@@ -172,7 +172,7 @@ def remote_login_required(f):
def inner(*args, **kwargs):
if config.config_remote_login:
return f(*args, **kwargs)
if request.is_xhr:
if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
data = {'status': 'error', 'message': 'Forbidden'}
response = make_response(json.dumps(data, ensure_ascii=False))
response.headers["Content-Type"] = "application/json; charset=utf-8"
@@ -1468,7 +1468,7 @@ def show_book(book_id):
audioentries.append(media_format.format.lower())
return render_title_template('detail.html', entry=entries, audioentries=audioentries, cc=cc,
is_xhr=request.is_xhr, title=entries.title, books_shelfs=book_in_shelfs,
is_xhr=request.headers.get('X-Requested-With')=='XMLHttpRequest', title=entries.title, books_shelfs=book_in_shelfs,
have_read=have_read, kindle_list=kindle_list, reader_list=reader_list, page="book")
else:
log.debug(u"Error opening eBook. File does not exist or file is not accessible:")