diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 666becdb..5a28406a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -6,12 +6,23 @@ labels: '' assignees: '' --- - -**Describe the bug/problem** +## Short Notice from the maintainer + +After 6 years of more or less intensive programming on Calibre-Web, I need a break. +The last few months, maintaining Calibre-Web has felt more like work than a hobby. I felt pressured and teased by people to solve "their" problems and merge PRs for "their" Calibre-Web. +I have turned off all notifications from Github/Discord and will now concentrate undisturbed on the development of “my” Calibre-Web over the next few weeks/months. +I will look into the issues and maybe also the PRs from time to time, but don't expect a quick response from me. + + +Please also have a look at our [Contributing Guidelines](https://github.com/janeczku/calibre-web/blob/master/CONTRIBUTING.md) + +**Describe the bug/problem** + A clear and concise description of what the bug is. If you are asking for support, please check our [Wiki](https://github.com/janeczku/calibre-web/wiki) if your question is already answered there. **To Reproduce** + Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' @@ -19,15 +30,19 @@ Steps to reproduce the behavior: 4. See error **Logfile** + Add content of calibre-web.log file or the relevant error, try to reproduce your problem with "debug" log-level to get more output. **Expected behavior** + A clear and concise description of what you expected to happen. **Screenshots** + If applicable, add screenshots to help explain your problem. **Environment (please complete the following information):** + - OS: [e.g. Windows 10/Raspberry Pi OS] - Python version: [e.g. python2.7] - Calibre-Web version: [e.g. 0.6.8 or 087c4c59 (git rev-parse --short HEAD)]: @@ -37,3 +52,4 @@ If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. [e.g. access via reverse proxy, database background sync, special database location] + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 6b2b9afc..dec77d51 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,7 +7,14 @@ assignees: '' --- - +# Short Notice from the maintainer + +After 6 years of more or less intensive programming on Calibre-Web, I need a break. +The last few months, maintaining Calibre-Web has felt more like work than a hobby. I felt pressured and teased by people to solve "their" problems and merge PRs for "their" Calibre-Web. +I have turned off all notifications from Github/Discord and will now concentrate undisturbed on the development of “my” Calibre-Web over the next few weeks/months. +I will look into the issues and maybe also the PRs from time to time, but don't expect a quick response from me. + +Please have a look at our [Contributing Guidelines](https://github.com/janeczku/calibre-web/blob/master/CONTRIBUTING.md) **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] diff --git a/README.md b/README.md index db8efe31..52fa6a0c 100755 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ +# Short Notice from the maintainer + +After 6 years of more or less intensive programming on Calibre-Web, I need a break. +The last few months, maintaining Calibre-Web has felt more like work than a hobby. I felt pressured and teased by people to solve "their" problems and merge PRs for "their" Calibre-Web. +I have turned off all notifications from Github/Discord and will now concentrate undisturbed on the development of “my” Calibre-Web over the next few weeks/months. +I will look into the issues and maybe also the PRs from time to time, but don't expect a quick response from me. + # Calibre-Web Calibre-Web is a web app that offers a clean and intuitive interface for browsing, reading, and downloading eBooks using a valid [Calibre](https://calibre-ebook.com) database. diff --git a/cps/embed_helper.py b/cps/embed_helper.py index f5c3a084..71de216d 100644 --- a/cps/embed_helper.py +++ b/cps/embed_helper.py @@ -25,16 +25,23 @@ from .constants import SUPPORTED_CALIBRE_BINARIES log = logger.create() + def do_calibre_export(book_id, book_format): try: quotes = [3, 5, 7, 9] tmp_dir = get_temp_dir() calibredb_binarypath = get_calibre_binarypath("calibredb") temp_file_name = str(uuid4()) - opf_command = [calibredb_binarypath, 'export', '--dont-write-opf', '--with-library', config.config_calibre_dir, + my_env = os.environ.copy() + if config.config_calibre_split: + my_env['CALIBRE_OVERRIDE_DATABASE_PATH'] = os.path.join(config.config_calibre_dir, "metadata.db") + library_path = config.config_calibre_split_dir + else: + library_path = config.config_calibre_dir + opf_command = [calibredb_binarypath, 'export', '--dont-write-opf', '--with-library', library_path, '--to-dir', tmp_dir, '--formats', book_format, "--template", "{}".format(temp_file_name), str(book_id)] - p = process_open(opf_command, quotes) + p = process_open(opf_command, quotes, my_env) _, err = p.communicate() if err: log.error('Metadata embedder encountered an error: %s', err) @@ -44,6 +51,7 @@ def do_calibre_export(book_id, book_format): log.error_or_exception(ex) return None, None + def get_calibre_binarypath(binary): binariesdir = config.config_binariesdir if binariesdir: diff --git a/cps/jinjia.py b/cps/jinjia.py index e42c650c..584e7d6b 100644 --- a/cps/jinjia.py +++ b/cps/jinjia.py @@ -124,7 +124,7 @@ def formatseriesindex_filter(series_index): return int(series_index) else: return series_index - except ValueError: + except (ValueError, TypeError): return series_index return 0 diff --git a/cps/redirect.py b/cps/redirect.py old mode 100644 new mode 100755 index 09b3101f..337bb77b --- a/cps/redirect.py +++ b/cps/redirect.py @@ -29,7 +29,7 @@ from urllib.parse import urlparse, urljoin -from flask import request, url_for, redirect +from flask import request, url_for, redirect, current_app def is_safe_url(target): @@ -38,16 +38,15 @@ def is_safe_url(target): return test_url.scheme in ('http', 'https') and ref_url.netloc == test_url.netloc -def get_redirect_target(): - for target in request.values.get('next'), request.referrer: - if not target: - continue - if is_safe_url(target): - return target +def remove_prefix(text, prefix): + if text.startswith(prefix): + return text[len(prefix):] + return "" def redirect_back(endpoint, **values): - target = request.form['next'] - if not target or not is_safe_url(target): + target = request.form.get('next', None) or url_for(endpoint, **values) + adapter = current_app.url_map.bind(urlparse(request.host_url).netloc) + if not len(adapter.allowed_methods(remove_prefix(target, request.environ.get('HTTP_X_SCRIPT_NAME',"")))): target = url_for(endpoint, **values) return redirect(target) diff --git a/cps/server.py b/cps/server.py index 30dad710..c0f83403 100644 --- a/cps/server.py +++ b/cps/server.py @@ -24,7 +24,7 @@ import socket import asyncio try: - from gevent_.pywsgi import WSGIServer + from gevent.pywsgi import WSGIServer from .gevent_wsgi import MyWSGIHandler from gevent.pool import Pool from gevent.socket import socket as GeventSocket diff --git a/cps/static/favicon.ico b/cps/static/favicon.ico index 0774d0f9..c7a6c8fa 100644 Binary files a/cps/static/favicon.ico and b/cps/static/favicon.ico differ diff --git a/cps/static/icon.png b/cps/static/icon.png new file mode 100644 index 00000000..15c7288a Binary files /dev/null and b/cps/static/icon.png differ diff --git a/cps/static/icon.svg b/cps/static/icon.svg new file mode 100644 index 00000000..44bd99fa --- /dev/null +++ b/cps/static/icon.svg @@ -0,0 +1,5 @@ + + + diff --git a/cps/tasks/convert.py b/cps/tasks/convert.py index f32c4581..7ea30396 100644 --- a/cps/tasks/convert.py +++ b/cps/tasks/convert.py @@ -252,9 +252,16 @@ class TaskConvert(CalibreTask): quotes = [3, 5] tmp_dir = get_temp_dir() calibredb_binarypath = os.path.join(config.config_binariesdir, SUPPORTED_CALIBRE_BINARIES["calibredb"]) + my_env = os.environ.copy() + if config.config_calibre_split: + my_env['CALIBRE_OVERRIDE_DATABASE_PATH'] = os.path.join(config.config_calibre_dir, "metadata.db") + library_path = config.config_calibre_split_dir + else: + library_path = config.config_calibre_dir + opf_command = [calibredb_binarypath, 'show_metadata', '--as-opf', str(self.book_id), - '--with-library', config.config_calibre_dir] - p = process_open(opf_command, quotes) + '--with-library', library_path] + p = process_open(opf_command, quotes, my_env) p.wait() path_tmp_opf = os.path.join(tmp_dir, "metadata_" + str(uuid4()) + ".opf") with open(path_tmp_opf, 'w') as fd: diff --git a/cps/templates/config_db.html b/cps/templates/config_db.html index e79bb630..5b6ac7ff 100644 --- a/cps/templates/config_db.html +++ b/cps/templates/config_db.html @@ -18,7 +18,7 @@
Start Time: 2024-01-17 20:30:42
+Start Time: 2024-02-12 21:01:14
Stop Time: 2024-01-18 03:25:01
+Stop Time: 2024-02-13 03:55:47
Duration: 5h 47 min
+Duration: 5h 44 min
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_backup_metadata.py", line 132, in test_backup_change_book_series_index - self.assertEqual(metadata['series']['content'], "tEst") -AssertionError: 'test' != 'tEst' -- test -? ^ -+ tEst -? ^-
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_backup_metadata.py", line 347, in test_backup_change_custom_bool + self.assertEqual(custom["#value#"], False) +AssertionError: True != False+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_backup_metadata.py", line 561, in test_backup_change_custom_categories + self.assertEqual(custom["#value#"], None) +AssertionError: ['Kulo', 'Smudo'] != None+
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn - conn = connection.create_connection( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connection - raise err - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection - sock.connect(sa) -ConnectionRefusedError: [Errno 111] Connection refused - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen - httplib_response = self._make_request( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 398, in _make_request - conn.request(method, url, **httplib_request_kw) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connection.py", line 239, in request - super(HTTPConnection, self).request(method, url, body=body, headers=headers) - File "/usr/lib/python3.10/http/client.py", line 1283, in request - self._send_request(method, url, body, headers, encode_chunked) - File "/usr/lib/python3.10/http/client.py", line 1329, in _send_request - self.endheaders(body, encode_chunked=encode_chunked) - File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders - self._send_output(message_body, encode_chunked=encode_chunked) - File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output - self.send(msg) - File "/usr/lib/python3.10/http/client.py", line 976, in send - self.connect() - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connection.py", line 205, in connect - conn = self._new_conn() - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn - raise NewConnectionError( -urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fbaf3c23910>: Failed to establish a new connection: [Errno 111] Connection refused - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_backup_metadata_gdrive.py", line 105, in test_backup_gdrive - self.queue_metadata_backup() - File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 1630, in queue_metadata_backup - self.check_element_on_page((By.ID, "metadata_backup")).click() - File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 751, in check_element_on_page - el = WebDriverWait(cls.driver, timeout).until(EC.presence_of_element_located(element)) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/support/wait.py", line 86, in until - value = method(self._driver) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/support/expected_conditions.py", line 69, in _predicate - return driver.find_element(*locator) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 830, in find_element - return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 438, in execute - response = self.command_executor.execute(driver_command, params) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 290, in execute - return self._request(command_info[0], url, body=data) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 311, in _request - response = self._conn.request(method, url, body=body, headers=headers) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/request.py", line 78, in request - return self.request_encode_body( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/request.py", line 170, in request_encode_body - return self.urlopen(method, url, **extra_kw) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/poolmanager.py", line 376, in urlopen - response = conn.urlopen(method, u.request_uri, **kw) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 815, in urlopen - return self.urlopen( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 815, in urlopen - return self.urlopen( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 815, in urlopen - return self.urlopen( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen - retries = retries.increment( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment - raise MaxRetryError(_pool, url, error or ResponseError(cause)) -urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=36553): Max retries exceeded with url: /session/21a363dd-f6ec-48cc-95a7-772f18f01f8d/element (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbaf3c23910>: Failed to establish a new connection: [Errno 111] Connection refused'))-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn - conn = connection.create_connection( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connection - raise err - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection - sock.connect(sa) -ConnectionRefusedError: [Errno 111] Connection refused - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen - httplib_response = self._make_request( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 398, in _make_request - conn.request(method, url, **httplib_request_kw) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connection.py", line 239, in request - super(HTTPConnection, self).request(method, url, body=body, headers=headers) - File "/usr/lib/python3.10/http/client.py", line 1283, in request - self._send_request(method, url, body, headers, encode_chunked) - File "/usr/lib/python3.10/http/client.py", line 1329, in _send_request - self.endheaders(body, encode_chunked=encode_chunked) - File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders - self._send_output(message_body, encode_chunked=encode_chunked) - File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output - self.send(msg) - File "/usr/lib/python3.10/http/client.py", line 976, in send - self.connect() - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connection.py", line 205, in connect - conn = self._new_conn() - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn - raise NewConnectionError( -urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fbaf3c22e90>: Failed to establish a new connection: [Errno 111] Connection refused - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_backup_metadata_gdrive.py", line 78, in tearDownClass - cls.driver.get("http://127.0.0.1:"+ PORTS[0]) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 449, in get - self.execute(Command.GET, {"url": url}) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 438, in execute - response = self.command_executor.execute(driver_command, params) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 290, in execute - return self._request(command_info[0], url, body=data) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 311, in _request - response = self._conn.request(method, url, body=body, headers=headers) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/request.py", line 78, in request - return self.request_encode_body( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/request.py", line 170, in request_encode_body - return self.urlopen(method, url, **extra_kw) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/poolmanager.py", line 376, in urlopen - response = conn.urlopen(method, u.request_uri, **kw) - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 815, in urlopen - return self.urlopen( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 815, in urlopen - return self.urlopen( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 815, in urlopen - return self.urlopen( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen - retries = retries.increment( - File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment - raise MaxRetryError(_pool, url, error or ResponseError(cause)) -urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=36553): Max retries exceeded with url: /session/21a363dd-f6ec-48cc-95a7-772f18f01f8d/url (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbaf3c22e90>: Failed to establish a new connection: [Errno 111] Connection refused'))-