diff --git a/cps/helper.py b/cps/helper.py index 08fa13873..37302075f 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -463,8 +463,8 @@ def rename_author_path(first_author, old_author_dir, renamed_author, calibre_pat except OSError as ex: log.error("Rename author from: %s to %s: %s", old_author_path, new_author_path, ex) log.debug(ex, exc_info=True) - return _("Rename author from: '%(src)s' to '%(dest)s' failed with error: %(error)s", - src=old_author_path, dest=new_author_path, error=str(ex)) + raise Exception(_("Rename author from: '%(src)s' to '%(dest)s' failed with error: %(error)s", + src=old_author_path, dest=new_author_path, error=str(ex))) return new_authordir # Moves files in file storage during author/title rename, or from temp dir to file storage diff --git a/cps/static/js/reading/epub.js b/cps/static/js/reading/epub.js index 5047b1d37..a552da055 100644 --- a/cps/static/js/reading/epub.js +++ b/cps/static/js/reading/epub.js @@ -79,6 +79,6 @@ var reader; } // Default settings load - const theme = localStorage.getItem("calibre.reader.theme") ?? Object.keys(themes)[0]; + const theme = localStorage.getItem("calibre.reader.theme") ?? "lightTheme"; selectTheme(theme); })(); diff --git a/cps/web.py b/cps/web.py index 7da22e3ab..2519ebd5b 100644 --- a/cps/web.py +++ b/cps/web.py @@ -89,21 +89,21 @@ def add_security_headers(resp): default_src = ([host.strip() for host in config.config_trustedhosts.split(',') if host] + ["'self'", "'unsafe-inline'", "'unsafe-eval'"]) - csp = "default-src " + ' '.join(default_src) + "; " - csp += "font-src 'self' data:" + csp = "default-src " + ' '.join(default_src) + if request.endpoint == "web.read_book" and config.config_use_google_drive: + csp +=" blob: " + csp += "; font-src 'self' data:" if request.endpoint == "web.read_book": - csp += " blob:" + csp += " blob: " csp += "; img-src 'self'" if request.path.startswith("/author/") and config.config_use_goodreads: csp += " images.gr-assets.com i.gr-assets.com s.gr-assets.com" csp += " data:" if request.endpoint == "edit-book.show_edit_book" or config.config_use_google_drive: - csp += " *;" - elif request.endpoint == "web.read_book": - csp += " blob:; style-src-elem 'self' blob: 'unsafe-inline';" - else: - csp += ";" - csp += " object-src 'none';" + csp += " *" + if request.endpoint == "web.read_book": + csp += " blob: ; style-src-elem 'self' blob: 'unsafe-inline'" + csp += "; object-src 'none';" resp.headers['Content-Security-Policy'] = csp resp.headers['X-Content-Type-Options'] = 'nosniff' resp.headers['X-Frame-Options'] = 'SAMEORIGIN' diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 288c74437..1bdb33967 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
Start Time: 2024-07-18 20:53:44
+Start Time: 2024-07-24 19:37:58
Stop Time: 2024-07-19 03:48:09
+Stop Time: 2024-07-25 02:52:34
Duration: 5h 43 min
+Duration: 6h 1 min
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_author_smb.py", line 54, in test_change_capital_one_author_one_book + self.assertFalse(self.check_element_on_page((By.ID, "flash_danger"))) +AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="722dc9e9-1dd4-4399-884c-8afd15ef0c7c", element="c75509e1-3376-480e-b1e3-98eb64586269")> is not false+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_author_smb.py", line 100, in test_change_capital_one_author_two_books + self.assertFalse(self.check_element_on_page((By.ID, "flash_danger"))) +AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="722dc9e9-1dd4-4399-884c-8afd15ef0c7c", element="4f815b35-fa1c-4f4b-a39b-bbd7a45ed274")> is not false+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_author_smb.py", line 157, in test_change_capital_one_author_two_books_coauthor + self.assertFalse(self.check_element_on_page((By.ID, "flash_danger"))) +AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="722dc9e9-1dd4-4399-884c-8afd15ef0c7c", element="aa0f6a64-71c0-4b98-bab5-f59c836fd498")> is not false+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_author_smb.py", line 283, in test_change_capital_rename_co_author + self.assertFalse(self.check_element_on_page((By.ID, "flash_danger"))) +AssertionError: <selenium.webdriver.remote.webelement.WebElement (session="722dc9e9-1dd4-4399-884c-8afd15ef0c7c", element="16c73e9d-b822-45cd-8107-3509d31cc0ae")> is not false+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_author_smb.py", line 431, in test_rename_capital_on_upload + self.check_element_on_page((By.ID, 'edit_cancel')).click() +AttributeError: 'bool' object has no attribute 'click'+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_author_smb.py", line 523, in test_rename_tag_emphasis_mark_onupload + self.fill_basic_config({'config_uploading': 1}) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 392, in fill_basic_config + cls._fill_basic_config(elements) + File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 304, in _fill_basic_config + WebDriverWait(cls.driver, 5).until(EC.presence_of_element_located((By.ID, "config_port"))) + File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/support/wait.py", line 95, in until + raise TimeoutException(message, screen, stacktrace) +selenium.common.exceptions.TimeoutException: Message: +Stacktrace: +RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8 +WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:193:5 +NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:511:5 +dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:136:16+
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_metadata.py", line 90, in test_load_metadata - elif len(results)>19 and 'https://amazon.com/' == results[20]['source']: -IndexError: list index out of range+ File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_metadata.py", line 125, in test_load_metadata + self.assertEqual(20, len(results)) +AssertionError: 20 != 10