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
54079b36
Commit
54079b36
authored
Dec 01, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1095 (epub viewer not working if only viewer rule wa sapplied)
parent
f8a99c60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
read.html
cps/templates/read.html
+1
-1
web.py
cps/web.py
+6
-5
No files found.
cps/templates/read.html
View file @
54079b36
...
...
@@ -86,7 +86,7 @@
filePath
:
"{{ url_for('static', filename='js/libs/') }}"
,
cssPath
:
"{{ url_for('static', filename='css/') }}"
,
bookmarkUrl
:
"{{ url_for('web.bookmark', book_id=bookid, book_format='EPUB') }}"
,
bookUrl
:
"{{ url_for('web.
download_lin
k', book_id=bookid, book_format='epub', anyname='file.epub') }}"
,
bookUrl
:
"{{ url_for('web.
serve_boo
k', book_id=bookid, book_format='epub', anyname='file.epub') }}"
,
bookmark
:
"{{ bookmark.bookmark_key if bookmark != None }}"
,
useBookmarks
:
"{{ g.user.is_authenticated | tojson }}"
};
...
...
cps/web.py
View file @
54079b36
...
...
@@ -992,10 +992,11 @@ def get_cover(book_id):
return
get_book_cover
(
book_id
)
@
web
.
route
(
"/show/<book_id>/<book_format>"
)
@
web
.
route
(
"/show/<int:book_id>/<book_format>"
,
defaults
=
{
'anyname'
:
'None'
})
@
web
.
route
(
"/show/<int:book_id>/<book_format>/<anyname>"
)
@
login_required_if_no_ano
@
viewer_required
def
serve_book
(
book_id
,
book_format
):
def
serve_book
(
book_id
,
book_format
,
anyname
):
book_format
=
book_format
.
split
(
"."
)[
0
]
book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book_id
)
.
first
()
data
=
db
.
session
.
query
(
db
.
Data
)
.
filter
(
db
.
Data
.
book
==
book
.
id
)
.
filter
(
db
.
Data
.
format
==
book_format
.
upper
())
\
...
...
@@ -1010,11 +1011,11 @@ def serve_book(book_id, book_format):
return
send_from_directory
(
os
.
path
.
join
(
config
.
config_calibre_dir
,
book
.
path
),
data
.
name
+
"."
+
book_format
)
@
web
.
route
(
"/download/<int:book_id>/<book_format>"
,
defaults
=
{
'anyname'
:
'None'
})
@
web
.
route
(
"/download/<int:book_id>/<book_format>
/<anyname>
"
)
#
@web.route("/download/<int:book_id>/<book_format>", defaults={'anyname': 'None'})
@
web
.
route
(
"/download/<int:book_id>/<book_format>"
)
@
login_required_if_no_ano
@
download_required
def
download_link
(
book_id
,
book_format
,
anyname
):
def
download_link
(
book_id
,
book_format
):
return
get_download_link
(
book_id
,
book_format
)
...
...
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