Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
ae33aee3
Commit
ae33aee3
authored
Oct 31, 2020
by
Julian Naydichev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When serving a download URL via KoboSync, use a URL that is specific to Kobo
parent
5701e08d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
kobo.py
cps/kobo.py
+12
-2
No files found.
cps/kobo.py
View file @
ae33aee3
...
...
@@ -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"
...
...
@@ -270,10 +271,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
()
)
...
...
@@ -976,6 +978,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"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment