diff --git a/cps/templates/feed.xml b/cps/templates/feed.xml index dd7d58a0..000b1ca5 100644 --- a/cps/templates/feed.xml +++ b/cps/templates/feed.xml @@ -58,11 +58,19 @@ + type="application/epub+zip"/> {% elif format.format|lower == "cbr" %} - type="application/x-cbr"/> - {% else %} - type="application/x-mobipocket-ebook"/> + type="application/x-cbr"/> + {% elif format.format|lower == "mobi" %} + type="application/x-mobipocket-ebook"/> + {% elif format.format|lower == "pdf" %} + type="application/pdf"/> + {% elif format.format|lower == "rtf" %} + type="text/rtf"/> + {% elif format.format|lower == "txt" %} + type="text/plain"/> + {% elif format.format|lower == "doc" %} + type="application/msword"/> {% endif %} {% endfor %} diff --git a/cps/web.py b/cps/web.py index 4f511371..b8e1bd05 100755 --- a/cps/web.py +++ b/cps/web.py @@ -608,25 +608,26 @@ def feed_series(id): return response -@app.route("/opds/download//") +@app.route("/opds/download///") @requires_basic_auth_if_no_ano @download_required def get_opds_download_link(book_id, format): format = format.split(".")[0] book = db.session.query(db.Books).filter(db.Books.id == book_id).first() data = db.session.query(db.Data).filter(db.Data.book == book.id).filter(db.Data.format == format.upper()).first() - helper.update_download(book_id, int(current_user.id)) + if current_user.is_authenticated: + helper.update_download(book_id, int(current_user.id)) author = helper.get_normalized_author(book.author_sort) file_name = book.title if len(author) > 0: file_name = author + '-' + file_name file_name = helper.get_valid_filename(file_name) response = make_response(send_from_directory(os.path.join(config.DB_ROOT, book.path), data.name + "." + format)) - response.headers["Content-Disposition"] = "attachment; filename=%s.%s" % (data.name, format) + response.headers["Content-Disposition"] = "attachment; filename=\"%s.%s\"" % (data.name, format) return response @app.route("/ajax/book/") -@login_required_if_no_ano +@requires_basic_auth_if_no_ano def get_metadata_calibre_companion(uuid): entry = db.session.query(db.Books).filter(db.Books.uuid.like("%"+uuid+"%")).first() if entry is not None :