Merge remote-tracking branch '401/patch-1'
This commit is contained in:
@@ -33,6 +33,7 @@ log = logger.create()
|
|||||||
# custom error page
|
# custom error page
|
||||||
|
|
||||||
def error_http(error):
|
def error_http(error):
|
||||||
|
headers = {'WWW-Authenticate': 'Basic realm="calibre-web"'} if error.code == 401 else {}
|
||||||
return render_template('http_error.html',
|
return render_template('http_error.html',
|
||||||
error_code="Error {0}".format(error.code),
|
error_code="Error {0}".format(error.code),
|
||||||
error_name=error.name,
|
error_name=error.name,
|
||||||
@@ -40,7 +41,7 @@ def error_http(error):
|
|||||||
goto_admin=False,
|
goto_admin=False,
|
||||||
unconfigured=not config.db_configured,
|
unconfigured=not config.db_configured,
|
||||||
instance=config.config_calibre_web_title
|
instance=config.config_calibre_web_title
|
||||||
), error.code
|
), error.code, headers
|
||||||
|
|
||||||
|
|
||||||
def internal_error(error):
|
def internal_error(error):
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
# import json
|
|
||||||
from urllib.parse import unquote_plus
|
from urllib.parse import unquote_plus
|
||||||
|
|
||||||
from flask import Blueprint, request, render_template, make_response, abort, g, jsonify
|
from flask import Blueprint, request, render_template, make_response, abort, g, jsonify
|
||||||
@@ -439,6 +438,7 @@ def feed_shelf(book_id):
|
|||||||
@opds.route("/opds/download/<book_id>/<book_format>/")
|
@opds.route("/opds/download/<book_id>/<book_format>/")
|
||||||
@requires_basic_auth_if_no_ano
|
@requires_basic_auth_if_no_ano
|
||||||
def opds_download_link(book_id, book_format):
|
def opds_download_link(book_id, book_format):
|
||||||
|
return abort(401)
|
||||||
if not auth.current_user().role_download():
|
if not auth.current_user().role_download():
|
||||||
return abort(401)
|
return abort(401)
|
||||||
client = "kobo" if "Kobo" in request.headers.get('User-Agent') else ""
|
client = "kobo" if "Kobo" in request.headers.get('User-Agent') else ""
|
||||||
|
|||||||
Reference in New Issue
Block a user