mirror of
https://github.com/janeczku/calibre-web
synced 2025-01-02 05:20:29 +00:00
Merge branch 'master' into Develop
This commit is contained in:
commit
985e59ad68
@ -23,6 +23,7 @@ import json
|
|||||||
import mimetypes
|
import mimetypes
|
||||||
import chardet # dependency of requests
|
import chardet # dependency of requests
|
||||||
import copy
|
import copy
|
||||||
|
import importlib
|
||||||
|
|
||||||
from flask import Blueprint, jsonify
|
from flask import Blueprint, jsonify
|
||||||
from flask import request, redirect, send_from_directory, make_response, flash, abort, url_for, Response
|
from flask import request, redirect, send_from_directory, make_response, flash, abort, url_for, Response
|
||||||
@ -36,7 +37,6 @@ from sqlalchemy.exc import IntegrityError, InvalidRequestError, OperationalError
|
|||||||
from sqlalchemy.sql.expression import text, func, false, not_, and_, or_
|
from sqlalchemy.sql.expression import text, func, false, not_, and_, or_
|
||||||
from sqlalchemy.orm.attributes import flag_modified
|
from sqlalchemy.orm.attributes import flag_modified
|
||||||
from sqlalchemy.sql.functions import coalesce
|
from sqlalchemy.sql.functions import coalesce
|
||||||
|
|
||||||
from werkzeug.datastructures import Headers
|
from werkzeug.datastructures import Headers
|
||||||
from werkzeug.security import generate_password_hash, check_password_hash
|
from werkzeug.security import generate_password_hash, check_password_hash
|
||||||
|
|
||||||
@ -86,6 +86,10 @@ except ImportError:
|
|||||||
sort = sorted # Just use regular sort then, may cause issues with badly named pages in cbz/cbr files
|
sort = sorted # Just use regular sort then, may cause issues with badly named pages in cbz/cbr files
|
||||||
|
|
||||||
|
|
||||||
|
sql_version = importlib.metadata.version("sqlalchemy")
|
||||||
|
sqlalchemy_version2 = ([int(x) for x in sql_version.split('.')] >= [2, 0, 0])
|
||||||
|
|
||||||
|
|
||||||
@app.after_request
|
@app.after_request
|
||||||
def add_security_headers(resp):
|
def add_security_headers(resp):
|
||||||
default_src = ([host.strip() for host in config.config_trustedhosts.split(',') if host] +
|
default_src = ([host.strip() for host in config.config_trustedhosts.split(',') if host] +
|
||||||
@ -532,7 +536,7 @@ def render_author_books(page, author_id, order):
|
|||||||
flash(_("Oops! Selected book is unavailable. File does not exist or is not accessible"),
|
flash(_("Oops! Selected book is unavailable. File does not exist or is not accessible"),
|
||||||
category="error")
|
category="error")
|
||||||
return redirect(url_for("web.index"))
|
return redirect(url_for("web.index"))
|
||||||
if constants.sqlalchemy_version2:
|
if sqlalchemy_version2:
|
||||||
author = calibre_db.session.get(db.Authors, author_id)
|
author = calibre_db.session.get(db.Authors, author_id)
|
||||||
else:
|
else:
|
||||||
author = calibre_db.session.query(db.Authors).get(author_id)
|
author = calibre_db.session.query(db.Authors).get(author_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user