From 75fb7c2e95d087f5709b05748395f66c882e7324 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sat, 9 May 2020 16:54:22 +0200 Subject: [PATCH] Allowing upload extensions (#1119) --- cps/admin.py | 7 ++++--- cps/config_sql.py | 2 +- cps/web.py | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cps/admin.py b/cps/admin.py index a546e518..fa530544 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -542,7 +542,7 @@ def _configuration_oauth_helper(to_save): "oauth_client_secret": to_save["config_" + str(element['id']) + "_oauth_client_secret"], "active": element["active"]}) -def _configuration_logfile_helper(gdriveError, to_save): +def _configuration_logfile_helper(to_save, gdriveError): reboot_required = False reboot_required |= _config_int(to_save, "config_log_level") reboot_required |= _config_string(to_save, "config_logfile") @@ -615,13 +615,11 @@ def _configuration_update_helper(): db_change = False to_save = request.form.to_dict() - db_change |= _config_string(to_save, "config_calibre_dir") # Google drive setup gdriveError = _configuration_gdrive_helper(to_save) - reboot_required |= _config_int(to_save, "config_port") reboot_required |= _config_string(to_save, "config_keyfile") @@ -638,6 +636,9 @@ def _configuration_update_helper(): reboot_required |= _config_checkbox_int(to_save, "config_kobo_sync") _config_checkbox_int(to_save, "config_kobo_proxy") + _config_string(to_save, "config_upload_formats") + constants.EXTENSIONS_UPLOAD = [x.lstrip().rstrip() for x in config.config_upload_formats.split(',')] + _config_string(to_save, "config_calibre") _config_string(to_save, "config_converterpath") _config_string(to_save, "config_kepubifypath") diff --git a/cps/config_sql.py b/cps/config_sql.py index 2b813530..a31f8243 100644 --- a/cps/config_sql.py +++ b/cps/config_sql.py @@ -291,7 +291,7 @@ class _ConfigSQL(object): db_file = os.path.join(self.config_calibre_dir, 'metadata.db') have_metadata_db = os.path.isfile(db_file) self.db_configured = have_metadata_db - + constants.EXTENSIONS_UPLOAD = [x.lstrip().rstrip() for x in self.config_upload_formats.split(',')] logger.setup(self.config_logfile, self.config_log_level) def save(self): diff --git a/cps/web.py b/cps/web.py index beb34887..da4d9e20 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1241,6 +1241,8 @@ def serve_book(book_id, book_format, anyname): def download_link(book_id, book_format, anyname): if "Kobo" in request.headers.get('User-Agent'): client = "kobo" + else: + client="" return get_download_link(book_id, book_format, client)