mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 12:30:00 +00:00
Fix proxy cover images to Kobo store
This commit is contained in:
parent
38484624e9
commit
5f0c7737fe
@ -747,9 +747,10 @@ def get_book_cover(book_id, resolution=None):
|
||||
return get_book_cover_internal(book, use_generic_cover_on_failure=True, resolution=resolution)
|
||||
|
||||
|
||||
# Called only by kobo sync -> cover not found should be answered with 404 and not with default cover
|
||||
def get_book_cover_with_uuid(book_uuid, resolution=None):
|
||||
def get_book_cover_with_uuid(book_uuid, resolution=None, none_on_missing=False):
|
||||
book = calibre_db.get_book_by_uuid(book_uuid)
|
||||
if not book and none_on_missing:
|
||||
return # allows kobo.HandleCoverImageRequest to proxy request
|
||||
return get_book_cover_internal(book, use_generic_cover_on_failure=False, resolution=resolution)
|
||||
|
||||
|
||||
|
@ -930,7 +930,10 @@ def get_current_bookmark_response(current_bookmark):
|
||||
@kobo.route("/<book_uuid>/<width>/<height>/<Quality>/<isGreyscale>/image.jpg")
|
||||
@requires_kobo_auth
|
||||
def HandleCoverImageRequest(book_uuid, width, height, Quality, isGreyscale):
|
||||
book_cover = helper.get_book_cover_with_uuid(book_uuid, resolution=COVER_THUMBNAIL_SMALL)
|
||||
book_cover = helper.get_book_cover_with_uuid(
|
||||
book_uuid,
|
||||
resolution=COVER_THUMBNAIL_SMALL,
|
||||
none_on_missing=config.config_kobo_proxy)
|
||||
if not book_cover:
|
||||
if config.config_kobo_proxy:
|
||||
log.debug("Cover for unknown book: %s proxied to kobo" % book_uuid)
|
||||
@ -941,7 +944,7 @@ def HandleCoverImageRequest(book_uuid, width, height, Quality, isGreyscale):
|
||||
else:
|
||||
log.debug("Cover for unknown book: %s requested" % book_uuid)
|
||||
# additional proxy request make no sense, -> direct return
|
||||
return make_response(jsonify({}))
|
||||
return abort(404)
|
||||
log.debug("Cover request received for book %s" % book_uuid)
|
||||
return book_cover
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user