From d30b44ee0f61f1fdb9bca606d3e29ff4dab3d8d6 Mon Sep 17 00:00:00 2001 From: Michael Shavit Date: Sun, 26 Jan 2020 01:12:52 -0500 Subject: [PATCH 01/13] Minor formatting changes per codacy review. --- cps/kobo.py | 1 - cps/kobo_auth.py | 4 +++- cps/services/SyncToken.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cps/kobo.py b/cps/kobo.py index 7e1cbc8e..f745a98a 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -31,7 +31,6 @@ from flask import ( request, make_response, jsonify, - json, url_for, redirect, ) diff --git a/cps/kobo_auth.py b/cps/kobo_auth.py index 60f3ea5f..48eee3cf 100644 --- a/cps/kobo_auth.py +++ b/cps/kobo_auth.py @@ -26,7 +26,9 @@ When first booting a Kobo device the user must sign into a Kobo (or affiliate) a Upon successful sign-in, the user is redirected to https://auth.kobobooks.com/CrossDomainSignIn?id= which serves the following response: - . + And triggers the insertion of a userKey into the device's User table. Together, the device's DeviceId and UserKey act as an *irrevocable* authentication diff --git a/cps/services/SyncToken.py b/cps/services/SyncToken.py index 21f16acc..903fff9a 100644 --- a/cps/services/SyncToken.py +++ b/cps/services/SyncToken.py @@ -84,7 +84,7 @@ class SyncToken(): @staticmethod def from_headers(headers): sync_token_header = headers.get(SyncToken.SYNC_TOKEN_HEADER, "") - if sync_token_header == "": + if not sync_token_header: return SyncToken() # On the first sync from a Kobo device, we may receive the SyncToken @@ -103,7 +103,7 @@ class SyncToken(): data_json = sync_token_json["data"] validate(sync_token_json, SyncToken.data_schema_v1) - except (exceptions.ValidationError, ValueError) as e: + except (exceptions.ValidationError, ValueError): log.error("Sync token contents do not follow the expected json schema.") return SyncToken() From 94a38a3b47e00511879984555d2638e0153797d8 Mon Sep 17 00:00:00 2001 From: ElQuimm <50202052+ElQuimm@users.noreply.github.com> Date: Mon, 17 Feb 2020 21:03:33 +0100 Subject: [PATCH 02/13] udate message.po in italian Hello, updated one more time the translation :-) I think the string "Author list" is missing. Thank you! Quimm --- cps/translations/it/LC_MESSAGES/messages.po | 76 ++++++++++----------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/cps/translations/it/LC_MESSAGES/messages.po b/cps/translations/it/LC_MESSAGES/messages.po index 54d5f40f..341aa012 100644 --- a/cps/translations/it/LC_MESSAGES/messages.po +++ b/cps/translations/it/LC_MESSAGES/messages.po @@ -35,7 +35,7 @@ msgstr "Server riavviato, per favore ricarica la pagina" #: cps/admin.py:90 msgid "Performing shutdown of server, please close window" -msgstr "Eseguo l'arresto del server, per favore chiudi la finestra." +msgstr "Eseguo l'arresto del server, per favore chiudi la finestra" #: cps/admin.py:109 cps/editbooks.py:410 cps/editbooks.py:419 #: cps/editbooks.py:539 cps/editbooks.py:541 cps/editbooks.py:594 @@ -110,7 +110,7 @@ msgstr "Utente '%(nick)s' eliminato" #: cps/admin.py:573 msgid "No admin user remaining, can't delete user" -msgstr "Non rimarrebbe nessun utente amministratore, non posso eliminare l'utente." +msgstr "Non rimarrebbe nessun utente amministratore, non posso eliminare l'utente" #: cps/admin.py:611 cps/web.py:1355 msgid "Found an existing account for this e-mail address." @@ -145,7 +145,7 @@ msgstr "Si è verificato un errore sconosciuto: per favore riprova." #: cps/admin.py:662 cps/web.py:1058 msgid "Please configure the SMTP mail settings first..." -msgstr "Configurare dapprima le impostazioni del server SMTP..." +msgstr "Configura dapprima le impostazioni del server SMTP..." #: cps/admin.py:674 msgid "Logfile viewer" @@ -209,7 +209,7 @@ msgstr "Errore durante l'apertura del libro. Il file non esiste o il file non è #: cps/editbooks.py:242 msgid "edit metadata" -msgstr "modifica i metadati" +msgstr "Modifica i metadati" #: cps/editbooks.py:321 cps/editbooks.py:569 #, python-format @@ -263,7 +263,7 @@ msgstr "Il file %(filename)s non può essere salvato nella cartella temporanea" #: cps/editbooks.py:598 msgid "Uploaded book probably exists in the library, consider to change before upload new: " -msgstr "Probabilmnete il libro caricato esiste già nella libreria; considera di cambiare prima di caricare nuovamente: " +msgstr "Probabilmnete il libro caricato esiste già nella libreria; considera di cambiare prima di sottoporlo nuovamente: " #: cps/editbooks.py:613 #, python-format @@ -273,7 +273,7 @@ msgstr "Impossibile salvare il file %(file)s (autorizzazione negata)." #: cps/editbooks.py:619 #, python-format msgid "Failed to delete file %(file)s (Permission denied)." -msgstr "Impossibile eliminare il file %(file)s (autorizzazione negata)" +msgstr "Impossibile eliminare il file %(file)s (autorizzazione negata)." #: cps/editbooks.py:710 #, python-format @@ -541,7 +541,7 @@ msgstr "C'era un errore" #: cps/shelf.py:216 cps/shelf.py:218 msgid "create a shelf" -msgstr "crea uno scaffale" +msgstr "Crea uno scaffale" #: cps/shelf.py:241 #, python-format @@ -568,11 +568,11 @@ msgstr "Modifica l'ordine dello scaffale: '%(name)s'" #: cps/ub.py:56 msgid "Recently Added" -msgstr "Aggiunto recentemente" +msgstr "Aggiunti recentemente" #: cps/ub.py:58 msgid "Show recent books" -msgstr "Mostra i libri più recenti" +msgstr "Mostra l'opzione per la selezione dei libri più recenti" #: cps/templates/index.xml:17 cps/ub.py:59 msgid "Hot Books" @@ -580,15 +580,15 @@ msgstr "Libri popolari" #: cps/ub.py:60 msgid "Show hot books" -msgstr "Mostra i libri più popolari" +msgstr "Mostra l'opzione per la selezione dei libri più popolari" #: cps/templates/index.xml:24 cps/ub.py:63 msgid "Best rated Books" -msgstr "Libri più votati" +msgstr "Libri meglio valutati" #: cps/ub.py:65 msgid "Show best rated books" -msgstr "Mostra i libri più votati" +msgstr "Mostra l'opzione per la selezione dei libri meglio votati" #: cps/templates/index.xml:46 cps/templates/index.xml:50 cps/ub.py:66 #: cps/web.py:1008 @@ -597,7 +597,7 @@ msgstr "Libri da leggere" #: cps/ub.py:68 msgid "Show read and unread" -msgstr "Mostra letto e non letto" +msgstr "Mostra l'opzione per la selezione letto e non letto" #: cps/templates/index.xml:53 cps/templates/index.xml:57 cps/ub.py:70 #: cps/web.py:1012 @@ -606,7 +606,7 @@ msgstr "Libri non letti" #: cps/ub.py:72 msgid "Show unread" -msgstr "Mostra non letti" +msgstr "Mostra l'opzione per la selezione dei libri non letti" #: cps/ub.py:73 msgid "Discover" @@ -614,7 +614,7 @@ msgstr "Per scoprire" #: cps/ub.py:75 msgid "Show random books" -msgstr "Mostra libri a caso" +msgstr "Mostra l'opzione per presentare libri aleatoriamente" #: cps/templates/index.xml:75 cps/ub.py:76 msgid "Categories" @@ -622,7 +622,7 @@ msgstr "Categorie" #: cps/ub.py:78 msgid "Show category selection" -msgstr "Mostra la selezione delle categorie" +msgstr "Mostra l'opzione per la selezione delle categorie" #: cps/templates/book_edit.html:71 cps/templates/index.xml:82 #: cps/templates/search_form.html:53 cps/ub.py:79 @@ -631,7 +631,7 @@ msgstr "Serie" #: cps/ub.py:81 msgid "Show series selection" -msgstr "Mostra la selezione delle serie" +msgstr "Mostra l'opzione per la selezione delle serie" #: cps/templates/index.xml:61 cps/ub.py:82 msgid "Authors" @@ -639,7 +639,7 @@ msgstr "Autori" #: cps/ub.py:84 msgid "Show author selection" -msgstr "Mostra la selezione dell'autore" +msgstr "Mostra l'opzione per la selezione degli autori" #: cps/templates/index.xml:68 cps/ub.py:86 msgid "Publishers" @@ -647,27 +647,27 @@ msgstr "Editori" #: cps/ub.py:88 msgid "Show publisher selection" -msgstr "Mostra la selezione dell'editore" +msgstr "Mostra l'opzione per la selezione degli editori" #: cps/templates/index.xml:89 cps/templates/search_form.html:74 cps/ub.py:89 msgid "Languages" -msgstr "Lingua" +msgstr "Lingue" #: cps/ub.py:92 msgid "Show language selection" -msgstr "Mostra la selezione della lingua" +msgstr "Mostra l'opzione per la selezione delle lingue" #: cps/ub.py:93 msgid "Ratings" -msgstr "Valutazione" +msgstr "Valutazioni" #: cps/ub.py:95 msgid "Show ratings selection" -msgstr "Mostra la selezione della valutazione" +msgstr "Mostra l'opzione per la selezione della valutazione" #: cps/templates/index.xml:96 cps/ub.py:96 msgid "File formats" -msgstr "Formato file" +msgstr "Formati file" #: cps/ub.py:98 msgid "Show file formats selection" @@ -679,7 +679,7 @@ msgstr "Dati inattesi durante il processo di aggiornamento" #: cps/updater.py:258 cps/updater.py:364 msgid "No update available. You already have the latest version installed" -msgstr "Nessun aggiornamento disponibile. Hai già installato l'ultima versione disponibile" +msgstr "Nessun aggiornamento disponibile. L'ultima versione è già installata" #: cps/updater.py:284 msgid "A new update is available. Click on the button below to update to the latest version." @@ -712,7 +712,7 @@ msgstr "Libri con le migliori valutazioni" #: cps/templates/index.xml:38 cps/web.py:521 msgid "Random Books" -msgstr "Libri casuali" +msgstr "Libri presentati aleatoriamente" #: cps/web.py:547 msgid "Books" @@ -1045,7 +1045,7 @@ msgstr "Amministrazione" #: cps/templates/admin.html:122 msgid "View Logfiles" -msgstr "Visualizza LogFile" +msgstr "Visualizza Logfile" #: cps/templates/admin.html:123 msgid "Reconnect to Calibre DB" @@ -1183,7 +1183,7 @@ msgstr "Descrizione" #: cps/templates/book_edit.html:67 cps/templates/search_form.html:33 msgid "Tags" -msgstr "Tags" +msgstr "Categorie" #: cps/templates/book_edit.html:75 msgid "Series id" @@ -1585,7 +1585,7 @@ msgstr "Espressione regolare per ordinare la visualizzazione del titolo" #: cps/templates/config_view_edit.html:59 msgid "Tags for Mature Content" -msgstr "Tags dei libri per adulti" +msgstr "Categorie che definiscono i libri per adulti" #: cps/templates/config_view_edit.html:73 msgid "Default settings for new users" @@ -1605,7 +1605,7 @@ msgstr "Permetti l'utilizzo del visualizzatore di libri" #: cps/templates/config_view_edit.html:93 cps/templates/user_edit.html:101 msgid "Allow Uploads" -msgstr "Permetti i caricamenti" +msgstr "Permetti l'upload" #: cps/templates/config_view_edit.html:97 cps/templates/user_edit.html:105 msgid "Allow Edit" @@ -1629,7 +1629,7 @@ msgstr "Visibilità di base per i nuovi utenti" #: cps/templates/config_view_edit.html:135 cps/templates/user_edit.html:76 msgid "Show random books in detail view" -msgstr "Mostra libri scelti alleatoriamente nella vista dettagliata" +msgstr "Mostra libri scelti aleatoriamente nella vista dettagliata" #: cps/templates/config_view_edit.html:139 cps/templates/user_edit.html:89 msgid "Show mature content" @@ -1681,7 +1681,7 @@ msgstr "Modifica metadati" #: cps/templates/email_edit.html:15 msgid "SMTP port (usually 25 for plain SMTP and 465 for SSL and 587 for STARTTLS)" -msgstr "Porta SMTP (normalmente 25 senza condifica, 465 per codifica SSL e 587 per STARTTLS)" +msgstr "Porta SMTP (normalmente 25 senza codifica, 465 per codifica SSL e 587 per STARTTLS)" #: cps/templates/email_edit.html:19 msgid "Encryption" @@ -1854,7 +1854,7 @@ msgstr "Registra" #: cps/templates/layout.html:116 cps/templates/layout.html:223 msgid "Uploading..." -msgstr "Carico..." +msgstr "Uploading..." #: cps/templates/layout.html:117 msgid "please don't refresh the page" @@ -2076,7 +2076,7 @@ msgstr "Prova una ricerca differente" #: cps/templates/search.html:8 msgid "Results for:" -msgstr "Risultati per:" +msgstr "risultati per:" #: cps/templates/search_form.html:19 msgid "Publishing date from" @@ -2088,7 +2088,7 @@ msgstr "Data di pubblicazione fino a" #: cps/templates/search_form.html:43 msgid "Exclude Tags" -msgstr "Escludi i tag" +msgstr "Escludi categorie" #: cps/templates/search_form.html:63 msgid "Exclude Series" @@ -2136,7 +2136,7 @@ msgstr "Lo scaffale sarà perso per tutti e per sempre!" #: cps/templates/shelf_edit.html:13 msgid "should the shelf be public?" -msgstr "questo scaffale deve essere pubblico?" +msgstr "scaffale pubblico" #: cps/templates/shelf_order.html:5 msgid "Drag 'n drop to rearrange order" @@ -2224,7 +2224,7 @@ msgstr "Mostra libri in " #: cps/templates/user_edit.html:43 msgid "Show all" -msgstr "Mostra libri in tutte le lingue presenti" +msgstr "tutte le lingue presenti" #: cps/templates/user_edit.html:53 msgid "OAuth Settings" @@ -3504,7 +3504,7 @@ msgstr "Download recenti" #~ msgstr "La creazione del percorso per la copertina %(path)s è fallita (permesso negato)." #~ msgid "Failed to store cover-file %(cover)s." -#~ msgstr "Fallito il salvataggio della copertina %(cover)s." +#~ msgstr "Errore nel salvare la copertina %(cover)s." #~ msgid "Cover-file is not a valid image file" #~ msgstr "Il file della copertina non è un file d'immagine valido" From 29cb8bfec4262d413c062ad74251f76929bd0a9b Mon Sep 17 00:00:00 2001 From: "Johnny A. dos Santos" Date: Fri, 21 Feb 2020 18:25:02 -0300 Subject: [PATCH 03/13] Fix #1210 --- cps/static/js/get_meta.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cps/static/js/get_meta.js b/cps/static/js/get_meta.js index 77c53f51..14317da4 100644 --- a/cps/static/js/get_meta.js +++ b/cps/static/js/get_meta.js @@ -48,7 +48,8 @@ $(function () { if ($.inArray(el, uniqueTags) === -1) uniqueTags.push(el); }); - $("#bookAuthor").val(book.authors); + var ampSeparatedAuthors = (book.authors || []).join(" & "); + $("#bookAuthor").val(ampSeparatedAuthors); $("#book_title").val(book.title); $("#tags").val(uniqueTags.join(",")); $("#rating").data("rating").setValue(Math.round(book.rating)); From de299e0d6ab314d6f066a1972e73e8720329f835 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 22 Feb 2020 13:25:31 +0100 Subject: [PATCH 04/13] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..907ff841 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,35 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**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] + - Python version [e.g. python2.7] + - Docker container [ None/Technosoft2000/Linuxuser]: + - Calibre-Web version [e.g. 0.6.5 or master@16.02.20, 19:55 ]: + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. From 3d4ebddb042e741fcaa18a162fe94659e04759b7 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 22 Feb 2020 13:27:56 +0100 Subject: [PATCH 05/13] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 907ff841..882782cc 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a report to help us improve +about: Create a report to help us improve Calibre-Web title: '' labels: '' assignees: '' diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..1a71b1ac --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for Calibre-Web +title: '' +labels: '' +assignees: '' + +--- + +**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 [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From 81fc04f24d26a8608c66b4986aaee5a06f4d68dc Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 22 Feb 2020 13:29:36 +0100 Subject: [PATCH 06/13] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 882782cc..d6dd9bf3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,5 +1,5 @@ --- -name: Bug report +name: Bug/Problem report about: Create a report to help us improve Calibre-Web title: '' labels: '' From b95150ff115ec747cde44f10e786edd5b2fea60e Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 22 Feb 2020 13:33:21 +0100 Subject: [PATCH 07/13] Update bug report --- .github/ISSUE_TEMPLATE/bug_report.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d6dd9bf3..c6ab8620 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -24,12 +24,12 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Environment (please complete the following information):** - - OS: [e.g. Windows 10] + - OS: [e.g. Windows 10/raspian] - Python version [e.g. python2.7] - - Docker container [ None/Technosoft2000/Linuxuser]: - Calibre-Web version [e.g. 0.6.5 or master@16.02.20, 19:55 ]: + - Docker container [ None/Technosoft2000/Linuxuser]: + - Special Hardware [e.g. Rasperry Pi Zero] - Browser [e.g. chrome, safari] - - Version [e.g. 22] **Additional context** -Add any other context about the problem here. +Add any other context about the problem here. [e.g. access via reverse proxy] From 264ccdbf6db7abb0533c023c8df857f4e1699c45 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 22 Feb 2020 13:36:31 +0100 Subject: [PATCH 08/13] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c6ab8620..d31e3bcd 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,8 +7,8 @@ assignees: '' --- -**Describe the bug** -A clear and concise description of what the bug is. +**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: From 63460596985bffeffe55856bca7d3fdd32c4b5d8 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Sun, 16 Feb 2020 06:41:51 +0100 Subject: [PATCH 09/13] Changed optional-requirements --- optional-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optional-requirements.txt b/optional-requirements.txt index dd4f9878..ef0b2fca 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -10,7 +10,7 @@ pyasn1>=0.1.9 PyDrive>=1.3.1 PyYAML>=3.12 rsa==3.4.2 -six==1.10.0 +six>=1.10.0 # goodreads goodreads>=0.3.2 From ac431bbc4a1a9e94c28cb3939bccc1ef343d5cab Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Wed, 19 Feb 2020 18:15:40 +0100 Subject: [PATCH 10/13] Limit requirements --- optional-requirements.txt | 38 +++++++++++++++++++------------------- requirements.txt | 26 +++++++++++++------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/optional-requirements.txt b/optional-requirements.txt index ef0b2fca..5aac831b 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -1,34 +1,34 @@ # GDrive Integration -google-api-python-client==1.7.11 -gevent>=1.2.1 -greenlet>=0.4.12 -httplib2>=0.9.2 -oauth2client>=4.0.0 -uritemplate>=3.0.0 -pyasn1-modules>=0.0.8 -pyasn1>=0.1.9 -PyDrive>=1.3.1 +google-api-python-client==1.7.11,<1.8.0 +gevent>=1.2.1,<1.5.0 +greenlet>=0.4.12,<0.5.0 +httplib2>=0.9.2,<0.18.0 +oauth2client>=4.0.0,<4.14.0 +uritemplate>=3.0.0,<3.1.0 +pyasn1-modules>=0.0.8,<0.3.0 +pyasn1>=0.1.9,<0.5.0 +PyDrive>=1.3.1,<1.14.0 PyYAML>=3.12 -rsa==3.4.2 -six>=1.10.0 +rsa==3.4.2,<4.1.0 +six>=1.10.0,<1.14.0 # goodreads -goodreads>=0.3.2 -python-Levenshtein>=0.12.0 +goodreads>=0.3.2,<0.4.0 +python-Levenshtein>=0.12.0,<0.13.0 # ldap login -python_ldap>=3.0.0 -flask-simpleldap>1.3.0 +python_ldap>=3.0.0,<3.3.0 +flask-simpleldap>1.3.0,<1.5.0 #oauth flask-dance>=0.13.0 -sqlalchemy_utils>=0.33.5 +sqlalchemy_utils>=0.33.5,<0.37.0 # extracting metadata -lxml>=3.8.0 -Pillow>=4.0.0 +lxml>=3.8.0,<4.6.0 +Pillow>=4.0.0,<7.1.0 rarfile>=2.7 # other -natsort>=2.2.0 +natsort>=2.2.0,<7.1.0 git+https://github.com/OzzieIsaacs/comicapi.git@ad8bfe5a1c31db882480433f86db2c5c57634a3f#egg=comicapi diff --git a/requirements.txt b/requirements.txt index daf2538d..bec3a1d4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,15 @@ -Babel>=1.3 -Flask-Babel>=0.11.1 -Flask-Login>=0.3.2 -Flask-Principal>=0.3.2 -singledispatch>=3.4.0.0 +Babel>=1.3, <2.9 +Flask-Babel>=0.11.1,<1.1.0 +Flask-Login>=0.3.2,<0.5.1 +Flask-Principal>=0.3.2,<0.5.0 +singledispatch>=3.4.0.0,<3.5.0.0 backports_abc>=0.4 -Flask>=1.0.2 -iso-639>=0.4.5 -PyPDF2==1.26.0 +Flask>=1.0.2,<1.2.0 +iso-639>=0.4.5,<0.5.0 +PyPDF2==1.26.0,<1.27.0 pytz>=2016.10 -requests>=2.11.1 -SQLAlchemy>=1.1.0 -tornado>=4.1 -Wand>=0.4.4 -unidecode>=0.04.19 +requests>=2.11.1,<2.23.0 +SQLAlchemy>=1.1.0,<1.4.0 +tornado>=4.1,<6.1 +Wand>=0.4.4,<0.6.0 +unidecode>=0.04.19,<1.2.0 From 3a70c86f499b071b4a8082513fd7e4912a3196a2 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Fri, 21 Feb 2020 18:04:26 +0100 Subject: [PATCH 11/13] Update updater to handle venv folders --- cps/updater.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cps/updater.py b/cps/updater.py index 824e1314..9fe6e828 100644 --- a/cps/updater.py +++ b/cps/updater.py @@ -193,7 +193,12 @@ class Updater(threading.Thread): exclude = ( os.sep + 'app.db', os.sep + 'calibre-web.log1', os.sep + 'calibre-web.log2', os.sep + 'gdrive.db', os.sep + 'vendor', os.sep + 'calibre-web.log', os.sep + '.git', os.sep + 'client_secrets.json', - os.sep + 'gdrive_credentials', os.sep + 'settings.yaml') + os.sep + 'gdrive_credentials', os.sep + 'settings.yaml', os.sep + 'venv', os.sep + 'virtualenv', + os.sep + 'access.log', os.sep + 'access.log1', os.sep + 'access.log2', + ) + additional_path = self.is_venv() + if additional_path: + exclude = exclude + (additional_path) for root, dirs, files in os.walk(destination, topdown=True): for name in files: old_list.append(os.path.join(root, name).replace(destination, '')) @@ -229,6 +234,12 @@ class Updater(threading.Thread): logger.debug("Could not remove: %s", item_path) shutil.rmtree(source, ignore_errors=True) + def is_venv(self): + if (hasattr(sys, 'real_prefix')) or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix): + return os.sep + os.path.relpath(sys.prefix,constants.BASE_DIR) + else: + return False + @classmethod def _nightly_version_info(cls): if is_sha1(constants.NIGHTLY_VERSION[0]) and len(constants.NIGHTLY_VERSION[1]) > 0: From 7c89f0b5b97678c8b93a484ee7e5acf746240938 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sun, 23 Feb 2020 09:07:02 +0100 Subject: [PATCH 12/13] Merge with branch develop Release version --- .gitignore | 4 +--- cps/cli.py | 2 +- cps/constants.py | 3 +-- cps/db.py | 11 ++++++++--- cps/editbooks.py | 5 ++--- cps/server.py | 6 ++++-- cps/static/js/caliBlur.js | 8 +++++--- cps/templates/book_edit.html | 6 ++---- cps/templates/layout.html | 5 ++--- cps/templates/search_form.html | 2 +- cps/templates/shelf_order.html | 12 ++++++------ cps/templates/user_edit.html | 2 -- cps/ub.py | 2 +- cps/updater.py | 2 +- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.gitignore b/.gitignore index 3fc60194..f06dcd44 100644 --- a/.gitignore +++ b/.gitignore @@ -21,14 +21,12 @@ vendor/ # calibre-web *.db *.log -config.ini -cps/static/[0-9]* .idea/ *.bak *.log.* -tags settings.yaml gdrive_credentials client_secrets.json + diff --git a/cps/cli.py b/cps/cli.py index e76a12cc..8d410a90 100644 --- a/cps/cli.py +++ b/cps/cli.py @@ -43,7 +43,7 @@ parser.add_argument('-k', metavar='path', help='path and name to SSL keyfile, e.g. /opt/test.key, works only in combination with certfile') parser.add_argument('-v', '--version', action='version', help='Shows version number and exits Calibre-web', version=version_info()) -parser.add_argument('-i', metavar='ip-adress', help='Server IP-Adress to listen') +parser.add_argument('-i', metavar='ip-address', help='Server IP-Address to listen') parser.add_argument('-s', metavar='user:pass', help='Sets specific username to new password') args = parser.parse_args() diff --git a/cps/constants.py b/cps/constants.py index 50c34968..3b3b1482 100644 --- a/cps/constants.py +++ b/cps/constants.py @@ -106,7 +106,6 @@ except ValueError: del env_CALIBRE_PORT - EXTENSIONS_AUDIO = {'mp3', 'm4a', 'm4b'} EXTENSIONS_CONVERT = {'pdf', 'epub', 'mobi', 'azw3', 'docx', 'rtf', 'fb2', 'lit', 'lrf', 'txt', 'htmlz', 'rtf', 'odt'} EXTENSIONS_UPLOAD = {'txt', 'pdf', 'epub', 'mobi', 'azw', 'azw3', 'cbr', 'cbz', 'cbt', 'djvu', 'prc', 'doc', 'docx', @@ -126,7 +125,7 @@ def selected_roles(dictionary): BookMeta = namedtuple('BookMeta', 'file_path, extension, title, author, cover, description, tags, series, ' 'series_id, languages') -STABLE_VERSION = {'version': '0.6.6 Beta'} +STABLE_VERSION = {'version': '0.6.6'} NIGHTLY_VERSION = {} NIGHTLY_VERSION[0] = '$Format:%H$' diff --git a/cps/db.py b/cps/db.py index 1ef06427..67697468 100755 --- a/cps/db.py +++ b/cps/db.py @@ -25,13 +25,13 @@ import ast from sqlalchemy import create_engine from sqlalchemy import Table, Column, ForeignKey -from sqlalchemy import String, Integer, Boolean +from sqlalchemy import String, Integer, Boolean, Float from sqlalchemy.orm import relationship, sessionmaker, scoped_session from sqlalchemy.ext.declarative import declarative_base session = None -cc_exceptions = ['datetime', 'comments', 'float', 'composite', 'series'] +cc_exceptions = ['datetime', 'comments', 'composite', 'series'] cc_classes = {} engine = None @@ -378,6 +378,11 @@ def setup_db(config): 'id': Column(Integer, primary_key=True), 'book': Column(Integer, ForeignKey('books.id')), 'value': Column(Integer)} + elif row.datatype == 'float': + ccdict = {'__tablename__': 'custom_column_' + str(row.id), + 'id': Column(Integer, primary_key=True), + 'book': Column(Integer, ForeignKey('books.id')), + 'value': Column(Float)} else: ccdict = {'__tablename__': 'custom_column_' + str(row.id), 'id': Column(Integer, primary_key=True), @@ -385,7 +390,7 @@ def setup_db(config): cc_classes[row.id] = type(str('Custom_Column_' + str(row.id)), (Base,), ccdict) for cc_id in cc_ids: - if (cc_id[1] == 'bool') or (cc_id[1] == 'int'): + if (cc_id[1] == 'bool') or (cc_id[1] == 'int') or (cc_id[1] == 'float'): setattr(Books, 'custom_column_' + str(cc_id[0]), relationship(cc_classes[cc_id[0]], primaryjoin=( Books.id == cc_classes[cc_id[0]].book), diff --git a/cps/editbooks.py b/cps/editbooks.py index 7b78cf97..0bb005fb 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -175,7 +175,7 @@ def delete_book(book_id, book_format): cc_string = "custom_column_" + str(c.id) if not c.is_multiple: if len(getattr(book, cc_string)) > 0: - if c.datatype == 'bool' or c.datatype == 'integer': + if c.datatype == 'bool' or c.datatype == 'integer' or c.datatype == 'float': del_cc = getattr(book, cc_string)[0] getattr(book, cc_string).remove(del_cc) db.session.delete(del_cc) @@ -254,7 +254,7 @@ def edit_cc_data(book_id, book, to_save): else: cc_db_value = None if to_save[cc_string].strip(): - if c.datatype == 'int' or c.datatype == 'bool': + if c.datatype == 'int' or c.datatype == 'bool' or c.datatype == 'float': if to_save[cc_string] == 'None': to_save[cc_string] = None elif c.datatype == 'bool': @@ -697,7 +697,6 @@ def upload(): # Reread book. It's important not to filter the result, as it could have language which hide it from # current users view (tags are not stored/extracted from metadata and could also be limited) book = db.session.query(db.Books).filter(db.Books.id == book_id).first() - # upload book to gdrive if nesseccary and add "(bookid)" to folder name if config.config_use_google_drive: gdriveutils.updateGdriveCalibreFromLocal() diff --git a/cps/server.py b/cps/server.py index 8f060719..74c591ec 100755 --- a/cps/server.py +++ b/cps/server.py @@ -156,7 +156,7 @@ class WebServer(object): max_buffer_size=209700000, ssl_options=self.ssl_args) http_server.listen(self.listen_port, self.listen_address) - self.wsgiserver = IOLoop.instance() + self.wsgiserver = IOLoop.current() self.wsgiserver.start() # wait for stop signal self.wsgiserver.close(True) @@ -177,6 +177,8 @@ class WebServer(object): if not self.restart: log.info("Performing shutdown of Calibre-Web") + # prevent irritiating log of pending tasks message from asyncio + logger.get('asyncio').setLevel(logger.logging.CRITICAL) return True log.info("Performing restart of Calibre-Web") @@ -197,4 +199,4 @@ class WebServer(object): if _GEVENT: self.wsgiserver.close() else: - self.wsgiserver.add_callback(self.wsgiserver.stop) + self.wsgiserver.add_callback_from_signal(self.wsgiserver.stop) diff --git a/cps/static/js/caliBlur.js b/cps/static/js/caliBlur.js index 53f033ba..1bd5f69c 100644 --- a/cps/static/js/caliBlur.js +++ b/cps/static/js/caliBlur.js @@ -159,10 +159,12 @@ if ( $( 'body.book' ).length > 0 ) { real_custom_column = $( '.real_custom_columns' ); // $( '.real_custom_columns' ).remove(); $.each(real_custom_column, function(i, val) { - real_cc = $(this).text().split( ':' ); + var split = $(this).text().split( ':' ); + real_cc_key = split.shift(); + real_cc_value = split.join(':'); $( this ).text(""); - if (real_cc.length > 1) { - $( this ).append( '' + real_cc[0] + '' + real_cc[1] + '' ); + if (real_cc_value != "") { + $( this ).append( '' + real_cc_key + '' + real_cc_value + '' ); } }); //$( '.real_custom_columns:nth-child(3)' ).text(function() { diff --git a/cps/templates/book_edit.html b/cps/templates/book_edit.html index e734698a..78b427eb 100644 --- a/cps/templates/book_edit.html +++ b/cps/templates/book_edit.html @@ -1,8 +1,6 @@ {% extends "layout.html" %} {% block body %} {% if book %} - -
{{ book.title }} @@ -115,8 +113,8 @@ {% endif %} - {% if c.datatype == 'int' %} - + {% if c.datatype == 'int' or c.datatype == 'float' %} + {% endif %} {% if c.datatype in ['text', 'series'] and not c.is_multiple %} diff --git a/cps/templates/layout.html b/cps/templates/layout.html index 9ffb04f8..0e235ed3 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -44,7 +44,7 @@ - +
@@ -52,7 +52,7 @@ {% endblock %} diff --git a/cps/templates/shelf_order.html b/cps/templates/shelf_order.html index 77192c8c..0094fb31 100644 --- a/cps/templates/shelf_order.html +++ b/cps/templates/shelf_order.html @@ -5,19 +5,19 @@
{{_('Drag \'n drop to rearrange order')}}
{% for entry in entries %} -
+
- {{entry.title}} - {% if entry.series|length > 0 %} + {{entry['title']}} + {% if entry['series']|length > 0 %}
- {{entry.series_index}} - {{entry.series[0].name}} + {{entry['series_index']}} - {{entry['series'][0].name}} {% endif %}
- {% for author in entry.authors %} + {% for author in entry['authors'] %} {{author.name.replace('|',',')}} {% if not loop.last %} & diff --git a/cps/templates/user_edit.html b/cps/templates/user_edit.html index ee486454..247f9159 100644 --- a/cps/templates/user_edit.html +++ b/cps/templates/user_edit.html @@ -46,7 +46,6 @@ {% endfor %}
- {% if registered_oauth.keys()| length > 0 %} {% for id, name in registered_oauth.items() %}
@@ -60,7 +59,6 @@
{% endif %} -
{% for element in sidebar %} {% if element['config_show'] %} diff --git a/cps/ub.py b/cps/ub.py index e8f9b75c..717e201a 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -307,7 +307,7 @@ class RemoteAuthToken(Base): __tablename__ = 'remote_auth_token' id = Column(Integer, primary_key=True) - auth_token = Column(String(8), unique=True) + auth_token = Column(String, unique=True) user_id = Column(Integer, ForeignKey('user.id')) verified = Column(Boolean, default=False) expiration = Column(DateTime) diff --git a/cps/updater.py b/cps/updater.py index 9fe6e828..7af8649c 100644 --- a/cps/updater.py +++ b/cps/updater.py @@ -198,7 +198,7 @@ class Updater(threading.Thread): ) additional_path = self.is_venv() if additional_path: - exclude = exclude + (additional_path) + exclude = exclude + (additional_path,) for root, dirs, files in os.walk(destination, topdown=True): for name in files: old_list.append(os.path.join(root, name).replace(destination, '')) From e60ef8fc97aca18de04f42925515bf77930b2b7a Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sun, 23 Feb 2020 12:40:11 +0100 Subject: [PATCH 13/13] Calibre-web version visible in about section Update Calibre-web Version info --- cps/about.py | 7 +++++-- cps/constants.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cps/about.py b/cps/about.py index aa1e866e..8a77aae0 100644 --- a/cps/about.py +++ b/cps/about.py @@ -30,7 +30,7 @@ import babel, pytz, requests, sqlalchemy import werkzeug, flask, flask_login, flask_principal, jinja2 from flask_babel import gettext as _ -from . import db, converter, uploader, server, isoLanguages +from . import db, converter, uploader, server, isoLanguages, constants from .web import render_title_template try: from flask_login import __version__ as flask_loginVersion @@ -49,8 +49,11 @@ about = flask.Blueprint('about', __name__) _VERSIONS = OrderedDict( - Platform = ' '.join(platform.uname()), + Platform = '{0.system} {0.release} {0.version} {0.processor} {0.machine}'.format(platform.uname()), Python=sys.version, + Calibre_Web=constants.STABLE_VERSION['version'] + ' - ' + + constants.NIGHTLY_VERSION[0].replace('%','%%') + ' - ' + + constants.NIGHTLY_VERSION[1].replace('%','%%'), WebServer=server.VERSION, Flask=flask.__version__, Flask_Login=flask_loginVersion, diff --git a/cps/constants.py b/cps/constants.py index 3b3b1482..8301800b 100644 --- a/cps/constants.py +++ b/cps/constants.py @@ -125,7 +125,7 @@ def selected_roles(dictionary): BookMeta = namedtuple('BookMeta', 'file_path, extension, title, author, cover, description, tags, series, ' 'series_id, languages') -STABLE_VERSION = {'version': '0.6.6'} +STABLE_VERSION = {'version': '0.6.7 Beta'} NIGHTLY_VERSION = {} NIGHTLY_VERSION[0] = '$Format:%H$'