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