diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 34d2c453..35314511 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -6,6 +6,7 @@ labels: '' assignees: '' --- + **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. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 1a71b1ac..6b2b9afc 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,6 +7,8 @@ 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 [...] diff --git a/README.md b/README.md index 82c7976c..25ed59bb 100644 --- a/README.md +++ b/README.md @@ -61,14 +61,14 @@ Optionally, to enable on-the-fly conversion from one ebook format to another whe Pre-built Docker images are available in these Docker Hub repositories: #### **Technosoft2000 - x64** -+ Docker Hub - [https://hub.docker.com/r/technosoft2000/calibre-web/](https://hub.docker.com/r/technosoft2000/calibre-web/) ++ Docker Hub - [https://hub.docker.com/r/technosoft2000/calibre-web](https://hub.docker.com/r/technosoft2000/calibre-web) + Github - [https://github.com/Technosoft2000/docker-calibre-web](https://github.com/Technosoft2000/docker-calibre-web) Includes the Calibre `ebook-convert` binary. + The "path to convertertool" should be set to `/opt/calibre/ebook-convert` #### **LinuxServer - x64, armhf, aarch64** -+ Docker Hub - [https://hub.docker.com/r/linuxserver/calibre-web/](https://hub.docker.com/r/linuxserver/calibre-web/) ++ Docker Hub - [https://hub.docker.com/r/linuxserver/calibre-web](https://hub.docker.com/r/linuxserver/calibre-web) + Github - [https://github.com/linuxserver/docker-calibre-web](https://github.com/linuxserver/docker-calibre-web) + Github - (Optional Calibre layer) - [https://github.com/linuxserver/docker-calibre-web/tree/calibre](https://github.com/linuxserver/docker-calibre-web/tree/calibre) @@ -83,3 +83,7 @@ Pre-built Docker images are available in these Docker Hub repositories: # Wiki For further information, How To's and FAQ please check the [Wiki](https://github.com/janeczku/calibre-web/wiki) + +# Contributing to Calibre-Web + +Please have a look at our [Contributing Guidelines](https://github.com/janeczku/calibre-web/blob/master/CONTRIBUTING.md) diff --git a/cps/comic.py b/cps/comic.py index 4f991129..1bb23622 100644 --- a/cps/comic.py +++ b/cps/comic.py @@ -134,7 +134,7 @@ def get_comic_info(tmp_file_path, original_file_name, original_file_extension, r # if style is not None: loadedMetadata = archive.readMetadata(style) - lang = loadedMetadata.language + lang = loadedMetadata.language or "" loadedMetadata.language = isoLanguages.get_lang3(lang) return BookMeta( diff --git a/cps/db.py b/cps/db.py index debfe288..32dd022b 100644 --- a/cps/db.py +++ b/cps/db.py @@ -120,6 +120,12 @@ class Identifiers(Base): return u"Google Books" elif format_type == "kobo": return u"Kobo" + elif format_type == "litres": + return u"ЛитРес" + elif format_type == "issn": + return u"ISSN" + elif format_type == "isfdb": + return u"ISFDB" if format_type == "lubimyczytac": return u"Lubimyczytac" else: @@ -144,7 +150,13 @@ class Identifiers(Base): elif format_type == "kobo": return u"https://www.kobo.com/ebook/{0}".format(self.val) elif format_type == "lubimyczytac": - return u" https://lubimyczytac.pl/ksiazka/{0}".format(self.val) + return u" https://lubimyczytac.pl/ksiazka/{0}/ksiazka".format(self.val) + elif format_type == "litres": + return u"https://www.litres.ru/{0}".format(self.val) + elif format_type == "issn": + return u"https://portal.issn.org/resource/ISSN/{0}".format(self.val) + elif format_type == "isfdb": + return u"http://www.isfdb.org/cgi-bin/pl.cgi?{0}".format(self.val) elif format_type == "url": return u"{0}".format(self.val) else: diff --git a/cps/editbooks.py b/cps/editbooks.py index f5494d36..d07dbe30 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -505,6 +505,8 @@ def upload_single_file(request, book, book_id): requested_file = request.files['btn-upload-format'] # check for empty request if requested_file.filename != '': + if not current_user.role_upload(): + abort(403) if '.' in requested_file.filename: file_ext = requested_file.filename.rsplit('.', 1)[-1].lower() if file_ext not in constants.EXTENSIONS_UPLOAD and '' not in constants.EXTENSIONS_UPLOAD: @@ -555,9 +557,9 @@ def upload_single_file(request, book, book_id): WorkerThread.add(current_user.nickname, TaskUpload( "" + uploadText + "")) - return uploader.process( - saved_filename, *os.path.splitext(requested_file.filename), - rarExecutable=config.config_rarfile_location) + return uploader.process( + saved_filename, *os.path.splitext(requested_file.filename), + rarExecutable=config.config_rarfile_location) def upload_cover(request, book): @@ -565,6 +567,8 @@ def upload_cover(request, book): requested_file = request.files['btn-upload-cover'] # check for empty request if requested_file.filename != '': + if not current_user.role_upload(): + abort(403) ret, message = helper.save_cover(requested_file, book.path) if ret is True: return True @@ -645,13 +649,16 @@ def edit_book(book_id): error = helper.update_dir_stucture(edited_books_id, config.config_calibre_dir, input_authors[0]) if not error: - if to_save["cover_url"]: - result, error = helper.save_cover_from_url(to_save["cover_url"], book.path) - if result is True: - book.has_cover = 1 - modif_date = True - else: - flash(error, category="error") + if "cover_url" in to_save: + if to_save["cover_url"]: + if not current_user.role_upload(): + return "", (403) + result, error = helper.save_cover_from_url(to_save["cover_url"], book.path) + if result is True: + book.has_cover = 1 + modif_date = True + else: + flash(error, category="error") # Add default series_index to book modif_date |= edit_book_series_index(to_save["series_index"], book) diff --git a/cps/isoLanguages.py b/cps/isoLanguages.py index 2a8391f5..4c0aefc3 100644 --- a/cps/isoLanguages.py +++ b/cps/isoLanguages.py @@ -69,6 +69,8 @@ def get_language_codes(locale, language_names, remainder=None): def get_valid_language_codes(locale, language_names, remainder=None): languages = list() + if "" in language_names: + language_names.remove("") for k, v in get_language_names(locale).items(): if k in language_names: languages.append(k) diff --git a/cps/templates/book_edit.html b/cps/templates/book_edit.html index 0936d551..01f6772d 100644 --- a/cps/templates/book_edit.html +++ b/cps/templates/book_edit.html @@ -90,15 +90,19 @@ + {% if g.user.role_upload() or g.user.role_admin()%} + {% if g.allow_upload %}
-
+
-
+
+ {% endif %} + {% endif %}
diff --git a/cps/templates/detail.html b/cps/templates/detail.html index a0943122..260ee93a 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -81,7 +81,7 @@ {% for format in entry.data %} {% if format.format|lower in audioentries %} -
  • {{format.format}}
  • +
  • {{format.format|lower }}
  • {% endif %} {% endfor %} diff --git a/cps/web.py b/cps/web.py index 7f508576..8f363f97 100644 --- a/cps/web.py +++ b/cps/web.py @@ -136,7 +136,8 @@ def add_security_headers(resp): resp.headers['X-Content-Type-Options'] = 'nosniff' resp.headers['X-Frame-Options'] = 'SAMEORIGIN' resp.headers['X-XSS-Protection'] = '1; mode=block' - # resp.headers['Strict-Transport-Security'] = 'max-age=31536000; includeSubDomains' + resp.headers['Strict-Transport-Security'] = 'max-age=31536000; includeSubDomains' + # log.debug(request.full_path) return resp web = Blueprint('web', __name__) @@ -1541,6 +1542,8 @@ def login(): flash(_(u"Wrong Username or Password"), category="error") next_url = request.args.get('next', default=url_for("web.index"), type=str) + if url_for("web.logout") == next_url: + next_url = url_for("web.index") return render_title_template('login.html', title=_(u"login"), next_url=next_url,