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
68a36597
Commit
68a36597
authored
Mar 03, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix opds login on python3
parent
de58d0a4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
16 deletions
+104
-16
opds.py
cps/opds.py
+3
-2
plugins.js
cps/static/js/libs/plugins.js
+74
-1
main.js
cps/static/js/main.js
+7
-0
list.html
cps/templates/list.html
+13
-10
osd.xml
cps/templates/osd.xml
+1
-1
web.py
cps/web.py
+6
-2
No files found.
cps/opds.py
View file @
68a36597
...
...
@@ -35,6 +35,7 @@ from sqlalchemy.sql.expression import func
import
helper
from
werkzeug.security
import
check_password_hash
from
werkzeug.datastructures
import
Headers
from
web
import
download_required
try
:
from
urllib.parse
import
quote
except
ImportError
:
...
...
@@ -66,7 +67,7 @@ def feed_index():
def
feed_osd
():
return
render_xml_template
(
'osd.xml'
,
lang
=
'en-EN'
)
@
opds
.
route
(
"/opds/search"
,
defaults
=
{
'query'
:
""
})
@
opds
.
route
(
"/opds/search/<query>"
)
@
requires_basic_auth_if_no_ano
def
feed_cc_search
(
query
):
...
...
@@ -254,7 +255,7 @@ def feed_shelf(book_id):
@
opds
.
route
(
"/opds/download/<book_id>/<book_format>/"
)
@
requires_basic_auth_if_no_ano
#
@download_required
@
download_required
def
get_opds_download_link
(
book_id
,
book_format
):
book_format
=
book_format
.
split
(
"."
)[
0
]
book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book_id
)
.
first
()
...
...
cps/static/js/libs/plugins.js
View file @
68a36597
This diff is collapsed.
Click to expand it.
cps/static/js/main.js
View file @
68a36597
...
...
@@ -94,6 +94,13 @@ $(function() {
layoutMode
:
"fitRows"
});
$
(
".grid"
).
isotope
({
// options
itemSelector
:
".grid-item"
,
layoutMode
:
"fitColumns"
});
var
$loadMore
=
$
(
".load-more .row"
).
infiniteScroll
({
debug
:
false
,
// selector for the paged navigation (it will be hidden)
...
...
cps/templates/list.html
View file @
68a36597
...
...
@@ -2,17 +2,20 @@
{% block body %}
<h1
class=
"{{page}}"
>
{{_(title)}}
</h1>
<div
class=
"container"
>
<div
class=
"col-xs-12 col-sm-6"
>
{% for entry in entries %}
{% if loop.index0 == (loop.length/2)|int and loop.length > 20 %}
</div>
<div
class=
"col-xs-12 col-sm-6"
>
{% endif %}
<div
class=
"row"
>
<div
class=
"col-xs-2 col-sm-2 col-md-1"
align=
"left"
><span
class=
"badge"
>
{{entry.count}}
</span></div>
<div
class=
"col-xs-10 col-sm-10 col-md-11"
><a
id=
"list_{{loop.index0}}"
href=
"{{url_for(folder, book_id=entry[0].id )}}"
>
{{entry[0].name}}
</a></div>
<span
class=
"btn btn-success"
><span
class=
"glyphicon glyphicon-sort-by-alphabet"
></span></span></button>
<button
class=
"btn btn-success"
><span
class=
"glyphicon glyphicon-sort-by-alphabet-alt"
></span></button>
<div
class=
"btn-group"
role=
"group"
>
{% for char in charlist%}
<button
class=
"btn btn-success"
>
{{char.char}}
</button>
{% endfor %}
</div>
<div
class=
"grid"
>
{% for entry in entries %}
<div
class=
"grid-item"
>
<span
class=
"badge"
>
{{entry.count}}
</span>
<a
id=
"list_{{loop.index0}}"
href=
"{{url_for(folder, book_id=entry[0].id )}}"
>
{{entry[0].name}}
</a>
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}
cps/templates/osd.xml
View file @
68a36597
...
...
@@ -6,7 +6,7 @@
<Developer>
Janeczku
</Developer>
<Contact>
https://github.com/janeczku/calibre-web
</Contact>
<Url
type=
"text/html"
template=
"{{url_for('opds.search')}}?query={searchTerms}"
/>
template=
"{{url_for('opds.
feed_cc_
search')}}?query={searchTerms}"
/>
<Url
type=
"application/atom+xml"
template=
"{{url_for('opds.feed_normal_search')}}?query={searchTerms}"
/>
<SyndicationRight>
open
</SyndicationRight>
...
...
cps/web.py
View file @
68a36597
...
...
@@ -141,7 +141,7 @@ def load_user_from_header(header_val):
header_val
=
header_val
.
replace
(
'Basic '
,
''
,
1
)
basic_username
=
basic_password
=
''
try
:
header_val
=
base64
.
b64decode
(
header_val
)
header_val
=
base64
.
b64decode
(
header_val
)
.
decode
(
'utf-8'
)
basic_username
=
header_val
.
split
(
':'
)[
0
]
basic_password
=
header_val
.
split
(
':'
)[
1
]
except
TypeError
:
...
...
@@ -598,9 +598,13 @@ def author_list():
entries
=
db
.
session
.
query
(
db
.
Authors
,
func
.
count
(
'books_authors_link.book'
)
.
label
(
'count'
))
\
.
join
(
db
.
books_authors_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_authors_link.author'
)
.
order_by
(
db
.
Authors
.
sort
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Authors
.
sort
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_authors_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Authors
.
sort
,
1
,
1
)))
.
all
()
# charlist = db.session.query(func.substr(db.Authors.sort,1,1).label('char'),func.count(db.Authors.sort).label('count')).group_by(func.substr(db.Authors.sort,1,1)).all()
for
entry
in
entries
:
entry
.
Authors
.
name
=
entry
.
Authors
.
name
.
replace
(
'|'
,
','
)
return
render_title_template
(
'list.html'
,
entries
=
entries
,
folder
=
'web.author'
,
return
render_title_template
(
'list.html'
,
entries
=
entries
,
folder
=
'web.author'
,
charlist
=
charlist
,
title
=
u"Author list"
,
page
=
"authorlist"
)
else
:
abort
(
404
)
...
...
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