From 3f72c3fffe18f4977bbed66f4084bd0a4ef83660 Mon Sep 17 00:00:00 2001 From: _Fervor_ <87570146+UFervor@users.noreply.github.com> Date: Fri, 3 Feb 2023 23:31:49 +0800 Subject: [PATCH 1/2] Update web.py --- cps/web.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index 3a575d9e..5fbf9c07 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1159,7 +1159,14 @@ def serve_book(book_id, book_format, anyname): data = calibre_db.get_book_format(book_id, book_format.upper()) if not data: return "File not in Database" - log.info('Serving book: %s', data.name) + + range_header = request.headers.get('Range', None) + if not range_header: + log.info('Serving book: %s', data.name) + response = make_response(send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format)) + response.headers['Accept-Ranges'] = 'bytes' + return response + if config.config_use_google_drive: try: headers = Headers() From 6da7d05c6c38ae00613fdee7ab0621ef5363ba42 Mon Sep 17 00:00:00 2001 From: _Fervor_ <87570146+UFervor@users.noreply.github.com> Date: Fri, 3 Feb 2023 23:34:55 +0800 Subject: [PATCH 2/2] Update readpdf.html --- cps/templates/readpdf.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cps/templates/readpdf.html b/cps/templates/readpdf.html index e2876c61..2eb9b73d 100644 --- a/cps/templates/readpdf.html +++ b/cps/templates/readpdf.html @@ -43,7 +43,9 @@ See https://github.com/adobe-type-tools/cmap-resources