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 @@

Calibre-Web Tests

-

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

@@ -1791,6 +1791,233 @@

Calibre-Web Tests

+ + TestEditAuthorsSmb + 9 + 3 + 4 + 2 + 0 + + Detail + + + + + + + +
TestEditAuthorsSmb - test_change_capital_co_author
+ + PASS + + + + + + +
TestEditAuthorsSmb - test_change_capital_one_author_one_book
+ + +
+ FAIL +
+ + + + + + + + + + +
TestEditAuthorsSmb - test_change_capital_one_author_two_books
+ + +
+ FAIL +
+ + + + + + + + + + +
TestEditAuthorsSmb - test_change_capital_one_author_two_books_coauthor
+ + +
+ FAIL +
+ + + + + + + + + + +
TestEditAuthorsSmb - test_change_capital_rename_co_author
+ + +
+ FAIL +
+ + + + + + + + + + +
TestEditAuthorsSmb - test_change_capital_rename_two_co_authors
+ + PASS + + + + + + +
TestEditAuthorsSmb - test_rename_author_emphasis_mark_onupload
+ + PASS + + + + + + +
TestEditAuthorsSmb - test_rename_capital_on_upload
+ + +
+ ERROR +
+ + + + + + + + + + +
TestEditAuthorsSmb - test_rename_tag_emphasis_mark_onupload
+ + +
+ ERROR +
+ + + + + + + + + TestEditBooksList 19 @@ -1799,13 +2026,13 @@

Calibre-Web Tests

0 0 - Detail + Detail - +
TestEditBooksList - test_booklist_xss
@@ -1814,7 +2041,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_author
@@ -1823,7 +2050,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_categories
@@ -1832,7 +2059,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_comment
@@ -1841,7 +2068,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_cust_category
@@ -1850,7 +2077,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_cust_comment
@@ -1859,7 +2086,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_cust_enum
@@ -1868,7 +2095,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_cust_float
@@ -1877,7 +2104,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_cust_int
@@ -1886,7 +2113,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_cust_ratings
@@ -1895,7 +2122,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_cust_text
@@ -1904,7 +2131,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_languages
@@ -1913,7 +2140,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_publisher
@@ -1922,7 +2149,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_series
@@ -1931,7 +2158,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_seriesindex
@@ -1940,7 +2167,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_bookslist_edit_title
@@ -1949,7 +2176,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_list_visibility
@@ -1958,7 +2185,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_restricted_rights
@@ -1967,7 +2194,7 @@

Calibre-Web Tests

- +
TestEditBooksList - test_search_books_list
@@ -1977,40 +2204,40 @@

Calibre-Web Tests

- + TestLoadMetadata 1 0 - 0 1 0 + 0 - Detail + Detail - +
TestLoadMetadata - test_load_metadata
- ERROR + FAIL
-