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
4e8b814e
Commit
4e8b814e
authored
Feb 26, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix download URL for IPV6
parent
6becca17
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
kobo.py
cps/kobo.py
+17
-8
No files found.
cps/kobo.py
View file @
4e8b814e
...
...
@@ -214,13 +214,22 @@ def HandleMetadataRequest(book_uuid):
def
get_download_url_for_book
(
book
,
book_format
):
if
not
current_app
.
wsgi_app
.
is_proxied
:
return
"{url_scheme}://{url_base}:{url_port}/download/{book_id}/{book_format}"
.
format
(
url_scheme
=
request
.
environ
[
'wsgi.url_scheme'
],
url_base
=
request
.
environ
[
'SERVER_NAME'
],
url_port
=
config
.
config_port
,
book_id
=
book
.
id
,
book_format
=
book_format
.
lower
()
)
if
request
.
environ
[
'SERVER_NAME'
]
!=
'::'
:
return
"{url_scheme}://{url_base}:{url_port}/download/{book_id}/{book_format}"
.
format
(
url_scheme
=
request
.
environ
[
'wsgi.url_scheme'
],
url_base
=
request
.
environ
[
'SERVER_NAME'
],
url_port
=
config
.
config_port
,
book_id
=
book
.
id
,
book_format
=
book_format
.
lower
()
)
else
:
return
"{url_scheme}://{url_base}:{url_port}/download/{book_id}/{book_format}"
.
format
(
url_scheme
=
request
.
environ
[
'wsgi.url_scheme'
],
url_base
=
request
.
host
,
# ToDo: both server ??
url_port
=
config
.
config_port
,
book_id
=
book
.
id
,
book_format
=
book_format
.
lower
()
)
else
:
return
url_for
(
"web.download_link"
,
...
...
@@ -377,7 +386,7 @@ def TopLevelEndpoint():
@
kobo
.
route
(
"/v1/library/tags/<shelf_name>"
,
methods
=
[
"POST"
])
@
kobo
.
route
(
"/v1/library/tags/<tag_id>"
,
methods
=
[
"DELETE"
])
def
HandleUnimplementedRequest
(
dummy
=
None
,
book_uuid
=
None
,
shelf_name
=
None
,
tag_id
=
None
):
log
.
debug
(
"
Alternative Request received:"
)
log
.
debug
(
"
Unimplemented Library Request received:
%
s"
,
request
.
base_url
)
return
redirect_or_proxy_request
()
...
...
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