diff --git a/README.md b/README.md index 2d9c7d18..e32fe7f8 100755 --- a/README.md +++ b/README.md @@ -143,6 +143,7 @@ in your Docker run/compose file. Omit this variable for a lightweight image. - **Common Issues**: - If you experience issues starting the application, check the log files located in the `logs` directory for error messages. - If eBooks fail to load, verify that the `Location of Calibre database` is correctly set and that the database file is accessible. + - You need to enable uploads under `Basic settings` for this option to appear - **Configuration Errors**: Ensure that your Calibre database is compatible and properly formatted. Refer to the Calibre documentation for guidance on maintaining the database. diff --git a/cps/config_sql.py b/cps/config_sql.py index bbca3241..c73a6cf0 100644 --- a/cps/config_sql.py +++ b/cps/config_sql.py @@ -403,7 +403,7 @@ class ConfigSQL(object): self.save() def get_book_path(self): - return self.config_calibre_split_dir if self.config_calibre_split_dir else self.config_calibre_dir + return self.config_calibre_split_dir if self.config_calibre_split else self.config_calibre_dir def store_calibre_uuid(self, calibre_db, Library_table): from . import app diff --git a/cps/constants.py b/cps/constants.py index 21fecebe..1ddef87c 100644 --- a/cps/constants.py +++ b/cps/constants.py @@ -175,7 +175,7 @@ BookMeta = namedtuple('BookMeta', 'file_path, extension, title, author, cover, d 'series_id, languages, publisher, pubdate, identifiers') # python build process likes to have x.y.zbw -> b for beta and w a counting number -STABLE_VERSION = '0.6.26b' +STABLE_VERSION = '0.6.27b' NIGHTLY_VERSION = dict() NIGHTLY_VERSION[0] = '$Format:%H$' diff --git a/cps/db.py b/cps/db.py index ccf28a7a..e8a7415d 100644 --- a/cps/db.py +++ b/cps/db.py @@ -416,8 +416,8 @@ class Books(Base): path = Column(String, default="", nullable=False) has_cover = Column(Integer, default=0) uuid = Column(String) - isbn = Column(String(collation='NOCASE'), default="") - flags = Column(Integer, nullable=False, default=1) + # isbn = Column(String(collation='NOCASE'), default="") + # flags = Column(Integer, nullable=False, default=1) authors = relationship(Authors, secondary=books_authors_link, backref='books') tags = relationship(Tags, secondary=books_tags_link, backref='books', order_by="Tags.name") diff --git a/cps/helper.py b/cps/helper.py index 3d712165..8cd7b451 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -1091,14 +1091,12 @@ def get_download_link(book_id, book_format, client): file_name = book.title if len(book.authors) > 0: file_name = file_name + ' - ' + book.authors[0].name - if client == "kindle": - file_name = get_valid_filename(file_name, replace_whitespace=False, force_unidecode=True) - else: - file_name = quote(get_valid_filename(file_name, replace_whitespace=False)) + file_name = get_valid_filename(file_name, replace_whitespace=False, force_unidecode=True) + quoted_file_name = file_name if client == "kindle" else quote(file_name) headers = Headers() headers["Content-Type"] = mimetypes.types_map.get('.' + book_format, "application/octet-stream") headers["Content-Disposition"] = ('attachment; filename="{}.{}"; filename*=UTF-8\'\'{}.{}').format( - file_name, book_format, file_name, book_format) + file_name, book_format, quoted_file_name, book_format) return do_download_file(book, book_format, client, data1, headers) else: log.error("Book id {} not found for downloading".format(book_id)) diff --git a/cps/kobo.py b/cps/kobo.py index 879e18f1..da9c9bc5 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -41,13 +41,12 @@ from werkzeug.datastructures import Headers from sqlalchemy import func from sqlalchemy.sql.expression import and_, or_ from sqlalchemy.exc import StatementError -from sqlalchemy.sql import select import requests from . import config, logger, kobo_auth, db, calibre_db, helper, shelf as shelf_lib, ub, csrf, kobo_sync_status from . import isoLanguages from .epub import get_epub_layout -from .constants import COVER_THUMBNAIL_SMALL, COVER_THUMBNAIL_MEDIUM, COVER_THUMBNAIL_LARGE +from .constants import COVER_THUMBNAIL_SMALL, COVER_THUMBNAIL_MEDIUM, COVER_THUMBNAIL_LARGE, BASE_DIR from .helper import get_download_link from .services import SyncToken as SyncToken from .web import download_required @@ -1044,6 +1043,7 @@ def make_calibre_web_auth_response(): @csrf.exempt +@kobo.route("/v1/auth/refresh", methods=["POST"]) @kobo.route("/v1/auth/device", methods=["POST"]) @requires_kobo_auth def HandleAuthRequest(): @@ -1133,6 +1133,14 @@ def download_book(book_id, book_format): def NATIVE_KOBO_RESOURCES(): + kobo_file = os.path.join(BASE_DIR, "kobo_resources.txt") + try: + if os.path.isfile(kobo_file): + with open(kobo_file, "r") as f: + lines = f.read() + return json.loads(lines) + except Exception as e: + log.error(e) return { "account_page": "https://www.kobo.com/account/settings", "account_page_rakuten": "https://my.rakuten.co.jp/", diff --git a/cps/templates/http_error.html b/cps/templates/http_error.html index 1c3e17a8..ad364092 100644 --- a/cps/templates/http_error.html +++ b/cps/templates/http_error.html @@ -5,7 +5,7 @@ - + {% if g.google_site_verification|length > 0 %} {% endif %} diff --git a/cps/templates/layout.html b/cps/templates/layout.html index b7962fc7..dfb347ae 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -7,7 +7,7 @@ - + {% if g.google_site_verification|length > 0 %} {% endif %} diff --git a/cps/templates/listenmp3.html b/cps/templates/listenmp3.html index 6cd8c607..4ba6931e 100644 --- a/cps/templates/listenmp3.html +++ b/cps/templates/listenmp3.html @@ -7,7 +7,7 @@ {{ entry.title }} - + {% if g.google_site_verification|length > 0 %} {% endif %} diff --git a/cps/templates/read.html b/cps/templates/read.html index 86d7347e..08a8f3af 100644 --- a/cps/templates/read.html +++ b/cps/templates/read.html @@ -7,7 +7,7 @@ {{_('epub Reader')}} | {{title}} - + {% if g.google_site_verification|length > 0 %} {% endif %} @@ -82,7 +82,7 @@

{{_('Settings')}}

- {{_('Choose a theme below:')}}}
+ {{_('Choose a theme below:')}}
@@ -102,11 +102,11 @@ - + TestAnonymous 13 - 12 - 1 + 13 + 0 0 0 @@ -206,31 +206,11 @@ - +
TestAnonymous - test_guest_random_books_available
- -
- FAIL -
- - - - + PASS @@ -1043,11 +1023,11 @@ AssertionError: <selenium.webdriver.remote.webelement.WebElement (session= - + TestEditAdditionalBooks 18 - 17 - 1 + 18 + 0 0 0 @@ -1093,31 +1073,11 @@ AssertionError: <selenium.webdriver.remote.webelement.WebElement (session= - +
TestEditAdditionalBooks - test_details_popup
- -
- FAIL -
- - - - + PASS @@ -2079,13 +2039,13 @@ AssertionError: 0 != 1 - + TestLoadMetadata 1 + 0 + 0 1 0 - 0 - 0 Detail @@ -2093,11 +2053,32 @@ AssertionError: 0 != 1 - +
TestLoadMetadata - test_load_metadata
- PASS + +
+ ERROR +
+ + + + @@ -2289,11 +2270,11 @@ AssertionError: 0 != 1 - + TestLoadMetadataScholar 1 - 1 0 + 1 0 0 @@ -2303,11 +2284,31 @@ AssertionError: 0 != 1 - +
TestLoadMetadataScholar - test_load_metadata
- PASS + +
+ FAIL +
+ + + + @@ -2577,11 +2578,11 @@ AssertionError: 0 != 1 - + TestErrorReadColumn 2 - 1 - 1 + 2 + 0 0 0 @@ -2600,31 +2601,11 @@ AssertionError: 0 != 1 - +
TestErrorReadColumn - test_invalid_custom_read_column
- -
- FAIL -
- - - - + PASS @@ -3148,11 +3129,11 @@ AssertionError: False is not true - + TestCalibreWebListOrders 16 - 14 - 2 + 16 + 0 0 0 @@ -3216,64 +3197,20 @@ AssertionError: False is not true - +
TestCalibreWebListOrders - test_order_authors_all_links
- -
- FAIL -
- - - - + PASS - +
TestCalibreWebListOrders - test_order_series_all_links
- -
- FAIL -
- - - - + PASS @@ -4747,11 +4684,11 @@ AssertionError: 'book7' != 'Buuko' - + TestThumbnails 8 - 7 - 0 + 6 + 1 0 1 @@ -4824,11 +4761,31 @@ AssertionError: 'book7' != 'Buuko' - +
TestThumbnails - test_sideloaded_book
- PASS + +
+ FAIL +
+ + + + @@ -5340,12 +5297,12 @@ AssertionError: 'book7' != 'Buuko' - + TestUserTemplate 21 - 20 + 21 + 0 0 - 1 0 Detail @@ -5471,32 +5428,11 @@ AssertionError: 'book7' != 'Buuko' - +
TestUserTemplate - test_limit_book_languages
- -
- ERROR -
- - - - + PASS @@ -5565,12 +5501,12 @@ IndexError: list index out of range - + TestCalibreWebVisibilitys 35 - 24 - 10 - 1 + 35 + 0 + 0 0 Detail @@ -5678,31 +5614,11 @@ IndexError: list index out of range - +
TestCalibreWebVisibilitys - test_admin_change_visibility_random
- -
- FAIL -
- - - - + PASS @@ -5725,33 +5641,11 @@ AssertionError: 11 != 1 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_read
- -
- FAIL -
- - - - + PASS @@ -5783,63 +5677,20 @@ AssertionError: 'Read Books (1)' != 'Top Rated Books' - +
TestCalibreWebVisibilitys - test_archive_books
- -
- FAIL -
- - - - + PASS - +
TestCalibreWebVisibilitys - test_authors_max_settings
- -
- ERROR -
- - - - + PASS @@ -5871,89 +5722,29 @@ IndexError: list index out of range - +
TestCalibreWebVisibilitys - test_link_column_to_read_status
- -
- FAIL -
- - - - + PASS - +
TestCalibreWebVisibilitys - test_random_books_available
- -
- FAIL -
- - - - + PASS - +
TestCalibreWebVisibilitys - test_read_status_visible
- -
- FAIL -
- - - - + PASS @@ -5967,60 +5758,20 @@ AssertionError: 2 != 1 - +
TestCalibreWebVisibilitys - test_restrict_columns
- -
- FAIL -
- - - - + PASS - +
TestCalibreWebVisibilitys - test_restrict_tags
- -
- FAIL -
- - - - + PASS @@ -6043,62 +5794,20 @@ AssertionError: 6 != 7 - +
TestCalibreWebVisibilitys - test_search_order
- -
- FAIL -
- - - - + PASS - +
TestCalibreWebVisibilitys - test_search_string
- -
- FAIL -
- - - - + PASS @@ -6283,9 +5992,9 @@ AssertionError: 7 != 4 Total 538 - 514 - 15 + 528 2 + 1 7   @@ -6398,7 +6107,7 @@ AssertionError: 7 != 4 greenlet - 3.3.0 + 3.3.1 Basic @@ -6458,7 +6167,7 @@ AssertionError: 7 != 4 SQLAlchemy - 2.0.45 + 2.0.46 Basic @@ -6500,7 +6209,7 @@ AssertionError: 7 != 4 httplib2 - 0.31.1 + 0.31.2 TestBackupMetadataGdrive @@ -6530,7 +6239,7 @@ AssertionError: 7 != 4 httplib2 - 0.31.1 + 0.31.2 TestCliGdrivedb @@ -6560,7 +6269,7 @@ AssertionError: 7 != 4 httplib2 - 0.31.1 + 0.31.2 TestEbookConvertCalibreGDrive @@ -6590,7 +6299,7 @@ AssertionError: 7 != 4 httplib2 - 0.31.1 + 0.31.2 TestEbookConvertGDriveKepubify @@ -6632,7 +6341,7 @@ AssertionError: 7 != 4 httplib2 - 0.31.1 + 0.31.2 TestEditAuthorsGdrive @@ -6668,7 +6377,7 @@ AssertionError: 7 != 4 httplib2 - 0.31.1 + 0.31.2 TestEditBooksOnGdrive @@ -6710,7 +6419,7 @@ AssertionError: 7 != 4 httplib2 - 0.31.1 + 0.31.2 TestEmbedMetadataGdrive @@ -6740,7 +6449,7 @@ AssertionError: 7 != 4 httplib2 - 0.31.1 + 0.31.2 TestSetupGdrive @@ -6836,7 +6545,7 @@ AssertionError: 7 != 4