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
2d928186
Commit
2d928186
authored
Apr 27, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cosmetics
parent
6682b1ce
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
418 additions
and
394 deletions
+418
-394
admin.py
cps/admin.py
+28
-29
db.py
cps/db.py
+1
-1
helper.py
cps/helper.py
+3
-8
kobo.py
cps/kobo.py
+4
-6
kobo_auth.py
cps/kobo_auth.py
+1
-2
kthoom.css
cps/static/css/kthoom.css
+13
-15
listen.css
cps/static/css/listen.css
+91
-91
main.css
cps/static/css/main.css
+55
-98
popup.css
cps/static/css/popup.css
+12
-15
style.css
cps/static/css/style.css
+189
-87
upload.css
cps/static/css/upload.css
+6
-6
filter_list.js
cps/static/js/filter_list.js
+3
-3
table.js
cps/static/js/table.js
+8
-8
ub.py
cps/ub.py
+3
-8
web.py
cps/web.py
+1
-6
worker.py
cps/worker.py
+0
-11
No files found.
cps/admin.py
View file @
2d928186
...
@@ -253,23 +253,23 @@ def list_domain(allow):
...
@@ -253,23 +253,23 @@ def list_domain(allow):
response
.
headers
[
"Content-Type"
]
=
"application/json; charset=utf-8"
response
.
headers
[
"Content-Type"
]
=
"application/json; charset=utf-8"
return
response
return
response
@
admi
.
route
(
"/ajax/editrestriction/<int:type>"
,
methods
=
[
'POST'
])
@
admi
.
route
(
"/ajax/editrestriction/<int:
res_
type>"
,
methods
=
[
'POST'
])
@
login_required
@
login_required
@
admin_required
@
admin_required
def
edit_restriction
(
type
):
def
edit_restriction
(
res_
type
):
element
=
request
.
form
.
to_dict
()
element
=
request
.
form
.
to_dict
()
if
element
[
'id'
]
.
startswith
(
'a'
):
if
element
[
'id'
]
.
startswith
(
'a'
):
if
type
==
0
:
# Tags as template
if
res_
type
==
0
:
# Tags as template
elementlist
=
config
.
list_allowed_tags
()
elementlist
=
config
.
list_allowed_tags
()
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
config
.
config_allowed_tags
=
','
.
join
(
elementlist
)
config
.
config_allowed_tags
=
','
.
join
(
elementlist
)
config
.
save
()
config
.
save
()
if
type
==
1
:
# CustomC
if
res_
type
==
1
:
# CustomC
elementlist
=
config
.
list_allowed_column_values
()
elementlist
=
config
.
list_allowed_column_values
()
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
config
.
config_allowed_column_value
=
','
.
join
(
elementlist
)
config
.
config_allowed_column_value
=
','
.
join
(
elementlist
)
config
.
save
()
config
.
save
()
if
type
==
2
:
# Tags per user
if
res_
type
==
2
:
# Tags per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
if
usr_id
.
isdigit
()
==
True
:
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
...
@@ -279,7 +279,7 @@ def edit_restriction(type):
...
@@ -279,7 +279,7 @@ def edit_restriction(type):
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
usr
.
allowed_tags
=
','
.
join
(
elementlist
)
usr
.
allowed_tags
=
','
.
join
(
elementlist
)
ub
.
session
.
commit
()
ub
.
session
.
commit
()
if
type
==
3
:
# CColumn per user
if
res_
type
==
3
:
# CColumn per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
if
usr_id
.
isdigit
()
==
True
:
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
...
@@ -290,18 +290,17 @@ def edit_restriction(type):
...
@@ -290,18 +290,17 @@ def edit_restriction(type):
usr
.
allowed_column_value
=
','
.
join
(
elementlist
)
usr
.
allowed_column_value
=
','
.
join
(
elementlist
)
ub
.
session
.
commit
()
ub
.
session
.
commit
()
if
element
[
'id'
]
.
startswith
(
'd'
):
if
element
[
'id'
]
.
startswith
(
'd'
):
if
type
==
0
:
# Tags as template
if
res_
type
==
0
:
# Tags as template
elementlist
=
config
.
list_denied_tags
()
elementlist
=
config
.
list_denied_tags
()
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
config
.
config_denied_tags
=
','
.
join
(
elementlist
)
config
.
config_denied_tags
=
','
.
join
(
elementlist
)
config
.
save
()
config
.
save
()
if
type
==
1
:
# CustomC
if
res_
type
==
1
:
# CustomC
elementlist
=
config
.
list_denied_column_values
()
elementlist
=
config
.
list_denied_column_values
()
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
config
.
config_denied_column_value
=
','
.
join
(
elementlist
)
config
.
config_denied_column_value
=
','
.
join
(
elementlist
)
config
.
save
()
config
.
save
()
pass
if
res_type
==
2
:
# Tags per user
if
type
==
2
:
# Tags per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
if
usr_id
.
isdigit
()
==
True
:
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
...
@@ -311,7 +310,7 @@ def edit_restriction(type):
...
@@ -311,7 +310,7 @@ def edit_restriction(type):
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
elementlist
[
int
(
element
[
'id'
][
1
:])]
=
element
[
'Element'
]
usr
.
denied_tags
=
','
.
join
(
elementlist
)
usr
.
denied_tags
=
','
.
join
(
elementlist
)
ub
.
session
.
commit
()
ub
.
session
.
commit
()
if
type
==
3
:
# CColumn per user
if
res_
type
==
3
:
# CColumn per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
if
usr_id
.
isdigit
()
==
True
:
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
...
@@ -339,26 +338,26 @@ def restriction_deletion(element, list_func):
...
@@ -339,26 +338,26 @@ def restriction_deletion(element, list_func):
return
','
.
join
(
elementlist
)
return
','
.
join
(
elementlist
)
@
admi
.
route
(
"/ajax/addrestriction/<int:type>"
,
methods
=
[
'POST'
])
@
admi
.
route
(
"/ajax/addrestriction/<int:
res_
type>"
,
methods
=
[
'POST'
])
@
login_required
@
login_required
@
admin_required
@
admin_required
def
add_restriction
(
type
):
def
add_restriction
(
res_
type
):
element
=
request
.
form
.
to_dict
()
element
=
request
.
form
.
to_dict
()
if
type
==
0
:
# Tags as template
if
res_
type
==
0
:
# Tags as template
if
'submit_allow'
in
element
:
if
'submit_allow'
in
element
:
config
.
config_allowed_tags
=
restriction_addition
(
element
,
config
.
list_allowed_tags
)
config
.
config_allowed_tags
=
restriction_addition
(
element
,
config
.
list_allowed_tags
)
config
.
save
()
config
.
save
()
elif
'submit_deny'
in
element
:
elif
'submit_deny'
in
element
:
config
.
config_denied_tags
=
restriction_addition
(
element
,
config
.
list_denied_tags
)
config
.
config_denied_tags
=
restriction_addition
(
element
,
config
.
list_denied_tags
)
config
.
save
()
config
.
save
()
if
type
==
1
:
# CCustom as template
if
res_
type
==
1
:
# CCustom as template
if
'submit_allow'
in
element
:
if
'submit_allow'
in
element
:
config
.
config_allowed_column_value
=
restriction_addition
(
element
,
config
.
list_denied_column_values
)
config
.
config_allowed_column_value
=
restriction_addition
(
element
,
config
.
list_denied_column_values
)
config
.
save
()
config
.
save
()
elif
'submit_deny'
in
element
:
elif
'submit_deny'
in
element
:
config
.
config_denied_column_value
=
restriction_addition
(
element
,
config
.
list_allowed_column_values
)
config
.
config_denied_column_value
=
restriction_addition
(
element
,
config
.
list_allowed_column_values
)
config
.
save
()
config
.
save
()
if
type
==
2
:
# Tags per user
if
res_
type
==
2
:
# Tags per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
if
usr_id
.
isdigit
()
==
True
:
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
...
@@ -370,7 +369,7 @@ def add_restriction(type):
...
@@ -370,7 +369,7 @@ def add_restriction(type):
elif
'submit_deny'
in
element
:
elif
'submit_deny'
in
element
:
usr
.
denied_tags
=
restriction_addition
(
element
,
usr
.
list_denied_tags
)
usr
.
denied_tags
=
restriction_addition
(
element
,
usr
.
list_denied_tags
)
ub
.
session
.
commit
()
ub
.
session
.
commit
()
if
type
==
3
:
# CustomC per user
if
res_
type
==
3
:
# CustomC per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
if
usr_id
.
isdigit
()
==
True
:
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
...
@@ -384,26 +383,26 @@ def add_restriction(type):
...
@@ -384,26 +383,26 @@ def add_restriction(type):
ub
.
session
.
commit
()
ub
.
session
.
commit
()
return
""
return
""
@
admi
.
route
(
"/ajax/deleterestriction/<int:type>"
,
methods
=
[
'POST'
])
@
admi
.
route
(
"/ajax/deleterestriction/<int:
res_
type>"
,
methods
=
[
'POST'
])
@
login_required
@
login_required
@
admin_required
@
admin_required
def
delete_restriction
(
type
):
def
delete_restriction
(
res_
type
):
element
=
request
.
form
.
to_dict
()
element
=
request
.
form
.
to_dict
()
if
type
==
0
:
# Tags as template
if
res_
type
==
0
:
# Tags as template
if
element
[
'id'
]
.
startswith
(
'a'
):
if
element
[
'id'
]
.
startswith
(
'a'
):
config
.
config_allowed_tags
=
restriction_deletion
(
element
,
config
.
list_allowed_tags
)
config
.
config_allowed_tags
=
restriction_deletion
(
element
,
config
.
list_allowed_tags
)
config
.
save
()
config
.
save
()
elif
element
[
'id'
]
.
startswith
(
'd'
):
elif
element
[
'id'
]
.
startswith
(
'd'
):
config
.
config_denied_tags
=
restriction_deletion
(
element
,
config
.
list_denied_tags
)
config
.
config_denied_tags
=
restriction_deletion
(
element
,
config
.
list_denied_tags
)
config
.
save
()
config
.
save
()
elif
type
==
1
:
# CustomC as template
elif
res_
type
==
1
:
# CustomC as template
if
element
[
'id'
]
.
startswith
(
'a'
):
if
element
[
'id'
]
.
startswith
(
'a'
):
config
.
config_allowed_column_value
=
restriction_deletion
(
element
,
config
.
list_allowed_column_values
)
config
.
config_allowed_column_value
=
restriction_deletion
(
element
,
config
.
list_allowed_column_values
)
config
.
save
()
config
.
save
()
elif
element
[
'id'
]
.
startswith
(
'd'
):
elif
element
[
'id'
]
.
startswith
(
'd'
):
config
.
config_denied_column_value
=
restriction_deletion
(
element
,
config
.
list_denied_column_values
)
config
.
config_denied_column_value
=
restriction_deletion
(
element
,
config
.
list_denied_column_values
)
config
.
save
()
config
.
save
()
elif
type
==
2
:
# Tags per user
elif
res_
type
==
2
:
# Tags per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
if
usr_id
.
isdigit
()
==
True
:
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
...
@@ -415,7 +414,7 @@ def delete_restriction(type):
...
@@ -415,7 +414,7 @@ def delete_restriction(type):
elif
element
[
'id'
]
.
startswith
(
'd'
):
elif
element
[
'id'
]
.
startswith
(
'd'
):
usr
.
denied_tags
=
restriction_deletion
(
element
,
usr
.
list_denied_tags
)
usr
.
denied_tags
=
restriction_deletion
(
element
,
usr
.
list_denied_tags
)
ub
.
session
.
commit
()
ub
.
session
.
commit
()
elif
type
==
3
:
# Columns per user
elif
res_
type
==
3
:
# Columns per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
# select current user if admins are editing their own rights
if
usr_id
.
isdigit
()
==
True
:
# select current user if admins are editing their own rights
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
int
(
usr_id
))
.
first
()
...
@@ -431,23 +430,23 @@ def delete_restriction(type):
...
@@ -431,23 +430,23 @@ def delete_restriction(type):
#@admi.route("/ajax/listrestriction/<int:type>/<int:user_id>", defaults={'user_id': '0'})
#@admi.route("/ajax/listrestriction/<int:type>/<int:user_id>", defaults={'user_id': '0'})
@
admi
.
route
(
"/ajax/listrestriction/<int:type>"
)
@
admi
.
route
(
"/ajax/listrestriction/<int:
res_
type>"
)
@
login_required
@
login_required
@
admin_required
@
admin_required
def
list_restriction
(
type
):
def
list_restriction
(
res_
type
):
if
type
==
0
:
# Tags as template
if
res_
type
==
0
:
# Tags as template
restrict
=
[{
'Element'
:
x
,
'type'
:
_
(
'Deny'
),
'id'
:
'd'
+
str
(
i
)
}
restrict
=
[{
'Element'
:
x
,
'type'
:
_
(
'Deny'
),
'id'
:
'd'
+
str
(
i
)
}
for
i
,
x
in
enumerate
(
config
.
list_denied_tags
())
if
x
!=
''
]
for
i
,
x
in
enumerate
(
config
.
list_denied_tags
())
if
x
!=
''
]
allow
=
[{
'Element'
:
x
,
'type'
:
_
(
'Allow'
),
'id'
:
'a'
+
str
(
i
)
}
allow
=
[{
'Element'
:
x
,
'type'
:
_
(
'Allow'
),
'id'
:
'a'
+
str
(
i
)
}
for
i
,
x
in
enumerate
(
config
.
list_allowed_tags
())
if
x
!=
''
]
for
i
,
x
in
enumerate
(
config
.
list_allowed_tags
())
if
x
!=
''
]
json_dumps
=
restrict
+
allow
json_dumps
=
restrict
+
allow
elif
type
==
1
:
# CustomC as template
elif
res_
type
==
1
:
# CustomC as template
restrict
=
[{
'Element'
:
x
,
'type'
:
_
(
'Deny'
),
'id'
:
'd'
+
str
(
i
)
}
restrict
=
[{
'Element'
:
x
,
'type'
:
_
(
'Deny'
),
'id'
:
'd'
+
str
(
i
)
}
for
i
,
x
in
enumerate
(
config
.
list_denied_column_values
())
if
x
!=
''
]
for
i
,
x
in
enumerate
(
config
.
list_denied_column_values
())
if
x
!=
''
]
allow
=
[{
'Element'
:
x
,
'type'
:
_
(
'Allow'
),
'id'
:
'a'
+
str
(
i
)
}
allow
=
[{
'Element'
:
x
,
'type'
:
_
(
'Allow'
),
'id'
:
'a'
+
str
(
i
)
}
for
i
,
x
in
enumerate
(
config
.
list_allowed_column_values
())
if
x
!=
''
]
for
i
,
x
in
enumerate
(
config
.
list_allowed_column_values
())
if
x
!=
''
]
json_dumps
=
restrict
+
allow
json_dumps
=
restrict
+
allow
elif
type
==
2
:
# Tags per user
elif
res_
type
==
2
:
# Tags per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
if
usr_id
.
isdigit
()
==
True
:
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
usr_id
)
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
usr_id
)
.
first
()
...
@@ -458,7 +457,7 @@ def list_restriction(type):
...
@@ -458,7 +457,7 @@ def list_restriction(type):
allow
=
[{
'Element'
:
x
,
'type'
:
_
(
'Allow'
),
'id'
:
'a'
+
str
(
i
)
}
allow
=
[{
'Element'
:
x
,
'type'
:
_
(
'Allow'
),
'id'
:
'a'
+
str
(
i
)
}
for
i
,
x
in
enumerate
(
usr
.
list_allowed_tags
())
if
x
!=
''
]
for
i
,
x
in
enumerate
(
usr
.
list_allowed_tags
())
if
x
!=
''
]
json_dumps
=
restrict
+
allow
json_dumps
=
restrict
+
allow
elif
type
==
3
:
# CustomC per user
elif
res_
type
==
3
:
# CustomC per user
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
usr_id
=
os
.
path
.
split
(
request
.
referrer
)[
-
1
]
if
usr_id
.
isdigit
()
==
True
:
if
usr_id
.
isdigit
()
==
True
:
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
usr_id
)
.
first
()
usr
=
ub
.
session
.
query
(
ub
.
User
)
.
filter
(
ub
.
User
.
id
==
usr_id
)
.
first
()
...
...
cps/db.py
View file @
2d928186
...
@@ -418,7 +418,7 @@ def dispose():
...
@@ -418,7 +418,7 @@ def dispose():
except
:
pass
except
:
pass
if
old_session
.
bind
:
if
old_session
.
bind
:
try
:
old_session
.
bind
.
dispose
()
try
:
old_session
.
bind
.
dispose
()
except
:
pass
except
Exception
:
pass
for
attr
in
list
(
Books
.
__dict__
.
keys
()):
for
attr
in
list
(
Books
.
__dict__
.
keys
()):
if
attr
.
startswith
(
"custom_column_"
):
if
attr
.
startswith
(
"custom_column_"
):
...
...
cps/helper.py
View file @
2d928186
...
@@ -151,8 +151,6 @@ def check_send_to_kindle(entry):
...
@@ -151,8 +151,6 @@ def check_send_to_kindle(entry):
bookformats
.
append
({
'format'
:
'Pdf'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Pdf'
)})
bookformats
.
append
({
'format'
:
'Pdf'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Pdf'
)})
if
'AZW'
in
ele
.
format
:
if
'AZW'
in
ele
.
format
:
bookformats
.
append
({
'format'
:
'Azw'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Azw'
)})
bookformats
.
append
({
'format'
:
'Azw'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Azw'
)})
'''if 'AZW3' in ele.format:
bookformats.append({'format':'Azw3','convert':0,'text':_('Send
%(format)
s to Kindle',format='Azw3')})'''
else
:
else
:
formats
=
list
()
formats
=
list
()
for
ele
in
iter
(
entry
.
data
):
for
ele
in
iter
(
entry
.
data
):
...
@@ -514,12 +512,9 @@ def save_cover_from_filestorage(filepath, saved_filename, img):
...
@@ -514,12 +512,9 @@ def save_cover_from_filestorage(filepath, saved_filename, img):
return
False
,
_
(
u"Failed to create path for cover"
)
return
False
,
_
(
u"Failed to create path for cover"
)
try
:
try
:
img
.
save
(
os
.
path
.
join
(
filepath
,
saved_filename
))
img
.
save
(
os
.
path
.
join
(
filepath
,
saved_filename
))
except
IOError
:
except
(
IOError
,
OSError
):
log
.
error
(
u"Cover-file is not a valid image file"
)
log
.
error
(
u"Cover-file is not a valid image file, or could not be stored"
)
return
False
,
_
(
u"Cover-file is not a valid image file"
)
return
False
,
_
(
u"Cover-file is not a valid image file, or could not be stored"
)
except
OSError
:
log
.
error
(
u"Failed to store cover-file"
)
return
False
,
_
(
u"Failed to store cover-file"
)
return
True
,
None
return
True
,
None
...
...
cps/kobo.py
View file @
2d928186
...
@@ -21,7 +21,6 @@ import sys
...
@@ -21,7 +21,6 @@ import sys
import
base64
import
base64
import
os
import
os
import
uuid
import
uuid
from
datetime
import
datetime
from
time
import
gmtime
,
strftime
from
time
import
gmtime
,
strftime
try
:
try
:
from
urllib
import
unquote
from
urllib
import
unquote
...
@@ -35,10 +34,9 @@ from flask import (
...
@@ -35,10 +34,9 @@ from flask import (
jsonify
,
jsonify
,
current_app
,
current_app
,
url_for
,
url_for
,
redirect
,
redirect
abort
)
)
from
flask_login
import
login_required
from
werkzeug.datastructures
import
Headers
from
werkzeug.datastructures
import
Headers
from
sqlalchemy
import
func
from
sqlalchemy
import
func
import
requests
import
requests
...
@@ -59,8 +57,8 @@ log = logger.create()
...
@@ -59,8 +57,8 @@ log = logger.create()
def
get_store_url_for_current_request
():
def
get_store_url_for_current_request
():
# Programmatically modify the current url to point to the official Kobo store
# Programmatically modify the current url to point to the official Kobo store
base
,
sep
,
request_path_with_auth_token
=
request
.
full_path
.
rpartition
(
"/kobo/"
)
__
,
__
,
request_path_with_auth_token
=
request
.
full_path
.
rpartition
(
"/kobo/"
)
auth_token
,
sep
,
request_path
=
request_path_with_auth_token
.
rstrip
(
"?"
)
.
partition
(
__
,
__
,
request_path
=
request_path_with_auth_token
.
rstrip
(
"?"
)
.
partition
(
"/"
"/"
)
)
return
KOBO_STOREAPI_URL
+
"/"
+
request_path
return
KOBO_STOREAPI_URL
+
"/"
+
request_path
...
...
cps/kobo_auth.py
View file @
2d928186
...
@@ -62,7 +62,6 @@ particular calls to non-Kobo specific endpoints such as the CalibreWeb book down
...
@@ -62,7 +62,6 @@ particular calls to non-Kobo specific endpoints such as the CalibreWeb book down
from
binascii
import
hexlify
from
binascii
import
hexlify
from
datetime
import
datetime
from
datetime
import
datetime
from
os
import
urandom
from
os
import
urandom
import
os
from
flask
import
g
,
Blueprint
,
url_for
,
abort
,
request
from
flask
import
g
,
Blueprint
,
url_for
,
abort
,
request
from
flask_login
import
login_user
,
login_required
from
flask_login
import
login_user
,
login_required
...
@@ -82,7 +81,7 @@ log = logger.create()
...
@@ -82,7 +81,7 @@ log = logger.create()
def
register_url_value_preprocessor
(
kobo
):
def
register_url_value_preprocessor
(
kobo
):
@
kobo
.
url_value_preprocessor
@
kobo
.
url_value_preprocessor
def
pop_auth_token
(
endpoint
,
values
):
def
pop_auth_token
(
__
,
values
):
g
.
auth_token
=
values
.
pop
(
"auth_token"
)
g
.
auth_token
=
values
.
pop
(
"auth_token"
)
...
...
cps/static/css/kthoom.css
View file @
2d928186
...
@@ -4,7 +4,7 @@ body {
...
@@ -4,7 +4,7 @@ body {
overflow-y
:
auto
;
overflow-y
:
auto
;
color
:
white
;
color
:
white
;
font-family
:
sans-serif
;
font-family
:
sans-serif
;
margin
:
0
px
;
margin
:
0
;
}
}
#main
{
#main
{
...
@@ -13,7 +13,7 @@ body {
...
@@ -13,7 +13,7 @@ body {
}
}
.view
{
.view
{
padding-top
:
0px
;
padding-top
:
0
;
}
}
#sidebar
a
,
#sidebar
a
,
...
@@ -34,18 +34,18 @@ body {
...
@@ -34,18 +34,18 @@ body {
cursor
:
pointer
;
cursor
:
pointer
;
padding
:
4px
;
padding
:
4px
;
transition
:
all
.2s
ease
;
transition
:
all
0
.2s
ease
;
}
}
#sidebar
a
:hover
,
#sidebar
a
:hover
,
#sidebar
a
:focus
{
#sidebar
a
:focus
{
outline
:
none
;
outline
:
none
;
box-shadow
:
0
px
2px
8px
1px
black
;
box-shadow
:
0
2px
8px
1px
black
;
}
}
#sidebar
a
.active
,
#sidebar
a
.active
,
#sidebar
a
.active
img
+
span
{
#sidebar
a
.active
img
+
span
{
background-color
:
#45B29D
;
background-color
:
#45B29D
;
}
}
#sidebar
li
img
{
#sidebar
li
img
{
...
@@ -79,7 +79,6 @@ body {
...
@@ -79,7 +79,6 @@ body {
font-size
:
10px
;
font-size
:
10px
;
line-height
:
10px
;
line-height
:
10px
;
text-align
:
right
;
text-align
:
right
;
transition
:
min-height
150ms
ease-in-out
;
transition
:
min-height
150ms
ease-in-out
;
}
}
...
@@ -92,18 +91,17 @@ body {
...
@@ -92,18 +91,17 @@ body {
top
:
0
;
top
:
0
;
left
:
0
;
left
:
0
;
bottom
:
0
;
bottom
:
0
;
transition
:
width
150ms
ease-in-out
;
transition
:
width
150ms
ease-in-out
;
}
}
#progress
.bar-load
{
#progress
.bar-load
{
color
:
#000
;
color
:
#000
;
background-color
:
#
CCC
;
background-color
:
#
ccc
;
}
}
#progress
.bar-read
{
#progress
.bar-read
{
color
:
#
FFF
;
color
:
#
fff
;
background-color
:
#45
B29D
;
background-color
:
#45
b29d
;
}
}
#progress
.text
{
#progress
.text
{
...
@@ -152,7 +150,8 @@ body {
...
@@ -152,7 +150,8 @@ body {
max-width
:
70%
;
max-width
:
70%
;
}
}
th
,
td
{
th
,
td
{
padding
:
5px
;
padding
:
5px
;
}
}
...
@@ -206,18 +205,17 @@ th {
...
@@ -206,18 +205,17 @@ th {
}
}
.dark-theme
#titlebar
{
.dark-theme
#titlebar
{
color
:
#
DDD
;
color
:
#
ddd
;
}
}
.dark-theme
#titlebar
a
:active
{
.dark-theme
#titlebar
a
:active
{
color
:
#
FFF
;
color
:
#
fff
;
}
}
.dark-theme
#progress
.bar-read
{
.dark-theme
#progress
.bar-read
{
background-color
:
red
;
background-color
:
red
;
}
}
.dark-theme
.overlay
{
.dark-theme
.overlay
{
background-color
:
rgba
(
0
,
0
,
0
,
0.8
);
background-color
:
rgba
(
0
,
0
,
0
,
0.8
);
}
}
cps/static/css/listen.css
View file @
2d928186
.sm2-bar-ui
{
.sm2-bar-ui
{
font-size
:
20px
;
font-size
:
20px
;
}
}
.sm2-bar-ui.compact
{
.sm2-bar-ui.compact
{
max-width
:
90%
;
max-width
:
90%
;
}
}
.sm2-progress
.sm2-progress-ball
{
.sm2-progress
.sm2-progress-ball
{
width
:
.5333em
;
width
:
0
.5333em
;
height
:
1.9333em
;
height
:
1.9333em
;
border-radius
:
0em
;
border-radius
:
0em
;
}
}
.sm2-progress
.sm2-progress-track
{
.sm2-progress
.sm2-progress-track
{
height
:
0.15em
;
height
:
0.15em
;
background
:
white
;
background
:
white
;
}
}
.sm2-bar-ui
.sm2-main-controls
,
.sm2-bar-ui
.sm2-main-controls
,
.sm2-bar-ui
.sm2-playlist-drawer
{
.sm2-bar-ui
.sm2-playlist-drawer
{
background-color
:
transparent
;
background-color
:
transparent
;
}
}
.sm2-bar-ui
.sm2-inline-texture
{
.sm2-bar-ui
.sm2-inline-texture
{
background
:
transparent
;
background
:
transparent
;
}
}
.rating
.glyphicon-star
{
.rating
.glyphicon-star
{
color
:
gray
;
color
:
gray
;
}
}
.rating
.glyphicon-star.good
{
.rating
.glyphicon-star.good
{
color
:
white
;
color
:
white
;
}
}
body
{
body
{
overflow
:
hidden
;
overflow
:
hidden
;
background
:
#272B30
;
background
:
#272B30
;
color
:
#aaa
;
color
:
#aaa
;
}
}
#main
{
#main
{
position
:
absolute
;
position
:
absolute
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
}
}
#area
{
#area
{
width
:
80%
;
width
:
80%
;
height
:
80%
;
height
:
80%
;
margin
:
5%
auto
;
margin
:
5%
auto
;
max-width
:
1250px
;
max-width
:
1250px
;
}
}
#area
iframe
{
#area
iframe
{
border
:
none
;
border
:
none
;
}
}
#prev
{
#prev
{
left
:
40px
;
left
:
40px
;
}
}
#next
{
#next
{
right
:
40px
;
right
:
40px
;
}
}
xmp
,
xmp
,
pre
,
pre
,
plaintext
{
plaintext
{
display
:
block
;
display
:
block
;
font-family
:
-moz-fixed
;
font-family
:
-moz-fixed
;
white-space
:
pre
;
white-space
:
pre
;
margin
:
1em
0
;
margin
:
1em
0
;
}
}
#area
{
#area
{
overflow
:
hidden
;
overflow
:
hidden
;
}
}
pre
{
pre
{
white-space
:
pre-wrap
;
white-space
:
pre-wrap
;
word-wrap
:
break-word
;
word-wrap
:
break-word
;
font-family
:
-moz-fixed
;
font-family
:
-moz-fixed
;
column-count
:
2
;
column-count
:
2
;
-webkit-columns
:
2
;
-webkit-columns
:
2
;
-moz-columns
:
2
;
-moz-columns
:
2
;
column-gap
:
20px
;
column-gap
:
20px
;
-moz-column-gap
:
20px
;
-moz-column-gap
:
20px
;
-webkit-column-gap
:
20px
;
-webkit-column-gap
:
20px
;
position
:
relative
;
position
:
relative
;
}
}
cps/static/css/main.css
View file @
2d928186
@font-face
{
@font-face
{
font-family
:
'fontello'
;
font-family
:
'fontello'
;
src
:
url('fonts/fontello.eot?60518104')
;
src
:
url('fonts/fontello.eot?60518104')
;
src
:
url('fonts/fontello.eot?60518104#iefix')
format
(
'embedded-opentype'
),
src
:
url('fonts/fontello.woff?60518104')
format
(
'woff'
),
url('fonts/fontello.eot?60518104#iefix')
format
(
'embedded-opentype'
),
url('fonts/fontello.ttf?60518104')
format
(
'truetype'
),
url('fonts/fontello.woff?60518104')
format
(
'woff'
),
url('fonts/fontello.svg?60518104#fontello')
format
(
'svg'
);
url('fonts/fontello.ttf?60518104')
format
(
'truetype'
),
url('fonts/fontello.svg?60518104#fontello')
format
(
'svg'
);
font-weight
:
normal
;
font-weight
:
normal
;
font-style
:
normal
;
font-style
:
normal
;
}
}
...
@@ -22,17 +23,15 @@ body {
...
@@ -22,17 +23,15 @@ body {
border-radius
:
5px
;
border-radius
:
5px
;
background
:
#fff
;
background
:
#fff
;
overflow
:
hidden
;
overflow
:
hidden
;
-webkit-transition
:
-webkit-transform
.4s
,
width
.2s
;
-webkit-transition
:
-webkit-transform
0.4s
,
width
0.2s
;
-moz-transition
:
-webkit-transform
.4s
,
width
.2s
;
-moz-transition
:
-webkit-transform
0.4s
,
width
0.2s
;
-ms-transition
:
-webkit-transform
.4s
,
width
.2s
;
-ms-transition
:
-webkit-transform
0.4s
,
width
0.2s
;
-moz-box-shadow
:
inset
0
0
50px
rgba
(
0
,
0
,
0
,
0.1
);
-moz-box-shadow
:
inset
0
0
50px
rgba
(
0
,
0
,
0
,
.1
);
-webkit-box-shadow
:
inset
0
0
50px
rgba
(
0
,
0
,
0
,
0.1
);
-webkit-box-shadow
:
inset
0
0
50px
rgba
(
0
,
0
,
0
,
.1
);
-ms-box-shadow
:
inset
0
0
50px
rgba
(
0
,
0
,
0
,
0.1
);
-ms-box-shadow
:
inset
0
0
50px
rgba
(
0
,
0
,
0
,
.1
);
box-shadow
:
inset
0
0
50px
rgba
(
0
,
0
,
0
,
0.1
);
box-shadow
:
inset
0
0
50px
rgba
(
0
,
0
,
0
,
.1
);
}
}
#titlebar
{
#titlebar
{
height
:
8%
;
height
:
8%
;
min-height
:
20px
;
min-height
:
20px
;
...
@@ -42,11 +41,11 @@ body {
...
@@ -42,11 +41,11 @@ body {
color
:
#4f4f4f
;
color
:
#4f4f4f
;
font-weight
:
100
;
font-weight
:
100
;
font-family
:
Georgia
,
"Times New Roman"
,
Times
,
serif
;
font-family
:
Georgia
,
"Times New Roman"
,
Times
,
serif
;
opacity
:
.5
;
opacity
:
0
.5
;
text-align
:
center
;
text-align
:
center
;
-webkit-transition
:
opacity
.5s
;
-webkit-transition
:
opacity
0
.5s
;
-moz-transition
:
opacity
.5s
;
-moz-transition
:
opacity
0
.5s
;
-ms-transition
:
opacity
.5s
;
-ms-transition
:
opacity
0
.5s
;
z-index
:
10
;
z-index
:
10
;
}
}
...
@@ -60,7 +59,7 @@ body {
...
@@ -60,7 +59,7 @@ body {
line-height
:
20px
;
line-height
:
20px
;
overflow
:
hidden
;
overflow
:
hidden
;
display
:
inline-block
;
display
:
inline-block
;
opacity
:
.5
;
opacity
:
0
.5
;
padding
:
4px
;
padding
:
4px
;
border-radius
:
4px
;
border-radius
:
4px
;
}
}
...
@@ -70,35 +69,27 @@ body {
...
@@ -70,35 +69,27 @@ body {
}
}
#titlebar
a
:hover
{
#titlebar
a
:hover
{
opacity
:
.8
;
opacity
:
0
.8
;
border
:
1px
rgba
(
0
,
0
,
0
,
.2
)
solid
;
border
:
1px
rgba
(
0
,
0
,
0
,
0
.2
)
solid
;
padding
:
3px
;
padding
:
3px
;
}
}
#titlebar
a
:active
{
#titlebar
a
:active
{
opacity
:
1
;
opacity
:
1
;
color
:
rgba
(
0
,
0
,
0
,
.6
);
color
:
rgba
(
0
,
0
,
0
,
0.6
);
/* margin: 1px -1px -1px 1px; */
-moz-box-shadow
:
inset
0
0
6px
rgba
(
155
,
155
,
155
,
0.8
);
-moz-box-shadow
:
inset
0
0
6px
rgba
(
155
,
155
,
155
,
.8
);
-webkit-box-shadow
:
inset
0
0
6px
rgba
(
155
,
155
,
155
,
0.8
);
-webkit-box-shadow
:
inset
0
0
6px
rgba
(
155
,
155
,
155
,
.8
);
-ms-box-shadow
:
inset
0
0
6px
rgba
(
155
,
155
,
155
,
0.8
);
-ms-box-shadow
:
inset
0
0
6px
rgba
(
155
,
155
,
155
,
.8
);
box-shadow
:
inset
0
0
6px
rgba
(
155
,
155
,
155
,
0.8
);
box-shadow
:
inset
0
0
6px
rgba
(
155
,
155
,
155
,
.8
);
}
#book-title
{
font-weight
:
600
;
}
}
#title-seperator
{
#book-title
{
font-weight
:
600
;
}
display
:
none
;
#title-seperator
{
display
:
none
;
}
}
#viewer
{
#viewer
{
width
:
80%
;
width
:
80%
;
height
:
80%
;
height
:
80%
;
/* margin-left: 10%; */
margin
:
0
auto
;
margin
:
0
auto
;
/* max-width: 1250px; */
z-index
:
2
;
z-index
:
2
;
position
:
relative
;
position
:
relative
;
overflow
:
hidden
;
overflow
:
hidden
;
...
@@ -108,14 +99,14 @@ body {
...
@@ -108,14 +99,14 @@ body {
border
:
none
;
border
:
none
;
}
}
#left
,
#prev
{
#left
,
#prev
{
left
:
40px
;
left
:
40px
;
padding-right
:
80px
;
padding-right
:
80px
;
}
}
#right
,
#next
{
#right
,
#next
{
right
:
40px
;
right
:
40px
;
padding-left
:
80px
;
padding-left
:
80px
;
}
}
.arrow
{
.arrow
{
...
@@ -148,24 +139,20 @@ body {
...
@@ -148,24 +139,20 @@ body {
#sidebar
{
#sidebar
{
background
:
#6b6b6b
;
background
:
#6b6b6b
;
position
:
absolute
;
position
:
absolute
;
/* left: -260px; */
/* -webkit-transform: translate(-260px, 0);
-moz-transform: translate(-260px, 0); */
top
:
0
;
top
:
0
;
min-width
:
300px
;
min-width
:
300px
;
width
:
25%
;
width
:
25%
;
height
:
100%
;
height
:
100%
;
-webkit-transition
:
-webkit-transform
.5s
;
-webkit-transition
:
-webkit-transform
0.5s
;
-moz-transition
:
-moz-transform
.5s
;
-moz-transition
:
-moz-transform
0.5s
;
-ms-transition
:
-moz-transform
.5s
;
-ms-transition
:
-moz-transform
0.5s
;
overflow
:
hidden
;
overflow
:
hidden
;
}
}
#sidebar
.open
{
#sidebar
.open
{
/* left: 0; */
/* left: 0; */
/* -webkit-transform: translate(0, 0);
/* -webkit-transform: translate(0, 0);
-moz-transform: translate(0, 0); */
-moz-transform: translate(0, 0); */
}
}
#main
.closed
{
#main
.closed
{
...
@@ -203,19 +190,13 @@ body {
...
@@ -203,19 +190,13 @@ body {
float
:
left
;
float
:
left
;
}
}
/* #opener #slider {
width: 25px;
} */
#metainfo
{
#metainfo
{
display
:
inline-block
;
display
:
inline-block
;
text-align
:
center
;
text-align
:
center
;
max-width
:
80%
;
max-width
:
80%
;
}
}
#title-controls
{
#title-controls
{
float
:
right
;
}
float
:
right
;
}
#panels
a
{
#panels
a
{
visibility
:
hidden
;
visibility
:
hidden
;
...
@@ -227,13 +208,8 @@ body {
...
@@ -227,13 +208,8 @@ body {
margin-left
:
6px
;
margin-left
:
6px
;
}
}
#panels
a
::before
{
#panels
a
::before
{
visibility
:
visible
;
}
visibility
:
visible
;
#panels
a
:hover
{
color
:
#AAA
;
}
}
#panels
a
:hover
{
color
:
#AAA
;
}
#panels
a
:active
{
#panels
a
:active
{
color
:
#AAA
;
color
:
#AAA
;
...
@@ -250,28 +226,11 @@ body {
...
@@ -250,28 +226,11 @@ body {
float
:
left
;
float
:
left
;
margin-left
:
10px
;
margin-left
:
10px
;
margin-top
:
-1px
;
margin-top
:
-1px
;
/*
border-radius: 5px;
background: #9b9b9b;
float: left;
margin-left: 5px;
margin-top: -5px;
padding: 3px 10px;
color: #000;
border: none;
outline: none; */
}
}
input
::-webkit-input-placeholder
{
input
::-webkit-input-placeholder
{
color
:
#454545
;
}
color
:
#454545
;
input
:-moz-placeholder
{
color
:
#454545
;
}
}
input
:-ms-placeholder
{
color
:
#454545
;
}
input
:-moz-placeholder
{
color
:
#454545
;
}
input
:-ms-placeholder
{
color
:
#454545
;
}
#divider
{
#divider
{
position
:
absolute
;
position
:
absolute
;
...
@@ -312,8 +271,6 @@ input:-ms-placeholder {
...
@@ -312,8 +271,6 @@ input:-ms-placeholder {
-ms-transition
:
visibility
0
ease
.5s
;
-ms-transition
:
visibility
0
ease
.5s
;
}
}
#sidebar
.open
#tocView
,
#sidebar
.open
#tocView
,
#sidebar
.open
#bookmarksView
{
#sidebar
.open
#bookmarksView
{
overflow-y
:
auto
;
overflow-y
:
auto
;
...
@@ -505,30 +462,30 @@ input:-ms-placeholder {
...
@@ -505,30 +462,30 @@ input:-ms-placeholder {
}
}
#settingsPanel
{
#settingsPanel
{
display
:
none
;
display
:
none
;
}
}
#settingsPanel
h3
{
#settingsPanel
h3
{
color
:
#f1f1f1
;
color
:
#f1f1f1
;
font-family
:
Georgia
,
"Times New Roman"
,
Times
,
serif
;
font-family
:
Georgia
,
"Times New Roman"
,
Times
,
serif
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
#settingsPanel
ul
{
#settingsPanel
ul
{
margin-top
:
60px
;
margin-top
:
60px
;
list-style-type
:
none
;
list-style-type
:
none
;
}
}
#settingsPanel
li
{
#settingsPanel
li
{
font-size
:
1em
;
font-size
:
1em
;
color
:
#f1f1f1
;
color
:
#f1f1f1
;
}
}
#settingsPanel
.xsmall
{
font-size
:
x-small
;
}
#settingsPanel
.xsmall
{
font-size
:
x-small
;
}
#settingsPanel
.small
{
font-size
:
small
;
}
#settingsPanel
.small
{
font-size
:
small
;
}
#settingsPanel
.medium
{
font-size
:
medium
;
}
#settingsPanel
.medium
{
font-size
:
medium
;
}
#settingsPanel
.large
{
font-size
:
large
;
}
#settingsPanel
.large
{
font-size
:
large
;
}
#settingsPanel
.xlarge
{
font-size
:
x-large
;
}
#settingsPanel
.xlarge
{
font-size
:
x-large
;
}
.highlight
{
background-color
:
yellow
}
.highlight
{
background-color
:
yellow
}
...
@@ -827,7 +784,7 @@ and (orientation : landscape)
...
@@ -827,7 +784,7 @@ and (orientation : landscape)
display
:
inline-block
;
display
:
inline-block
;
text-decoration
:
inherit
;
text-decoration
:
inherit
;
width
:
1em
;
width
:
1em
;
margin-right
:
.2em
;
margin-right
:
0
.2em
;
text-align
:
center
;
text-align
:
center
;
/* opacity: .8; */
/* opacity: .8; */
...
...
cps/static/css/popup.css
View file @
2d928186
/* http://davidwalsh.name/css-tooltips */
/* http://davidwalsh.name/css-tooltips */
/* base CSS element */
/* base CSS element */
.popup
{
.popup
{
background
:
#eee
;
background
:
#eee
;
...
@@ -9,10 +10,8 @@
...
@@ -9,10 +10,8 @@
position
:
fixed
;
position
:
fixed
;
max-width
:
300px
;
max-width
:
300px
;
font-size
:
12px
;
font-size
:
12px
;
display
:
none
;
display
:
none
;
margin-left
:
2px
;
margin-left
:
2px
;
margin-top
:
30px
;
margin-top
:
30px
;
}
}
...
@@ -38,7 +37,7 @@
...
@@ -38,7 +37,7 @@
}
}
/* below */
/* below */
.popup
:before
{
.popup
:
:
before
{
position
:
absolute
;
position
:
absolute
;
display
:
inline-block
;
display
:
inline-block
;
border-bottom
:
10px
solid
#eee
;
border-bottom
:
10px
solid
#eee
;
...
@@ -51,7 +50,7 @@
...
@@ -51,7 +50,7 @@
content
:
''
;
content
:
''
;
}
}
.popup
:after
{
.popup
:
:
after
{
position
:
absolute
;
position
:
absolute
;
display
:
inline-block
;
display
:
inline-block
;
border-bottom
:
9px
solid
#eee
;
border-bottom
:
9px
solid
#eee
;
...
@@ -64,33 +63,31 @@
...
@@ -64,33 +63,31 @@
}
}
/* above */
/* above */
.popup.above
:before
{
.popup.above
:
:
before
{
border-bottom
:
none
;
border-bottom
:
none
;
border-top
:
10px
solid
#eee
;
border-top
:
10px
solid
#eee
;
border-top-color
:
rgba
(
0
,
0
,
0
,
0.2
);
border-top-color
:
rgba
(
0
,
0
,
0
,
0.2
);
top
:
100%
;
top
:
100%
;
}
}
.popup.above
:after
{
.popup.above
:
:
after
{
border-bottom
:
none
;
border-bottom
:
none
;
border-top
:
9px
solid
#eee
;
border-top
:
9px
solid
#eee
;
top
:
100%
;
top
:
100%
;
}
}
.popup.left
:before
,
.popup.left
::before
,
.popup.left
:after
.popup.left
::after
{
{
left
:
20px
;
left
:
20px
;
}
}
.popup.right
:before
,
.popup.right
::before
,
.popup.right
:after
.popup.right
::after
{
{
left
:
auto
;
left
:
auto
;
right
:
20px
;
right
:
20px
;
}
}
.popup.show
,
.popup.
show
,
.popup.
on
{
.popup.on
{
display
:
block
;
display
:
block
;
}
}
\ No newline at end of file
cps/static/css/style.css
View file @
2d928186
This diff is collapsed.
Click to expand it.
cps/static/css/upload.css
View file @
2d928186
@media
(
min-device-width
:
768px
)
{
@media
(
min-device-width
:
768px
)
{
.upload-modal-dialog
{
.upload-modal-dialog
{
position
:
absolute
;
position
:
absolute
;
top
:
45%
;
top
:
45%
;
left
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
)
!important
;
transform
:
translate
(
-50%
,
-50%
)
!important
;
}
}
}
}
cps/static/js/filter_list.js
View file @
2d928186
...
@@ -45,7 +45,7 @@ $("#sort_name").click(function() {
...
@@ -45,7 +45,7 @@ $("#sort_name").click(function() {
});*/
});*/
// Find count of middle element
// Find count of middle element
if
(
count
>
20
)
{
if
(
count
>
20
)
{
var
middle
=
parseInt
(
count
/
2
)
+
(
count
%
2
);
var
middle
=
parseInt
(
count
/
2
,
10
)
+
(
count
%
2
);
// search for the middle of all visibe elements
// search for the middle of all visibe elements
$
(
".row"
).
each
(
function
()
{
$
(
".row"
).
each
(
function
()
{
index
++
;
index
++
;
...
@@ -146,7 +146,7 @@ $("#all").click(function() {
...
@@ -146,7 +146,7 @@ $("#all").click(function() {
// Find count of middle element
// Find count of middle element
var
listItems
=
$
(
"#list"
).
children
(
".row"
);
var
listItems
=
$
(
"#list"
).
children
(
".row"
);
var
listlength
=
listItems
.
length
;
var
listlength
=
listItems
.
length
;
var
middle
=
parseInt
(
listlength
/
2
)
+
(
listlength
%
2
);
var
middle
=
parseInt
(
listlength
/
2
,
10
)
+
(
listlength
%
2
);
// go through all elements and make them visible
// go through all elements and make them visible
listItems
.
each
(
function
()
{
listItems
.
each
(
function
()
{
$
(
this
).
show
();
$
(
this
).
show
();
...
@@ -178,7 +178,7 @@ $(".char").click(function() {
...
@@ -178,7 +178,7 @@ $(".char").click(function() {
});
});
if
(
count
>
20
)
{
if
(
count
>
20
)
{
// Find count of middle element
// Find count of middle element
var
middle
=
parseInt
(
count
/
2
)
+
(
count
%
2
);
var
middle
=
parseInt
(
count
/
2
,
10
)
+
(
count
%
2
);
// search for the middle of all visibe elements
// search for the middle of all visibe elements
$
(
".row"
).
each
(
function
()
{
$
(
".row"
).
each
(
function
()
{
index
++
;
index
++
;
...
...
cps/static/js/table.js
View file @
2d928186
...
@@ -112,7 +112,7 @@ $(function() {
...
@@ -112,7 +112,7 @@ $(function() {
return
""
;
return
""
;
},
},
url
:
path
+
"/../../ajax/listrestriction/"
+
type
,
url
:
path
+
"/../../ajax/listrestriction/"
+
type
,
rowStyle
:
function
(
row
,
index
)
{
rowStyle
:
function
(
row
)
{
// console.log('Reihe :' + row + " Index :" + index);
// console.log('Reihe :' + row + " Index :" + index);
if
(
row
.
id
.
charAt
(
0
)
===
"a"
)
{
if
(
row
.
id
.
charAt
(
0
)
===
"a"
)
{
return
{
classes
:
"bg-primary"
};
return
{
classes
:
"bg-primary"
};
...
@@ -120,15 +120,15 @@ $(function() {
...
@@ -120,15 +120,15 @@ $(function() {
return
{
classes
:
"bg-dark-danger"
};
return
{
classes
:
"bg-dark-danger"
};
}
}
},
},
onClickCell
:
function
(
field
,
value
,
row
,
$element
)
{
onClickCell
:
function
(
field
,
value
,
row
)
{
if
(
field
==
3
)
{
if
(
field
==
=
3
)
{
$
.
ajax
({
$
.
ajax
({
type
:
"Post"
,
type
:
"Post"
,
data
:
"id="
+
row
.
id
+
"&type="
+
row
.
type
+
"&Element="
+
row
.
Element
,
data
:
"id="
+
row
.
id
+
"&type="
+
row
.
type
+
"&Element="
+
row
.
Element
,
url
:
path
+
"/../../ajax/deleterestriction/"
+
type
,
url
:
path
+
"/../../ajax/deleterestriction/"
+
type
,
async
:
true
,
async
:
true
,
timeout
:
900
,
timeout
:
900
,
success
:
function
(
data
)
{
success
:
function
()
{
$
.
ajax
({
$
.
ajax
({
method
:
"get"
,
method
:
"get"
,
url
:
path
+
"/../../ajax/listrestriction/"
+
type
,
url
:
path
+
"/../../ajax/listrestriction/"
+
type
,
...
@@ -145,14 +145,14 @@ $(function() {
...
@@ -145,14 +145,14 @@ $(function() {
striped
:
false
striped
:
false
});
});
$
(
"#restrict-elements-table"
).
removeClass
(
"table-hover"
);
$
(
"#restrict-elements-table"
).
removeClass
(
"table-hover"
);
$
(
"#restrict-elements-table"
).
on
(
"editable-save.bs.table"
,
function
(
e
,
field
,
row
,
old
,
$el
)
{
$
(
"#restrict-elements-table"
).
on
(
"editable-save.bs.table"
,
function
(
e
,
field
,
row
)
{
$
.
ajax
({
$
.
ajax
({
url
:
path
+
"/../../ajax/editrestriction/"
+
type
,
url
:
path
+
"/../../ajax/editrestriction/"
+
type
,
type
:
"Post"
,
type
:
"Post"
,
data
:
row
data
:
row
});
});
});
});
$
(
"[id^=submit_]"
).
click
(
function
(
event
)
{
$
(
"[id^=submit_]"
).
click
(
function
()
{
$
(
this
)[
0
].
blur
();
$
(
this
)[
0
].
blur
();
$
.
ajax
({
$
.
ajax
({
url
:
path
+
"/../../ajax/addrestriction/"
+
type
,
url
:
path
+
"/../../ajax/addrestriction/"
+
type
,
...
@@ -196,7 +196,7 @@ $(function() {
...
@@ -196,7 +196,7 @@ $(function() {
});
});
/* Function for deleting domain restrictions */
/* Function for deleting domain restrictions */
function
TableActions
(
value
,
row
,
index
)
{
function
TableActions
(
value
,
row
)
{
return
[
return
[
"<a class=
\"
danger remove
\"
data-toggle=
\"
modal
\"
data-target=
\"
#DeleteDomain
\"
data-domain-id=
\"
"
+
row
.
id
"<a class=
\"
danger remove
\"
data-toggle=
\"
modal
\"
data-target=
\"
#DeleteDomain
\"
data-domain-id=
\"
"
+
row
.
id
+
"
\"
title=
\"
Remove
\"
>"
,
+
"
\"
title=
\"
Remove
\"
>"
,
...
@@ -206,7 +206,7 @@ function TableActions (value, row, index) {
...
@@ -206,7 +206,7 @@ function TableActions (value, row, index) {
}
}
/* Function for deleting domain restrictions */
/* Function for deleting domain restrictions */
function
RestrictionActions
(
value
,
row
,
index
)
{
function
RestrictionActions
(
value
,
row
)
{
return
[
return
[
"<div class=
\"
danger remove
\"
data-restriction-id=
\"
"
+
row
.
id
+
"
\"
title=
\"
Remove
\"
>"
,
"<div class=
\"
danger remove
\"
data-restriction-id=
\"
"
+
row
.
id
+
"
\"
title=
\"
Remove
\"
>"
,
"<i class=
\"
glyphicon glyphicon-trash
\"
></i>"
,
"<i class=
\"
glyphicon glyphicon-trash
\"
></i>"
,
...
...
cps/ub.py
View file @
2d928186
...
@@ -415,11 +415,6 @@ def migrate_Database(session):
...
@@ -415,11 +415,6 @@ def migrate_Database(session):
'side_autor'
:
constants
.
SIDEBAR_AUTHOR
,
'side_autor'
:
constants
.
SIDEBAR_AUTHOR
,
'detail_random'
:
constants
.
DETAIL_RANDOM
})
'detail_random'
:
constants
.
DETAIL_RANDOM
})
session
.
commit
()
session
.
commit
()
'''try:
session.query(exists().where(User.mature_content)).scalar()
except exc.OperationalError:
conn = engine.connect()
conn.execute("ALTER TABLE user ADD column `mature_content` INTEGER DEFAULT 1")'''
try
:
try
:
session
.
query
(
exists
()
.
where
(
User
.
denied_tags
))
.
scalar
()
session
.
query
(
exists
()
.
where
(
User
.
denied_tags
))
.
scalar
()
except
exc
.
OperationalError
:
# Database is not compatible, some columns are missing
except
exc
.
OperationalError
:
# Database is not compatible, some columns are missing
...
@@ -497,7 +492,7 @@ def create_anonymous_user(session):
...
@@ -497,7 +492,7 @@ def create_anonymous_user(session):
session
.
add
(
user
)
session
.
add
(
user
)
try
:
try
:
session
.
commit
()
session
.
commit
()
except
Exception
as
e
:
except
Exception
:
session
.
rollback
()
session
.
rollback
()
...
@@ -544,7 +539,7 @@ def dispose():
...
@@ -544,7 +539,7 @@ def dispose():
session
=
None
session
=
None
if
old_session
:
if
old_session
:
try
:
old_session
.
close
()
try
:
old_session
.
close
()
except
:
pass
except
Exception
:
pass
if
old_session
.
bind
:
if
old_session
.
bind
:
try
:
old_session
.
bind
.
dispose
()
try
:
old_session
.
bind
.
dispose
()
except
:
pass
except
Exception
:
pass
cps/web.py
View file @
2d928186
...
@@ -38,7 +38,7 @@ from flask import render_template, request, redirect, send_from_directory, make_
...
@@ -38,7 +38,7 @@ from flask import render_template, request, redirect, send_from_directory, make_
from
flask_babel
import
gettext
as
_
from
flask_babel
import
gettext
as
_
from
flask_login
import
login_user
,
logout_user
,
login_required
,
current_user
from
flask_login
import
login_user
,
logout_user
,
login_required
,
current_user
from
sqlalchemy.exc
import
IntegrityError
from
sqlalchemy.exc
import
IntegrityError
from
sqlalchemy.sql.expression
import
text
,
func
,
true
,
false
,
not_
,
and_
,
exists
,
or_
from
sqlalchemy.sql.expression
import
text
,
func
,
true
,
false
,
not_
,
and_
,
or_
from
werkzeug.exceptions
import
default_exceptions
from
werkzeug.exceptions
import
default_exceptions
from
werkzeug.datastructures
import
Headers
from
werkzeug.datastructures
import
Headers
from
werkzeug.security
import
generate_password_hash
,
check_password_hash
from
werkzeug.security
import
generate_password_hash
,
check_password_hash
...
@@ -1274,16 +1274,11 @@ def login():
...
@@ -1274,16 +1274,11 @@ def login():
log
.
info
(
'Login failed for user "
%
s" IP-adress:
%
s'
,
form
[
'username'
],
ipAdress
)
log
.
info
(
'Login failed for user "
%
s" IP-adress:
%
s'
,
form
[
'username'
],
ipAdress
)
flash
(
_
(
u"Wrong Username or Password"
),
category
=
"error"
)
flash
(
_
(
u"Wrong Username or Password"
),
category
=
"error"
)
if
feature_support
[
'oauth'
]:
oauth_status
=
get_oauth_status
()
else
:
oauth_status
=
None
next_url
=
url_for
(
'web.index'
)
next_url
=
url_for
(
'web.index'
)
return
render_title_template
(
'login.html'
,
return
render_title_template
(
'login.html'
,
title
=
_
(
u"login"
),
title
=
_
(
u"login"
),
next_url
=
next_url
,
next_url
=
next_url
,
config
=
config
,
config
=
config
,
# oauth_status=oauth_status,
oauth_check
=
oauth_check
,
oauth_check
=
oauth_check
,
mail
=
config
.
get_mail_server_configured
(),
page
=
"login"
)
mail
=
config
.
get_mail_server_configured
(),
page
=
"login"
)
...
...
cps/worker.py
View file @
2d928186
...
@@ -300,11 +300,6 @@ class WorkerThread(threading.Thread):
...
@@ -300,11 +300,6 @@ class WorkerThread(threading.Thread):
# check which converter to use kindlegen is "1"
# check which converter to use kindlegen is "1"
if
format_old_ext
==
'.epub'
and
format_new_ext
==
'.mobi'
:
if
format_old_ext
==
'.epub'
and
format_new_ext
==
'.mobi'
:
if
config
.
config_ebookconverter
==
1
:
if
config
.
config_ebookconverter
==
1
:
'''if os.name == 'nt':
command = config.config_converterpath + u' "' + file_path + u'.epub"'
if sys.version_info < (3, 0):
command = command.encode(sys.getfilesystemencoding())
else:'''
command
=
[
config
.
config_converterpath
,
file_path
+
u'.epub'
]
command
=
[
config
.
config_converterpath
,
file_path
+
u'.epub'
]
quotes
=
[
1
]
quotes
=
[
1
]
if
config
.
config_ebookconverter
==
2
:
if
config
.
config_ebookconverter
==
2
:
...
@@ -314,12 +309,6 @@ class WorkerThread(threading.Thread):
...
@@ -314,12 +309,6 @@ class WorkerThread(threading.Thread):
# windows py 3.x no encode and as string with quotes empty element for parameters is okay
# windows py 3.x no encode and as string with quotes empty element for parameters is okay
# separate handling for windows and linux
# separate handling for windows and linux
quotes
=
[
1
,
2
]
quotes
=
[
1
,
2
]
'''if os.name == 'nt':
command = config.config_converterpath + u' "' + file_path + format_old_ext + u'" "' +
\
file_path + format_new_ext + u'" ' + config.config_calibre
if sys.version_info < (3, 0):
command = command.encode(sys.getfilesystemencoding())
else:'''
command
=
[
config
.
config_converterpath
,
(
file_path
+
format_old_ext
),
command
=
[
config
.
config_converterpath
,
(
file_path
+
format_old_ext
),
(
file_path
+
format_new_ext
)]
(
file_path
+
format_new_ext
)]
quotes_index
=
3
quotes_index
=
3
...
...
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