From 5dbdef25d3495e3abd19178aa88283264a19df6f Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 23 Feb 2020 17:24:25 +0100 Subject: [PATCH 1/4] Windows compatibility --- cps/server.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cps/server.py b/cps/server.py index 576e0774..74c591ec 100755 --- a/cps/server.py +++ b/cps/server.py @@ -55,7 +55,6 @@ class WebServer(object): def __init__(self): signal.signal(signal.SIGINT, self._killServer) signal.signal(signal.SIGTERM, self._killServer) - signal.signal(signal.SIGQUIT, self._killServer) self.wsgiserver = None self.access_logger = None From 7d795771d34f605fb771634ff0ce3dcb1bd37fd8 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Mon, 24 Feb 2020 19:02:38 +0100 Subject: [PATCH 2/4] Fix #1221 --- cps/about.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/about.py b/cps/about.py index d362da9b..fd52ca7b 100644 --- a/cps/about.py +++ b/cps/about.py @@ -49,7 +49,7 @@ about = flask.Blueprint('about', __name__) _VERSIONS = OrderedDict( - Platform = '{0.system} {0.release} {0.version} {0.processor} {0.machine}'.format(platform.uname()), + Platform = '{0[0]} {0[2]} {0[3]} {0[4]} {0[5]}'.format(platform.uname()), Python=sys.version, Calibre_Web=constants.STABLE_VERSION['version'] + ' - ' + constants.NIGHTLY_VERSION[0].replace('%','%%') + ' - ' From cba3e62e71fdbcd48b768a8f8aef561a9a61d0f3 Mon Sep 17 00:00:00 2001 From: Michael Shavit Date: Wed, 26 Feb 2020 01:06:03 -0500 Subject: [PATCH 3/4] Fix issue where books weren't correctly ordered by Date added on the Kobo device. --- cps/kobo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cps/kobo.py b/cps/kobo.py index 2b09b562..ede665ef 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -21,6 +21,7 @@ import sys import base64 import os import uuid +from datetime import datetime from time import gmtime, strftime try: from urllib import unquote @@ -234,14 +235,14 @@ def create_book_entitlement(book): return { "Accessibility": "Full", "ActivePeriod": {"From": current_time(),}, - "Created": book.timestamp, + "Created": book.timestamp.strftime("%Y-%m-%dT%H:%M:%SZ"), "CrossRevisionId": book_uuid, "Id": book_uuid, "IsHiddenFromArchive": False, "IsLocked": False, # Setting this to true removes from the device. "IsRemoved": False, - "LastModified": book.last_modified, + "LastModified": book.last_modified.strftime("%Y-%m-%dT%H:%M:%SZ"), "OriginCategory": "Imported", "RevisionId": book_uuid, "Status": "Active", @@ -397,6 +398,7 @@ def HandleUserRequest(dummy=None): @kobo.route("/v1/products//reviews", methods=["GET", "POST"]) @kobo.route("/v1/products/books/", methods=["GET", "POST"]) @kobo.route("/v1/products/dailydeal", methods=["GET", "POST"]) +@kobo.route("/v1/products", methods=["GET", "POST"]) def HandleProductsRequest(dummy=None): log.debug("Unimplemented Products Request received: %s", request.base_url) return redirect_or_proxy_request() From 4e8b814ec21d83abf4eb638749b5c7486608a3db Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Wed, 26 Feb 2020 20:04:15 +0100 Subject: [PATCH 4/4] Fix download URL for IPV6 --- cps/kobo.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/cps/kobo.py b/cps/kobo.py index ede665ef..15a17022 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -214,13 +214,22 @@ def HandleMetadataRequest(book_uuid): def get_download_url_for_book(book, book_format): if not current_app.wsgi_app.is_proxied: - return "{url_scheme}://{url_base}:{url_port}/download/{book_id}/{book_format}".format( - url_scheme=request.environ['wsgi.url_scheme'], - url_base=request.environ['SERVER_NAME'], - url_port=config.config_port, - book_id=book.id, - book_format=book_format.lower() - ) + if request.environ['SERVER_NAME'] != '::': + return "{url_scheme}://{url_base}:{url_port}/download/{book_id}/{book_format}".format( + url_scheme=request.environ['wsgi.url_scheme'], + url_base=request.environ['SERVER_NAME'], + url_port=config.config_port, + book_id=book.id, + book_format=book_format.lower() + ) + else: + return "{url_scheme}://{url_base}:{url_port}/download/{book_id}/{book_format}".format( + url_scheme=request.environ['wsgi.url_scheme'], + url_base=request.host, # ToDo: both server ?? + url_port=config.config_port, + book_id=book.id, + book_format=book_format.lower() + ) else: return url_for( "web.download_link", @@ -377,7 +386,7 @@ def TopLevelEndpoint(): @kobo.route("/v1/library/tags/", methods=["POST"]) @kobo.route("/v1/library/tags/", methods=["DELETE"]) def HandleUnimplementedRequest(dummy=None, book_uuid=None, shelf_name=None, tag_id=None): - log.debug("Alternative Request received:") + log.debug("Unimplemented Library Request received: %s", request.base_url) return redirect_or_proxy_request()