From f2ac9d356b7f122abe3152efc477635969207b3e Mon Sep 17 00:00:00 2001 From: Jeremy Fisher Date: Tue, 19 Sep 2023 17:56:05 -0400 Subject: [PATCH 01/11] Add send to ereader permission --- cps/constants.py | 2 ++ cps/templates/admin.html | 2 ++ cps/templates/detail.html | 2 ++ cps/ub.py | 3 +++ 4 files changed, 9 insertions(+) diff --git a/cps/constants.py b/cps/constants.py index c7d3a6ce8..b557d33bb 100644 --- a/cps/constants.py +++ b/cps/constants.py @@ -63,6 +63,7 @@ ROLE_EDIT_SHELFS = 1 << 6 ROLE_DELETE_BOOKS = 1 << 7 ROLE_VIEWER = 1 << 8 +ROLE_SEND_TO_EREADER = 1 << 9 ALL_ROLES = { "admin_role": ROLE_ADMIN, @@ -73,6 +74,7 @@ "edit_shelf_role": ROLE_EDIT_SHELFS, "delete_role": ROLE_DELETE_BOOKS, "viewer_role": ROLE_VIEWER, + "send_to_ereader": ROLE_SEND_TO_EREADER, } DETAIL_RANDOM = 1 << 0 diff --git a/cps/templates/admin.html b/cps/templates/admin.html index ac124fe84..4cb69e211 100644 --- a/cps/templates/admin.html +++ b/cps/templates/admin.html @@ -20,6 +20,7 @@

{{_('Users')}}

{{_('Upload')}} {% endif %} {{_('Download')}} + {{_('Send to eReader')}} {{_('View Books')}} {{_('Edit')}} {{_('Delete')}} @@ -38,6 +39,7 @@

{{_('Users')}}

{{ display_bool_setting(user.role_upload()) }} {% endif %} {{ display_bool_setting(user.role_download()) }} + {{ display_bool_setting(user.role_send_to_ereader()) }} {{ display_bool_setting(user.role_viewer()) }} {{ display_bool_setting(user.role_edit()) }} {{ display_bool_setting(user.role_delete_books()) }} diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 304306630..8c9d2df69 100755 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -43,6 +43,8 @@ {% endif %} {% endif %} + {% endif %} + {% if current_user.role_send_to_ereader() %} {% if current_user.kindle_mail and entry.email_share_list %} {% if entry.email_share_list.__len__() == 1 %} diff --git a/cps/ub.py b/cps/ub.py index db8dba032..9d2706a0e 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -160,6 +160,9 @@ def role_delete_books(self): def role_viewer(self): return self._has_role(constants.ROLE_VIEWER) + def role_send_to_ereader(self): + return self._has_role(constants.ROLE_SEND_TO_EREADER) + @property def is_active(self): return True From 5afff2231e1a6b209167811c70f101e8d5efa1f3 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 11 Nov 2023 10:43:50 +0100 Subject: [PATCH 02/11] Fix for #2743 (read status is no longer implicitly added to advanced search query) --- cps/search.py | 9 +++++---- cps/templates/search_form.html | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cps/search.py b/cps/search.py index 4eee22061..f214b3a8b 100644 --- a/cps/search.py +++ b/cps/search.py @@ -217,8 +217,8 @@ def extend_search_term(searchterm, searchterm.extend([_("Rating <= %(rating)s", rating=rating_high)]) if rating_low: searchterm.extend([_("Rating >= %(rating)s", rating=rating_low)]) - if read_status: - searchterm.extend([_("Read Status = %(status)s", status=read_status)]) + if read_status != "Any": + searchterm.extend([_("Read Status = '%(status)s'", status=read_status)]) searchterm.extend(ext for ext in tags['include_extension']) searchterm.extend(ext for ext in tags['exclude_extension']) # handle custom columns @@ -283,7 +283,7 @@ def render_adv_search_results(term, offset=None, order=None, limit=None): cc_present = True if any(tags.values()) or author_name or book_title or publisher or pub_start or pub_end or rating_low \ - or rating_high or description or cc_present or read_status: + or rating_high or description or cc_present or read_status != "Any": search_term, pub_start, pub_end = extend_search_term(search_term, author_name, book_title, @@ -302,7 +302,8 @@ def render_adv_search_results(term, offset=None, order=None, limit=None): q = q.filter(func.datetime(db.Books.pubdate) > func.datetime(pub_start)) if pub_end: q = q.filter(func.datetime(db.Books.pubdate) < func.datetime(pub_end)) - q = q.filter(adv_search_read_status(read_status)) + if read_status != "Any": + q = q.filter(adv_search_read_status(read_status)) if publisher: q = q.filter(db.Books.publishers.any(func.lower(db.Publishers.name).ilike("%" + publisher + "%"))) q = adv_search_tag(q, tags['include_tag'], tags['exclude_tag']) diff --git a/cps/templates/search_form.html b/cps/templates/search_form.html index 030d8585c..cf2fac04b 100644 --- a/cps/templates/search_form.html +++ b/cps/templates/search_form.html @@ -41,7 +41,8 @@

{{title}}

From c062c70a81a9bca0923c0b3f6453577cb898448d Mon Sep 17 00:00:00 2001 From: "Byron H." Date: Tue, 26 Sep 2023 00:36:41 -0500 Subject: [PATCH 03/11] =?UTF-8?q?Allow=20to=20create=20custom=20pages=20an?= =?UTF-8?q?d=20add=20them=20to=20the=20menu.=20-=20Sponsor:=20Fundaci?= =?UTF-8?q?=C3=B3n=20Karisma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + cps/editpage.py | 105 ++++++++++++++++++++++++++++++++++ cps/listpages.py | 40 +++++++++++++ cps/main.py | 6 ++ cps/page.py | 39 +++++++++++++ cps/render_template.py | 14 ++++- cps/templates/admin.html | 1 + cps/templates/edit_page.html | 45 +++++++++++++++ cps/templates/layout.html | 6 ++ cps/templates/list_pages.html | 48 ++++++++++++++++ cps/templates/page.html | 4 ++ cps/ub.py | 13 ++++- 12 files changed, 320 insertions(+), 3 deletions(-) create mode 100644 cps/editpage.py create mode 100644 cps/listpages.py create mode 100644 cps/page.py create mode 100644 cps/templates/edit_page.html create mode 100644 cps/templates/list_pages.html create mode 100644 cps/templates/page.html diff --git a/.gitignore b/.gitignore index ff08f874b..eb398718d 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ gdrive_credentials client_secrets.json gmail.json /.key + +pages/ diff --git a/cps/editpage.py b/cps/editpage.py new file mode 100644 index 000000000..2664bfc7b --- /dev/null +++ b/cps/editpage.py @@ -0,0 +1,105 @@ +import os +import flask +from flask import Flask, abort, request +from functools import wraps +from pathlib import Path +from flask_login import current_user, login_required + +from .render_template import render_title_template +from . import logger, config, ub +from .constants import CONFIG_DIR as _CONFIG_DIR + +log = logger.create() + +editpage = flask.Blueprint('editpage', __name__) + +def edit_required(f): + @wraps(f) + def inner(*args, **kwargs): + if current_user.role_edit() or current_user.role_admin(): + return f(*args, **kwargs) + abort(403) + + return inner + +def _get_checkbox(dictionary, field, default): + new_value = dictionary.get(field, default) + convertor = lambda y: y == "on" + new_value = convertor(new_value) + + return new_value + +@editpage.route("/admin/page/", methods=["GET", "POST"]) +@login_required +@edit_required +def edit_page(file): + doc = "" + title = "" + name = "" + icon = "file" + is_enabled = True + order = 0 + position = "0" + + page = ub.session.query(ub.Page).filter(ub.Page.id == file).first() + if page: + title = page.title + name = page.name + icon = page.icon + is_enabled = page.is_enabled + order = page.order + position = page.position + + if request.method == "POST": + to_save = request.form.to_dict() + title = to_save.get("title", "").strip() + name = to_save.get("name", "").strip() + icon = to_save.get("icon", "").strip() + position = to_save.get("position", "").strip() + order = to_save.get("order", 0) + order = int(order) + content = to_save.get("content", "").strip() + is_enabled = _get_checkbox(to_save, "is_enabled", True) + + if page: + page.title = title + page.name = name + page.icon = icon + page.is_enabled = is_enabled + page.order = order + page.position = position + ub.session_commit("Page edited {}".format(file)) + else: + new_page = ub.Page(title=title, name=name, icon=icon, is_enabled=is_enabled, order=order, position=position) + ub.session.add(new_page) + ub.session_commit("Page added {}".format(file)) + + if (file == "new"): + file = str(new_page.id) + dir_config_path = os.path.join(_CONFIG_DIR, 'pages') + file_name = Path(name + '.md') + file_path = dir_config_path / file_name + is_path = os.path.exists(dir_config_path) + if not is_path: + try: + os.makedirs(dir_config_path) + except Exception as ex: + log.error(ex) + try: + with open(file_path, 'w') as f: + f.write(content) + f.close() + except Exception as ex: + log.error(ex) + + if file != "new": + dir_config_path = os.path.join(_CONFIG_DIR, 'pages') + file_name = Path(name + '.md') + file_path = dir_config_path / file_name + if file_path.is_file(): + with open(file_path, 'r') as f: + doc = f.read() + else: + doc = "## New file\n\nInformation" + + return render_title_template("edit_page.html", title=title, name=name, icon=icon, is_enabled=is_enabled, order=order, position=position, content=doc, file=file) diff --git a/cps/listpages.py b/cps/listpages.py new file mode 100644 index 000000000..5cfcfa26c --- /dev/null +++ b/cps/listpages.py @@ -0,0 +1,40 @@ +import flask +import json +from flask import make_response,abort +from flask_login import current_user, login_required +from functools import wraps +from flask_babel import gettext as _ + +from .render_template import render_title_template +from . import ub, db + +listpages = flask.Blueprint('listpages', __name__) + +def edit_required(f): + @wraps(f) + def inner(*args, **kwargs): + if current_user.role_edit() or current_user.role_admin(): + return f(*args, **kwargs) + abort(403) + + return inner + +@listpages.route("/admin/pages/", methods=["GET"]) +@login_required +@edit_required +def show_list(): + pages = ub.session.query(ub.Page).order_by(ub.Page.position).order_by(ub.Page.order).all() + + return render_title_template('list_pages.html', title=_("Pages List"), page="book_table", pages=pages) + +@listpages.route("/ajax/listpages") +@login_required +@edit_required +def list_pages(): + pages = ub.session.query(ub.Page).order_by(ub.Page.position).order_by(ub.Page.order).all() + table_entries = {'totalNotFiltered': len(pages), 'total': len(pages), "rows": pages} + js_list = json.dumps(table_entries, cls=db.AlchemyEncoder) + response = make_response(js_list) + response.headers["Content-Type"] = "application/json; charset=utf-8" + + return response diff --git a/cps/main.py b/cps/main.py index 286b2b278..ad990bb7c 100644 --- a/cps/main.py +++ b/cps/main.py @@ -36,6 +36,9 @@ def main(): from .gdrive import gdrive from .editbooks import editbook from .about import about + from .page import page + from .listpages import listpages + from .editpage import editpage from .search import search from .search_metadata import meta from .shelf import shelf @@ -65,6 +68,9 @@ def main(): limiter.limit("3/minute",key_func=request_username)(opds) app.register_blueprint(jinjia) app.register_blueprint(about) + app.register_blueprint(page) + app.register_blueprint(listpages) + app.register_blueprint(editpage) app.register_blueprint(shelf) app.register_blueprint(admi) app.register_blueprint(remotelogin) diff --git a/cps/page.py b/cps/page.py new file mode 100644 index 000000000..f4c27419f --- /dev/null +++ b/cps/page.py @@ -0,0 +1,39 @@ +import os +import flask +import markdown +from flask import abort +from pathlib import Path +from flask_babel import gettext as _ + +from . import logger, config, ub +from .render_template import render_title_template +from .constants import CONFIG_DIR as _CONFIG_DIR + +page = flask.Blueprint('page', __name__) + +log = logger.create() + +@page.route('/page/', methods=['GET']) +def get_page(file): + page = ub.session.query(ub.Page)\ + .filter(ub.Page.name == file)\ + .filter(ub.Page.is_enabled)\ + .first() + + if page: + dir_config_path = os.path.join(_CONFIG_DIR, 'pages') + file_name = Path(file + '.md') + file_path = dir_config_path / file_name + + if file_path.is_file(): + with open(file_path, 'r') as f: + temp_md = f.read() + body = markdown.markdown(temp_md) + + return render_title_template('page.html', body=body, title=page.title, page=page.name) + else: + log.error("'%s' was accessed but file doesn't exists." % file) + abort(404) + else: + log.error("'%s' was accessed but is not enabled or it's not in database." % file) + abort(404) diff --git a/cps/render_template.py b/cps/render_template.py index 68b464593..0f6e68ef3 100644 --- a/cps/render_template.py +++ b/cps/render_template.py @@ -104,14 +104,24 @@ def get_sidebar_config(kwargs=None): g.shelves_access = ub.session.query(ub.Shelf).filter( or_(ub.Shelf.is_public == 1, ub.Shelf.user_id == current_user.id)).order_by(ub.Shelf.name).all() - return sidebar, simple + top_pages = ub.session.query(ub.Page)\ + .filter(ub.Page.position == "1")\ + .filter(ub.Page.is_enabled)\ + .order_by(ub.Page.order) + bottom_pages = ub.session.query(ub.Page)\ + .filter(ub.Page.position == "0")\ + .filter(ub.Page.is_enabled)\ + .order_by(ub.Page.order) + + return sidebar, simple, top_pages, bottom_pages # Returns the template for rendering and includes the instance name def render_title_template(*args, **kwargs): - sidebar, simple = get_sidebar_config(kwargs) + sidebar, simple, top_pages, bottom_pages = get_sidebar_config(kwargs) try: return render_template(instance=config.config_calibre_web_title, sidebar=sidebar, simple=simple, + top_pages=top_pages, bottom_pages=bottom_pages, accept=constants.EXTENSIONS_UPLOAD, *args, **kwargs) except PermissionError: diff --git a/cps/templates/admin.html b/cps/templates/admin.html index ac124fe84..3f7bf788e 100644 --- a/cps/templates/admin.html +++ b/cps/templates/admin.html @@ -159,6 +159,7 @@

{{_('Configuration')}}

{{_('Edit Calibre Database Configuration')}} {{_('Edit Basic Configuration')}} {{_('Edit UI Configuration')}} + {{_('List Pages')}}
{% if feature_support['scheduler'] %} diff --git a/cps/templates/edit_page.html b/cps/templates/edit_page.html new file mode 100644 index 000000000..40c7a148f --- /dev/null +++ b/cps/templates/edit_page.html @@ -0,0 +1,45 @@ +{% extends "layout.html" %} +{% block body %} +
+
{{_('Back')}}
+

{{_('Edit page')}}

+
+ +
+ + +
+
+ + +
+
+ + + {{_('Icons list')}} +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + {{_('Cancel')}} +
+
+{% endblock %} \ No newline at end of file diff --git a/cps/templates/layout.html b/cps/templates/layout.html index 1bee1c1d1..c4716615e 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -142,6 +142,9 @@

{{_('Uploading...')}}

- +
{{_('Cancel')}} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/cps/templates/list_pages.html b/cps/templates/list_pages.html index 65ff40647..8527a9eb8 100644 --- a/cps/templates/list_pages.html +++ b/cps/templates/list_pages.html @@ -7,30 +7,34 @@ {% block body %}

{{_(title)}}

- - - - - - - - + + + + + + + + + + + {% for page in pages %} - - - - - - + + + + + - - + {% endif %} + + + {% endfor %} +
{{_('Name')}}{{_('Title')}}{{_('Icon')}}{{_('Position')}}{{_('Enabled')}}{{_('Order')}}
{{_('Name')}}{{_('Title')}}{{_('Icon')}}{{_('Position')}}{{_('Enabled')}}{{_('Order')}}
{{page.name}}{{page.title}}{{page.icon}}{{_('bottom') if page.position == "0" else _('top')}} - {% if page.is_enabled %} +
{{page.name}}{{page.title}}{{page.icon}}{{_('bottom') if page.position == "0" else _('top')}} + {% if page.is_enabled %} - {% else %} + {% else %} - {% endif %} - {{page.order}}
{{page.order}}
{{_('New Page')}} {% endblock %} @@ -45,4 +49,4 @@

{{_(title)}}

charset="UTF-8"> {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/cps/templates/page.html b/cps/templates/page.html index 1d0d8c31c..086299310 100644 --- a/cps/templates/page.html +++ b/cps/templates/page.html @@ -1,4 +1,4 @@ {% extends "layout.html" %} {% block body %}
{{body|safe}}
-{% endblock %} \ No newline at end of file +{% endblock %} From 9841a4d068a7150c32aa40986e49b5c3434a046e Mon Sep 17 00:00:00 2001 From: ye Date: Sun, 26 Nov 2023 09:06:25 +0800 Subject: [PATCH 05/11] fix the the problem that metadata_provider/douban.py can't get tags info --- cps/metadata_provider/douban.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cps/metadata_provider/douban.py b/cps/metadata_provider/douban.py index 8e27e82e8..39c71cc72 100644 --- a/cps/metadata_provider/douban.py +++ b/cps/metadata_provider/douban.py @@ -169,7 +169,8 @@ def _parse_single_book(self, ), ) - html = etree.HTML(r.content.decode("utf8")) + decode_content = r.content.decode("utf8") + html = etree.HTML(decode_content) match.title = html.xpath(self.TITTLE_XPATH)[0].text match.cover = html.xpath( @@ -184,7 +185,7 @@ def _parse_single_book(self, if len(tag_elements): match.tags = [tag_element.text for tag_element in tag_elements] else: - match.tags = self._get_tags(html.text) + match.tags = self._get_tags(decode_content) description_element = html.xpath(self.DESCRIPTION_XPATH) if len(description_element): From 400c74569280e2eb5d48cfd32761a24224ae0ec9 Mon Sep 17 00:00:00 2001 From: Russell Troxel Date: Sun, 26 Nov 2023 14:31:24 -0800 Subject: [PATCH 06/11] Update KOBO_IMAGEHOST_URL to new CDN endpoint Kobo has introduced a vanity URL to their Akamai CDN config - "https://https://cdn.kobo.com". As a result, requests sent to the old raw Akamai endpoint now through 404s. This is a simple PR that updates to the new URL. This is visible in the config of a newly bought Kobo Sage (mine): ``` image_host=https://cdn.kobo.com/book-images/ image_url_quality_template=https://cdn.kobo.com/book-images/{ImageId}/{Width}/{Height}/{Quality}/{IsGreyscale}/image.jpg image_url_template=https://cdn.kobo.com/book-images/{ImageId}/{Width}/{Height}/false/image.jpg ``` Example: OLD: https://kbimages1-a.akamaihd.net/1abfb307-457b-4597-b2ea-74beb2eb1478/149/223/false/image.jpg (Throws 404) New: https://cdn.kobo.com/book-images/1abfb307-457b-4597-b2ea-74beb2eb1478/149/223/false/image.jpg (Renders Properly) fixes #2371 ref #2731 --- cps/kobo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/kobo.py b/cps/kobo.py index f215e5aa0..b2b5989b9 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -56,7 +56,7 @@ KOBO_FORMATS = {"KEPUB": ["KEPUB"], "EPUB": ["EPUB3", "EPUB"]} KOBO_STOREAPI_URL = "https://storeapi.kobo.com" -KOBO_IMAGEHOST_URL = "https://kbimages1-a.akamaihd.net" +KOBO_IMAGEHOST_URL = "https://cdn.kobo.com/book-images/" SYNC_ITEM_LIMIT = 100 From 01108aac42c393bdcb4cf1fc92532b36ad4e1bde Mon Sep 17 00:00:00 2001 From: Russell Date: Sun, 26 Nov 2023 22:01:26 -0800 Subject: [PATCH 07/11] Remove trailing slash Signed-off-by: Russell --- cps/kobo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/kobo.py b/cps/kobo.py index b2b5989b9..76530797d 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -56,7 +56,7 @@ KOBO_FORMATS = {"KEPUB": ["KEPUB"], "EPUB": ["EPUB3", "EPUB"]} KOBO_STOREAPI_URL = "https://storeapi.kobo.com" -KOBO_IMAGEHOST_URL = "https://cdn.kobo.com/book-images/" +KOBO_IMAGEHOST_URL = "https://cdn.kobo.com/book-images" SYNC_ITEM_LIMIT = 100 From 84182e791a75652d8da9702c97b14d8e2ce4e497 Mon Sep 17 00:00:00 2001 From: Jeremy Fisher Date: Sat, 9 Dec 2023 07:53:02 -0500 Subject: [PATCH 08/11] Add markdown requirement and add missing id for testing --- cps/templates/list_pages.html | 2 +- requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cps/templates/list_pages.html b/cps/templates/list_pages.html index 8527a9eb8..cf89a8f66 100644 --- a/cps/templates/list_pages.html +++ b/cps/templates/list_pages.html @@ -36,7 +36,7 @@

{{_(title)}}

{% endfor %} -{{_('New Page')}} +{{_('New Page')}} {% endblock %} {% block js %} diff --git a/requirements.txt b/requirements.txt index c28f2019c..7fd72b4cc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,3 +18,4 @@ flask-wtf>=0.14.2,<1.3.0 chardet>=3.0.0,<4.1.0 advocate>=1.0.0,<1.1.0 Flask-Limiter>=2.3.0,<3.6.0 +markdown>=3.5.1 From 0f3bfdda79ecc7521e6e24511e996ca98eb2e485 Mon Sep 17 00:00:00 2001 From: jeremy Date: Thu, 21 Mar 2024 15:25:52 -0400 Subject: [PATCH 09/11] Fix issues with send permission and custom page styling --- .gitignore | 1 + cps/admin.py | 2 +- cps/static/css/caliBlur.css | 24 ++++++++++++++++++++++++ cps/templates/page.html | 2 +- cps/templates/user_edit.html | 4 ++++ cps/templates/user_table.html | 1 + cps/ub.py | 4 ++-- 7 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index eb398718d..d757b816c 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ cps/cache *.bak *.log.* .key +.venv settings.yaml gdrive_credentials diff --git a/cps/admin.py b/cps/admin.py index 022acc8e1..91b2f7c8f 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -1981,7 +1981,7 @@ def _handle_edit_user(to_save, content, languages, translations, kobo_support): return redirect(url_for('admin.admin')) val = [int(k[5:]) for k in to_save if k.startswith('show_')] - sidebar, __ = get_sidebar_config() + sidebar, __, __, __ = get_sidebar_config() for element in sidebar: value = element['visibility'] if value in val and not content.check_visibility(value): diff --git a/cps/static/css/caliBlur.css b/cps/static/css/caliBlur.css index cf7437615..14dd3b8fe 100644 --- a/cps/static/css/caliBlur.css +++ b/cps/static/css/caliBlur.css @@ -7944,3 +7944,27 @@ div.comments[data-readmore] { transition: height 300ms; overflow: hidden } + +div.col-sm-10 > h2.book_table, div.col-sm-10 > a.session { + padding-left: 40px; + padding-right: 10px; +} + +div.col-sm-10 > h2.book_table { + color: white; +} + +div.col-sm-10 > table.table { + margin-left: 40px; + width: calc(100% - 50px); +} + +div.col-sm-10 > div.custom_page { + padding-left: 40px; + padding-right: 10px; + color: white; +} + +div.col-sm-10 > div.custom_page > h2 { + color: white; +} \ No newline at end of file diff --git a/cps/templates/page.html b/cps/templates/page.html index 086299310..d8083bf09 100644 --- a/cps/templates/page.html +++ b/cps/templates/page.html @@ -1,4 +1,4 @@ {% extends "layout.html" %} {% block body %} -
{{body|safe}}
+
{{body|safe}}
{% endblock %} diff --git a/cps/templates/user_edit.html b/cps/templates/user_edit.html index 18b018e69..4afd3cd55 100644 --- a/cps/templates/user_edit.html +++ b/cps/templates/user_edit.html @@ -100,6 +100,10 @@

{{title}}

+
+ + +
diff --git a/cps/templates/user_table.html b/cps/templates/user_table.html index 3f998f951..baa6a08d7 100644 --- a/cps/templates/user_table.html +++ b/cps/templates/user_table.html @@ -144,6 +144,7 @@

{{_(title)}}

{{ user_checkbox_row("role", "passwd_role", _('Change Password'), visiblility, all_roles)}} {{ user_checkbox_row("role", "upload_role",_('Upload'), visiblility, all_roles)}} {{ user_checkbox_row("role", "download_role", _('Download'), visiblility, all_roles)}} + {{ user_checkbox_row("role", "send_to_ereader", _('Send to eReader'), visiblility, all_roles)}} {{ user_checkbox_row("role", "viewer_role", _('View'), visiblility, all_roles)}} {{ user_checkbox_row("role", "edit_role", _('Edit'), visiblility, all_roles)}} {{ user_checkbox_row("role", "delete_role", _('Delete'), visiblility, all_roles)}} diff --git a/cps/ub.py b/cps/ub.py index 1b002113e..43382dbc4 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -233,7 +233,7 @@ class User(UserBase, Base): id = Column(Integer, primary_key=True) name = Column(String(64), unique=True) email = Column(String(120), unique=True, default="") - role = Column(SmallInteger, default=constants.ROLE_USER) + role = Column(Integer, default=constants.ROLE_USER) password = Column(String) kindle_mail = Column(String(120), default="") shelf = relationship('Shelf', backref='user', lazy='dynamic', order_by='Shelf.name') @@ -745,7 +745,7 @@ def migrate_Database(_session): conn.execute(text("CREATE TABLE user_id (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," "name VARCHAR(64)," "email VARCHAR(120)," - "role SMALLINT," + "role INTEGER," "password VARCHAR," "kindle_mail VARCHAR(120)," "locale VARCHAR(2)," From fad120242aa0b1e8ad179b5924db7c26a4520f7a Mon Sep 17 00:00:00 2001 From: jeremy Date: Fri, 29 Mar 2024 15:26:50 -0400 Subject: [PATCH 10/11] Improve reorder page styling --- cps/static/css/caliBlur.css | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/cps/static/css/caliBlur.css b/cps/static/css/caliBlur.css index 14dd3b8fe..6cff9f0e6 100644 --- a/cps/static/css/caliBlur.css +++ b/cps/static/css/caliBlur.css @@ -229,6 +229,10 @@ } } +body h2 { + color: hsla(0, 0%, 100%, .45); +} + body > div.navbar.navbar-default.navbar-static-top > div > div.navbar-collapse.collapse > ul > li > a[href*=advanced_search] { display: none } @@ -411,7 +415,7 @@ body.blur .row-fluid .col-sm-10 { font-family: plex-icons-new, serif; margin-right: 30px; margin-left: 15px; - vertical-align: bottom; + vertical-align: top; display: inline-block; font-weight: 400; font-size: 18px; @@ -447,9 +451,9 @@ body.shelforder > div.container-fluid > div.row-fluid > div.col-sm-10:before { font-style: normal; font-weight: 400; line-height: 1; - font-size: 6vw; + font-size: 3vw; position: fixed; - left: 240px; + left: 160px; top: 180px; width: calc(20% - 55px); text-align: center @@ -2447,7 +2451,7 @@ label { } body > div.container-fluid > div > div.col-sm-10 > div.col-sm-8 { - margin-left: calc(20%); + margin-left: calc(10%); width: calc(80% - 30px); padding: 60px 0 } @@ -7967,4 +7971,13 @@ div.col-sm-10 > div.custom_page { div.col-sm-10 > div.custom_page > h2 { color: white; +} + +div.list-group-item > div.row { + margin-left: 50px; + margin-top: -50px; +} + +div.list-group-item > div.row > div.col-lg-2 { + width: 100px; } \ No newline at end of file From 6859004d9d71a38fdf5bcb0b4865eaed6315a3e7 Mon Sep 17 00:00:00 2001 From: jeremy Date: Fri, 19 Apr 2024 13:02:34 -0400 Subject: [PATCH 11/11] Change the resize filter --- cps/tasks/thumbnail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/tasks/thumbnail.py b/cps/tasks/thumbnail.py index dd9ee1e08..7cf90b68f 100644 --- a/cps/tasks/thumbnail.py +++ b/cps/tasks/thumbnail.py @@ -218,7 +218,7 @@ def generate_book_thumbnail(self, book, thumbnail): filename = self.cache.get_cache_file_path(thumbnail.filename, constants.CACHE_TYPE_THUMBNAILS) if img.height > height: width = get_resize_width(thumbnail.resolution, img.width, img.height) - img.resize(width=width, height=height, filter='lanczos') + img.resize(width=width, height=height)#, filter='lanczos') img.format = thumbnail.format img.save(filename=filename) else: