From c4e3f3670f74f1c9e529befdf571239d292bea2e Mon Sep 17 00:00:00 2001 From: yjouanique Date: Fri, 7 Jun 2019 12:15:31 +0700 Subject: [PATCH 01/28] Added public /reconnect endpoint --- cps/web.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cps/web.py b/cps/web.py index 3fc27807..c90fba56 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1884,6 +1884,12 @@ def shutdown(): return json.dumps({}) abort(404) +@app.route("/reconnect") +def reconnect(): + db.session.close() + db.engine.dispose() + db.setup_db() + return json.dumps({}) @app.route("/search", methods=["GET"]) @login_required_if_no_ano From 9fc02f67c2f27de96fa5332d2b3a94d505eaecf6 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Fri, 27 Sep 2019 15:30:39 +0200 Subject: [PATCH 02/28] Debug output for lcase --- cps/helper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cps/helper.py b/cps/helper.py index e909086e..62dda720 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -785,4 +785,7 @@ def get_download_link(book_id, book_format): ############### Database Helper functions def lcase(s): - return unidecode.unidecode(s.lower()) if use_unidecode else s.lower() + try: + return unidecode.unidecode(s.lower()) + except Exception as e: + log.exception(e) From 3764c33a3a2fe7bbe5c9136c62b7b7f8a47267de Mon Sep 17 00:00:00 2001 From: zelazna Date: Tue, 1 Oct 2019 14:15:39 +0200 Subject: [PATCH 03/28] Add the posibility to change the username --- cps/admin.py | 19 +++++++++++++++++-- cps/templates/user_edit.html | 2 +- cps/ub.py | 1 + cps/web.py | 19 ++++++++++++++++++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/cps/admin.py b/cps/admin.py index ccb07d84..4f293058 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -35,7 +35,7 @@ from flask_login import login_required, current_user, logout_user from flask_babel import gettext as _ from sqlalchemy import and_ from sqlalchemy.exc import IntegrityError -from sqlalchemy.sql.expression import func +from sqlalchemy.sql.expression import func, exists from werkzeug.security import generate_password_hash from . import constants, logger, helper, services @@ -563,7 +563,6 @@ def edit_user(user_id): else: if "password" in to_save and to_save["password"]: content.password = generate_password_hash(to_save["password"]) - anonymous = content.is_anonymous content.role = constants.selected_roles(to_save) if anonymous: @@ -601,6 +600,22 @@ def edit_user(user_id): return render_title_template("user_edit.html", translations=translations, languages=languages, new_user=0, content=content, downloads=downloads, registered_oauth=oauth_check, title=_(u"Edit User %(nick)s", nick=content.nickname), page="edituser") + if "nickname" in to_save and to_save["nickname"] != content.nickname: + existing_nickname = ub.session.query(exists().where( + ub.User.nickname == to_save["nickname"])).scalar() + if not existing_nickname: + content.nickname = to_save["nickname"] + else: + flash(_(u"This username is already taken."), category="error") + return render_title_template("user_edit.html", + translations=translations, + languages=languages, + new_user=0, content=content, + downloads=downloads, + registered_oauth=oauth_check, + title=_(u"Edit User %(nick)s", + nick=content.nickname), + page="edituser") if "kindle_mail" in to_save and to_save["kindle_mail"] != content.kindle_mail: content.kindle_mail = to_save["kindle_mail"] diff --git a/cps/templates/user_edit.html b/cps/templates/user_edit.html index e22a9415..99aaeeb3 100644 --- a/cps/templates/user_edit.html +++ b/cps/templates/user_edit.html @@ -3,7 +3,7 @@

{{title}}

- {% if g.user and g.user.role_admin() and new_user %} + {% if g.user or g.user.role_admin() or new_user %}
diff --git a/cps/ub.py b/cps/ub.py index b262e0eb..84ac3e2a 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -27,6 +27,7 @@ from flask import g from flask_babel import gettext as _ from flask_login import AnonymousUserMixin from werkzeug.local import LocalProxy + try: from flask_dance.consumer.backend.sqla import OAuthConsumerMixin oauth_support = True diff --git a/cps/web.py b/cps/web.py index a946573e..1ba3e1d3 100644 --- a/cps/web.py +++ b/cps/web.py @@ -38,7 +38,8 @@ from flask import render_template, request, redirect, send_from_directory, make_ from flask_babel import gettext as _ from flask_login import login_user, logout_user, login_required, current_user from sqlalchemy.exc import IntegrityError -from sqlalchemy.sql.expression import text, func, true, false, not_, and_ +from sqlalchemy.sql.expression import text, func, true, false, not_, and_, \ + exists from werkzeug.exceptions import default_exceptions from werkzeug.datastructures import Headers from werkzeug.security import generate_password_hash, check_password_hash @@ -1252,6 +1253,22 @@ def profile(): return render_title_template("user_edit.html", content=current_user, downloads=downloads, title=_(u"%(name)s's profile", name=current_user.nickname), page="me", registered_oauth=oauth_check, oauth_status=oauth_status) + if "nickname" in to_save and to_save["nickname"] != current_user.nickname: + existing_nickname = ub.session.query(exists().where( + ub.User.nickname == to_save["nickname"])).scalar() + if not existing_nickname: + current_user.nickname = to_save["nickname"] + else: + flash(_(u"This username is already taken."), category="error") + return render_title_template("user_edit.html", + translations=translations, + languages=languages, + new_user=0, content=current_user, + downloads=downloads, + registered_oauth=oauth_check, + title=_(u"Edit User %(nick)s", + nick=current_user.nickname), + page="edituser") current_user.email = to_save["email"] if "show_random" in to_save and to_save["show_random"] == "on": current_user.random_books = 1 From 0735283d456e39fc8025b939489b384e1f599e04 Mon Sep 17 00:00:00 2001 From: DenysNahurnyi Date: Tue, 8 Oct 2019 20:48:26 +0300 Subject: [PATCH 04/28] Fix syntax errors in README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3ea98034..5f774709 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,12 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d - Bootstrap 3 HTML5 interface - full graphical setup -- User management with fine grained per-user permissions +- User management with fine-grained per-user permissions - Admin interface - User Interface in dutch, english, french, german, hungarian, italian, japanese, khmer, polish, russian, simplified chinese, spanish, swedish, ukrainian - OPDS feed for eBook reader apps - Filter and search by titles, authors, tags, series and language -- Create custom book collection (shelves) +- Create a custom book collection (shelves) - Support for editing eBook metadata and deleting eBooks from Calibre library - Support for converting eBooks through Calibre binaries - Restrict eBook download to logged-in users @@ -25,7 +25,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d - Upload new books in many formats - Support for Calibre custom columns - Ability to hide content based on categories for certain users -- Self update capability +- Self-update capability - "Magic Link" login to make it easy to log on eReaders ## Quick start @@ -50,11 +50,11 @@ Python 2.7+, python 3.x+ Optionally, to enable on-the-fly conversion from one ebook format to another when using the send-to-kindle feature, or during editing of ebooks metadata: -[Download and install](https://calibre-ebook.com/download) the Calibre desktop program for your platform and enter the folder including programm name (normally /opt/calibre/ebook-convert, or C:\Program Files\calibre\ebook-convert.exe) in the field "calibre's converter tool" on the setup page. +[Download and install](https://calibre-ebook.com/download) the Calibre desktop program for your platform and enter the folder including program name (normally /opt/calibre/ebook-convert, or C:\Program Files\calibre\ebook-convert.exe) in the field "calibre's converter tool" on the setup page. \*** DEPRECATED \*** Support will be removed in future releases -[Download](http://www.amazon.com/gp/feature.html?docId=1000765211) Amazon's KindleGen tool for your platform and place the binary named as `kindlegen` in the `vendor` folder. +[Download](http://www.amazon.com/gp/feature.html?docId=1000765211) Amazon's KindleGen tool for your platform and place the binary named `kindlegen` in the `vendor` folder. ## Docker Images @@ -82,4 +82,4 @@ Pre-built Docker images are available in these Docker Hub repositories: # Wiki -For further informations, How To's and FAQ please check the [Wiki](https://github.com/janeczku/calibre-web/wiki) +For further information, How To's and FAQ please check the [Wiki](https://github.com/janeczku/calibre-web/wiki) From 01b0f9534cc66b621e1c044f373b80d31a4d8e60 Mon Sep 17 00:00:00 2001 From: gwenhael Date: Fri, 18 Oct 2019 15:12:27 +0200 Subject: [PATCH 05/28] fix issue #1064 Allow for finer steps in serie-index --- cps/templates/book_edit.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/templates/book_edit.html b/cps/templates/book_edit.html index 9305e204..60421ea6 100644 --- a/cps/templates/book_edit.html +++ b/cps/templates/book_edit.html @@ -73,7 +73,7 @@
- +
From ada727a5706fe0ab47d72e04d040d46789cbd85e Mon Sep 17 00:00:00 2001 From: Kyos Date: Sat, 19 Oct 2019 10:52:03 +0200 Subject: [PATCH 06/28] Adds Authors, Series and Book Cover to the shelf order view --- cps/static/css/style.css | 1 + cps/templates/shelf_order.html | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/cps/static/css/style.css b/cps/static/css/style.css index aaa7503e..3532043f 100644 --- a/cps/static/css/style.css +++ b/cps/static/css/style.css @@ -64,6 +64,7 @@ span.glyphicon.glyphicon-tags {padding-right: 5px;color: #999;vertical-align: te .navbar-default .navbar-toggle .icon-bar {background-color: #000;} .navbar-default .navbar-toggle {border-color: #000;} .cover { margin-bottom: 10px;} +.cover-heigh { max-height: 100px;} .btn-file {position: relative; overflow: hidden;} .btn-file input[type=file] {position: absolute; top: 0; right: 0; min-width: 100%; min-height: 100%; font-size: 100px; text-align: right; filter: alpha(opacity=0); opacity: 0; outline: none; background: white; cursor: inherit; display: block;} diff --git a/cps/templates/shelf_order.html b/cps/templates/shelf_order.html index e3340993..0fa8dc15 100644 --- a/cps/templates/shelf_order.html +++ b/cps/templates/shelf_order.html @@ -1,11 +1,32 @@ {% extends "layout.html" %} {% block body %} -
+

{{title}}

{{_('Drag \'n drop to rearrange order')}}
{% for entry in entries %} -
{{entry.title}}
+
+
+ +
+ {{entry.title}} + {% if entry.series|length > 0 %} +
+ {{entry.series_index}} - {{entry.series[0].name}} + {% endif %} +
+ {% for author in entry.authors %} + {{author.name.replace('|',',')}} + {% if not loop.last %} + & + {% endif %} + {% endfor %} +
+
+
+
{% endfor %}
From 7165826011b8456b3cd1e1c300f7c27941776de6 Mon Sep 17 00:00:00 2001 From: Kyos Date: Sat, 19 Oct 2019 10:57:48 +0200 Subject: [PATCH 07/28] Adds Authors, Series and Book Cover to the shelf order view --- cps/templates/shelf_order.html | 1 - 1 file changed, 1 deletion(-) diff --git a/cps/templates/shelf_order.html b/cps/templates/shelf_order.html index 0fa8dc15..70f74df3 100644 --- a/cps/templates/shelf_order.html +++ b/cps/templates/shelf_order.html @@ -25,7 +25,6 @@ {% endfor %}
-
{% endfor %}
From c93dd32179f6334d17c2e6f708d578857a8b7795 Mon Sep 17 00:00:00 2001 From: Kyos Date: Sat, 19 Oct 2019 12:02:14 +0200 Subject: [PATCH 08/28] Fixed typo and column size for LG screens --- cps/static/css/style.css | 2 +- cps/templates/shelf_order.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cps/static/css/style.css b/cps/static/css/style.css index 3532043f..da088021 100644 --- a/cps/static/css/style.css +++ b/cps/static/css/style.css @@ -64,7 +64,7 @@ span.glyphicon.glyphicon-tags {padding-right: 5px;color: #999;vertical-align: te .navbar-default .navbar-toggle .icon-bar {background-color: #000;} .navbar-default .navbar-toggle {border-color: #000;} .cover { margin-bottom: 10px;} -.cover-heigh { max-height: 100px;} +.cover-height { max-height: 100px;} .btn-file {position: relative; overflow: hidden;} .btn-file input[type=file] {position: absolute; top: 0; right: 0; min-width: 100%; min-height: 100%; font-size: 100px; text-align: right; filter: alpha(opacity=0); opacity: 0; outline: none; background: white; cursor: inherit; display: block;} diff --git a/cps/templates/shelf_order.html b/cps/templates/shelf_order.html index 70f74df3..26fa2e35 100644 --- a/cps/templates/shelf_order.html +++ b/cps/templates/shelf_order.html @@ -7,10 +7,10 @@ {% for entry in entries %}
-