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
ba1c1c87
Commit
ba1c1c87
authored
Nov 20, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'kobo/feature/use-kobo-specific-download-urls' into Develop
parents
ceefba27
ae33aee3
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 @
ba1c1c87
...
@@ -47,9 +47,10 @@ from sqlalchemy.exc import StatementError
...
@@ -47,9 +47,10 @@ from sqlalchemy.exc import StatementError
import
requests
import
requests
from
.
import
config
,
logger
,
kobo_auth
,
db
,
calibre_db
,
helper
,
shelf
as
shelf_lib
,
ub
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
.services
import
SyncToken
as
SyncToken
from
.web
import
download_required
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_FORMATS
=
{
"KEPUB"
:
[
"KEPUB"
],
"EPUB"
:
[
"EPUB3"
,
"EPUB"
]}
KOBO_STOREAPI_URL
=
"https://storeapi.kobo.com"
KOBO_STOREAPI_URL
=
"https://storeapi.kobo.com"
...
@@ -274,10 +275,11 @@ def get_download_url_for_book(book, book_format):
...
@@ -274,10 +275,11 @@ def get_download_url_for_book(book, book_format):
else
:
else
:
host
=
request
.
host
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_scheme
=
request
.
scheme
,
url_base
=
host
,
url_base
=
host
,
url_port
=
config
.
config_external_port
,
url_port
=
config
.
config_external_port
,
auth_token
=
get_auth_token
(),
book_id
=
book
.
id
,
book_id
=
book
.
id
,
book_format
=
book_format
.
lower
()
book_format
=
book_format
.
lower
()
)
)
...
@@ -980,6 +982,14 @@ def HandleInitRequest():
...
@@ -980,6 +982,14 @@ def HandleInitRequest():
return
response
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
():
def
NATIVE_KOBO_RESOURCES
():
return
{
return
{
"account_page"
:
"https://secure.kobobooks.com/profile"
,
"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