Merge branch 'master' into Develop
This commit is contained in:
commit
372c284ad4
7 changed files with 69 additions and 55 deletions
37
cps/kobo.py
37
cps/kobo.py
|
@ -416,20 +416,17 @@ def make_calibre_web_auth_response():
|
|||
content = request.get_json()
|
||||
AccessToken = base64.b64encode(os.urandom(24)).decode('utf-8')
|
||||
RefreshToken = base64.b64encode(os.urandom(24)).decode('utf-8')
|
||||
if config.config_kobo_proxy:
|
||||
return redirect_or_proxy_request(proxy=True)
|
||||
else:
|
||||
response = make_response(
|
||||
jsonify(
|
||||
{
|
||||
"AccessToken": AccessToken,
|
||||
"RefreshToken": RefreshToken,
|
||||
"TokenType": "Bearer",
|
||||
"TrackingId": str(uuid.uuid4()),
|
||||
"UserKey": content['UserKey'],
|
||||
}
|
||||
)
|
||||
return make_response(
|
||||
jsonify(
|
||||
{
|
||||
"AccessToken": AccessToken,
|
||||
"RefreshToken": RefreshToken,
|
||||
"TokenType": "Bearer",
|
||||
"TrackingId": str(uuid.uuid4()),
|
||||
"UserKey": content['UserKey'],
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@kobo.route("/v1/auth/device", methods=["POST"])
|
||||
|
@ -458,11 +455,15 @@ def HandleInitRequest():
|
|||
|
||||
if not current_app.wsgi_app.is_proxied:
|
||||
log.debug('Kobo: Received unproxied request, changed request port to server port')
|
||||
calibre_web_url = "{url_scheme}://{url_base}:{url_port}".format(
|
||||
url_scheme=request.environ['wsgi.url_scheme'],
|
||||
url_base=request.environ['SERVER_NAME'],
|
||||
url_port=config.config_port
|
||||
)
|
||||
if request.environ['SERVER_NAME'] != '::':
|
||||
calibre_web_url = "{url_scheme}://{url_base}:{url_port}".format(
|
||||
url_scheme=request.environ['wsgi.url_scheme'],
|
||||
url_base=request.environ['SERVER_NAME'],
|
||||
url_port=config.config_port
|
||||
)
|
||||
else:
|
||||
log.debug('Kobo: Received unproxied request, on IPV6 host')
|
||||
calibre_web_url = url_for("web.index", _external=True).strip("/")
|
||||
else:
|
||||
calibre_web_url = url_for("web.index", _external=True).strip("/")
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ kobo_auth = Blueprint("kobo_auth", __name__, url_prefix="/kobo_auth")
|
|||
@login_required
|
||||
def generate_auth_token(user_id):
|
||||
host = ':'.join(request.host.rsplit(':')[0:-1])
|
||||
if host == '127.0.0.1' or host.lower() == 'localhost' or host =='[::ffff:7f00:1]':
|
||||
if host.startswith('127.') or host.lower() == 'localhost' or host.startswith('[::ffff:7f'):
|
||||
warning = _('PLease access calibre-web from non localhost to get valid api_endpoint for kobo device')
|
||||
return render_title_template(
|
||||
"generate_kobo_auth_url.html",
|
||||
|
|
|
@ -178,6 +178,8 @@ class WebServer(object):
|
|||
|
||||
if not self.restart:
|
||||
log.info("Performing shutdown of Calibre-Web")
|
||||
# prevent irritiating log of pending tasks message from asyncio
|
||||
logger.get('asyncio').setLevel(logger.logging.CRITICAL)
|
||||
return True
|
||||
|
||||
log.info("Performing restart of Calibre-Web")
|
||||
|
|
|
@ -193,7 +193,12 @@ class Updater(threading.Thread):
|
|||
exclude = (
|
||||
os.sep + 'app.db', os.sep + 'calibre-web.log1', os.sep + 'calibre-web.log2', os.sep + 'gdrive.db',
|
||||
os.sep + 'vendor', os.sep + 'calibre-web.log', os.sep + '.git', os.sep + 'client_secrets.json',
|
||||
os.sep + 'gdrive_credentials', os.sep + 'settings.yaml')
|
||||
os.sep + 'gdrive_credentials', os.sep + 'settings.yaml', os.sep + 'venv', os.sep + 'virtualenv',
|
||||
os.sep + 'access.log', os.sep + 'access.log1', os.sep + 'access.log2',
|
||||
)
|
||||
additional_path = self.is_venv()
|
||||
if additional_path:
|
||||
exclude = exclude + (additional_path)
|
||||
for root, dirs, files in os.walk(destination, topdown=True):
|
||||
for name in files:
|
||||
old_list.append(os.path.join(root, name).replace(destination, ''))
|
||||
|
@ -229,6 +234,12 @@ class Updater(threading.Thread):
|
|||
logger.debug("Could not remove: %s", item_path)
|
||||
shutil.rmtree(source, ignore_errors=True)
|
||||
|
||||
def is_venv(self):
|
||||
if (hasattr(sys, 'real_prefix')) or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix):
|
||||
return os.sep + os.path.relpath(sys.prefix,constants.BASE_DIR)
|
||||
else:
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def _nightly_version_info(cls):
|
||||
if is_sha1(constants.NIGHTLY_VERSION[0]) and len(constants.NIGHTLY_VERSION[1]) > 0:
|
||||
|
|
|
@ -27,7 +27,7 @@ import datetime
|
|||
import json
|
||||
import mimetypes
|
||||
import traceback
|
||||
import sys
|
||||
import binascii
|
||||
|
||||
from babel import Locale as LC
|
||||
from babel.dates import format_date
|
||||
|
@ -150,7 +150,7 @@ def load_user_from_auth_header(header_val):
|
|||
header_val = base64.b64decode(header_val).decode('utf-8')
|
||||
basic_username = header_val.split(':')[0]
|
||||
basic_password = header_val.split(':')[1]
|
||||
except (TypeError, UnicodeDecodeError):
|
||||
except (TypeError, UnicodeDecodeError, binascii.Error):
|
||||
pass
|
||||
user = _fetch_user_by_name(basic_username)
|
||||
if user and check_password_hash(str(user.password), basic_password):
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
# GDrive Integration
|
||||
google-api-python-client==1.7.11
|
||||
gevent>=1.2.1
|
||||
greenlet>=0.4.12
|
||||
httplib2>=0.9.2
|
||||
oauth2client>=4.0.0
|
||||
uritemplate>=3.0.0
|
||||
pyasn1-modules>=0.0.8
|
||||
pyasn1>=0.1.9
|
||||
PyDrive>=1.3.1
|
||||
google-api-python-client==1.7.11,<1.8.0
|
||||
gevent>=1.2.1,<1.5.0
|
||||
greenlet>=0.4.12,<0.5.0
|
||||
httplib2>=0.9.2,<0.18.0
|
||||
oauth2client>=4.0.0,<4.14.0
|
||||
uritemplate>=3.0.0,<3.1.0
|
||||
pyasn1-modules>=0.0.8,<0.3.0
|
||||
pyasn1>=0.1.9,<0.5.0
|
||||
PyDrive>=1.3.1,<1.14.0
|
||||
PyYAML>=3.12
|
||||
rsa==3.4.2
|
||||
six==1.10.0
|
||||
rsa==3.4.2,<4.1.0
|
||||
six>=1.10.0,<1.14.0
|
||||
|
||||
# goodreads
|
||||
goodreads>=0.3.2
|
||||
python-Levenshtein>=0.12.0
|
||||
goodreads>=0.3.2,<0.4.0
|
||||
python-Levenshtein>=0.12.0,<0.13.0
|
||||
|
||||
# ldap login
|
||||
python_ldap>=3.0.0
|
||||
flask-simpleldap>1.3.0
|
||||
python_ldap>=3.0.0,<3.3.0
|
||||
flask-simpleldap>1.3.0,<1.5.0
|
||||
|
||||
#oauth
|
||||
flask-dance>=0.13.0
|
||||
sqlalchemy_utils>=0.33.5
|
||||
sqlalchemy_utils>=0.33.5,<0.37.0
|
||||
|
||||
# extracting metadata
|
||||
lxml>=3.8.0
|
||||
Pillow>=4.0.0
|
||||
lxml>=3.8.0,<4.6.0
|
||||
Pillow>=4.0.0,<7.1.0
|
||||
rarfile>=2.7
|
||||
|
||||
# other
|
||||
natsort>=2.2.0
|
||||
natsort>=2.2.0,<7.1.0
|
||||
git+https://github.com/OzzieIsaacs/comicapi.git@ad8bfe5a1c31db882480433f86db2c5c57634a3f#egg=comicapi
|
||||
|
||||
#Kobo integration
|
||||
jsonschema>=3.2.0
|
||||
jsonschema>=3.2.0,<3.3.0
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
Babel>=1.3
|
||||
Flask-Babel>=0.11.1
|
||||
Flask-Login>=0.3.2
|
||||
Flask-Principal>=0.3.2
|
||||
singledispatch>=3.4.0.0
|
||||
Babel>=1.3, <2.9
|
||||
Flask-Babel>=0.11.1,<1.1.0
|
||||
Flask-Login>=0.3.2,<0.5.1
|
||||
Flask-Principal>=0.3.2,<0.5.0
|
||||
singledispatch>=3.4.0.0,<3.5.0.0
|
||||
backports_abc>=0.4
|
||||
Flask>=1.0.2
|
||||
iso-639>=0.4.5
|
||||
PyPDF2==1.26.0
|
||||
Flask>=1.0.2,<1.2.0
|
||||
iso-639>=0.4.5,<0.5.0
|
||||
PyPDF2==1.26.0,<1.27.0
|
||||
pytz>=2016.10
|
||||
requests>=2.11.1
|
||||
SQLAlchemy>=1.1.0
|
||||
tornado>=4.1
|
||||
Wand>=0.4.4
|
||||
unidecode>=0.04.19
|
||||
requests>=2.11.1,<2.23.0
|
||||
SQLAlchemy>=1.1.0,<1.4.0
|
||||
tornado>=4.1,<6.1
|
||||
Wand>=0.4.4,<0.6.0
|
||||
unidecode>=0.04.19,<1.2.0
|
||||
|
|
Loading…
Reference in a new issue