mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 12:30:00 +00:00
Merge remote-tracking branch 'kobo/feature/use-kobo-specific-download-urls' into Develop
This commit is contained in:
commit
ba1c1c87c4
14
cps/kobo.py
14
cps/kobo.py
@ -47,9 +47,10 @@ from sqlalchemy.exc import StatementError
|
||||
import requests
|
||||
|
||||
from . import config, logger, kobo_auth, db, calibre_db, helper, shelf as shelf_lib, ub
|
||||
from .helper import get_download_link
|
||||
from .services import SyncToken as SyncToken
|
||||
from .web import download_required
|
||||
from .kobo_auth import requires_kobo_auth
|
||||
from .kobo_auth import requires_kobo_auth, get_auth_token
|
||||
|
||||
KOBO_FORMATS = {"KEPUB": ["KEPUB"], "EPUB": ["EPUB3", "EPUB"]}
|
||||
KOBO_STOREAPI_URL = "https://storeapi.kobo.com"
|
||||
@ -274,10 +275,11 @@ def get_download_url_for_book(book, book_format):
|
||||
else:
|
||||
host = request.host
|
||||
|
||||
return "{url_scheme}://{url_base}:{url_port}/download/{book_id}/{book_format}".format(
|
||||
return "{url_scheme}://{url_base}:{url_port}/kobo/{auth_token}/download/{book_id}/{book_format}".format(
|
||||
url_scheme=request.scheme,
|
||||
url_base=host,
|
||||
url_port=config.config_external_port,
|
||||
auth_token=get_auth_token(),
|
||||
book_id=book.id,
|
||||
book_format=book_format.lower()
|
||||
)
|
||||
@ -980,6 +982,14 @@ def HandleInitRequest():
|
||||
return response
|
||||
|
||||
|
||||
@kobo.route("/download/<book_id>/<book_format>")
|
||||
@requires_kobo_auth
|
||||
@download_required
|
||||
def download_book(book_id, book_format):
|
||||
|
||||
return get_download_link(book_id, book_format, "kobo")
|
||||
|
||||
|
||||
def NATIVE_KOBO_RESOURCES():
|
||||
return {
|
||||
"account_page": "https://secure.kobobooks.com/profile",
|
||||
|
Loading…
Reference in New Issue
Block a user