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 @@
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_anonymous.py", line 64, in test_guest_random_books_available - self.assertFalse(self.check_element_on_page((By.ID, "books_rand"))) -AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="f0805af3-ffe2-4d9c-b5f1-34a23197f6f0", element="4d083797-3ae1-441c-a8ed-0c58a63962bc")> is not false-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_edit_additional_books.py", line 896, in test_details_popup - self.assertEqual(0, len(books[1])) -AssertionError: 0 != 1-
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_metadata.py", line 87, in test_load_metadata + if results[cont]['source'] == 'https://comicvine.gamespot.com/': + ~~~~~~~^^^^^^ +IndexError: list index out of range+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_metadata_scholar.py", line 74, in test_load_metadata + self.assertEqual(30, len(results)) +AssertionError: 30 != 20+
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_error_read_column.py", line 52, in test_invalid_custom_read_column - self.assertTrue(self.check_element_on_page((By.ID, "flash_danger"))) -AssertionError: False is not true-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_list_orders.py", line 454, in test_order_authors_all_links - self.assertEqual(books[1][0]['title'], "testbook") -AssertionError: 'book7' != 'testbook' -- book7 -+ testbook-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_list_orders.py", line 385, in test_order_series_all_links - self.assertEqual(books[1][0]['title'], "Buuko") -AssertionError: 'book7' != 'Buuko' -- book7 -+ Buuko-
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_thumbnails.py", line 317, in test_sideloaded_book + self.assertAlmostEqual(diff(BytesIO(list_cover), BytesIO(old_list_cover), delete_diff_file=True), 0.0, +AssertionError: 0.01731210309182775 != 0.0 within 0.0001 delta (0.01731210309182775 difference)+
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_user_template.py", line 583, in test_limit_book_languages - self.assertEqual(int(books[1][0]['id']), 13) - ~~~~~~~~^^^ -IndexError: list index out of range-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 291, in test_admin_change_visibility_random - self.assertEqual(11, len(self.get_books_displayed()[1])) -AssertionError: 11 != 1-
Traceback (most recent call last):
- File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 220, in test_admin_change_visibility_read
- self.assertEqual('Read Books (1)',
-AssertionError: 'Read Books (1)' != 'Top Rated Books'
-- Read Books (1)
-+ Top Rated Books
- Traceback (most recent call last):
- File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 1094, in test_archive_books
- self.assertEqual('16790', resp.headers['Content-Length'])
-AssertionError: '16790' != '20409'
-- 16790
-+ 20409
- Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 1039, in test_authors_max_settings - self.assertEqual(len(list_element[1][10]['author']), 4) - ~~~~~~~~~~~~~~~^^^^ -IndexError: list index out of range-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 827, in test_link_column_to_read_status - self.assertEqual(len(list_element[1]), 0) -AssertionError: 1 != 0-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 103, in test_random_books_available - self.assertFalse(self.check_element_on_page((By.ID, "books_rand"))) -AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="deebccf7-41cf-4703-b9cb-5e3eb0f3969b", element="1d982051-15eb-418d-a2bb-a72d1eb30667")> is not false-
Traceback (most recent call last):
- File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 929, in test_read_status_visible
- self.assertEqual(len(self.adv_search({"read_status": "Yes"})), 1)
-AssertionError: 2 != 1
- Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 699, in test_restrict_columns - self.assertEqual(len(books[1]), 11) -AssertionError: 10 != 11-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 599, in test_restrict_tags - self.assertEqual(len(self.get_books_displayed()[1]), 7) -AssertionError: 6 != 7-
Traceback (most recent call last):
- File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 508, in test_search_order
- self.verify_order("search", order=order)
- File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 1426, in verify_order
- self.assertEqual(book_id, expected_result, "Key sorting order wrong: " + key)
-AssertionError: 9 != 12 : Key sorting order wrong: new
- Traceback (most recent call last):
- File "/home/ozzie/Development/calibre-web-test/test/test_visiblilitys.py", line 489, in test_search_string
- self.assertEqual(7, len(self.adv_search({'title': ' book '})))
-AssertionError: 7 != 4
-