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
f6ece5fe
Commit
f6ece5fe
authored
Mar 27, 2018
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #448
parent
ea6a957c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
config_edit.html
cps/templates/config_edit.html
+4
-0
ub.py
cps/ub.py
+6
-2
web.py
cps/web.py
+4
-0
No files found.
cps/templates/config_edit.html
View file @
f6ece5fe
...
@@ -203,6 +203,10 @@
...
@@ -203,6 +203,10 @@
<input
type=
"checkbox"
name=
"show_detail_random"
id=
"show_detail_random"
{%
if
content
.
show_detail_random
()
%}
checked
{%
endif
%}
>
<input
type=
"checkbox"
name=
"show_detail_random"
id=
"show_detail_random"
{%
if
content
.
show_detail_random
()
%}
checked
{%
endif
%}
>
<label
for=
"show_detail_random"
>
{{_('Show random books in detail view')}}
</label>
<label
for=
"show_detail_random"
>
{{_('Show random books in detail view')}}
</label>
</div>
</div>
<div
class=
"form-group"
>
<input
type=
"checkbox"
name=
"show_mature_content"
id=
"show_mature_content"
{%
if
content
.
show_mature_content
()
%}
checked
{%
endif
%}
>
<label
for=
"show_mature_content"
>
{{_('Show mature content')}}
</label>
</div>
</div>
</div>
</div>
</div>
<div
class=
"col-sm-12"
>
<div
class=
"col-sm-12"
>
...
...
cps/ub.py
View file @
f6ece5fe
...
@@ -41,7 +41,7 @@ SIDEBAR_BEST_RATED = 128
...
@@ -41,7 +41,7 @@ SIDEBAR_BEST_RATED = 128
SIDEBAR_READ_AND_UNREAD
=
256
SIDEBAR_READ_AND_UNREAD
=
256
SIDEBAR_RECENT
=
512
SIDEBAR_RECENT
=
512
SIDEBAR_SORTED
=
1024
SIDEBAR_SORTED
=
1024
MATURE_CONTENT
=
2048
DEFAULT_PASS
=
"admin123"
DEFAULT_PASS
=
"admin123"
DEFAULT_PORT
=
int
(
os
.
environ
.
get
(
"CALIBRE_PORT"
,
8083
))
DEFAULT_PORT
=
int
(
os
.
environ
.
get
(
"CALIBRE_PORT"
,
8083
))
...
@@ -458,6 +458,10 @@ class Config:
...
@@ -458,6 +458,10 @@ class Config:
return
bool
((
self
.
config_default_show
is
not
None
)
and
return
bool
((
self
.
config_default_show
is
not
None
)
and
(
self
.
config_default_show
&
SIDEBAR_SORTED
==
SIDEBAR_SORTED
))
(
self
.
config_default_show
&
SIDEBAR_SORTED
==
SIDEBAR_SORTED
))
def
show_mature_content
(
self
):
return
bool
((
self
.
config_default_show
is
not
None
)
and
(
self
.
config_default_show
&
MATURE_CONTENT
==
MATURE_CONTENT
))
def
mature_content_tags
(
self
):
def
mature_content_tags
(
self
):
if
sys
.
version_info
>
(
3
,
0
):
# Python3 str, Python2 unicode
if
sys
.
version_info
>
(
3
,
0
):
# Python3 str, Python2 unicode
lstrip
=
str
.
lstrip
lstrip
=
str
.
lstrip
...
@@ -665,7 +669,7 @@ def create_admin_user():
...
@@ -665,7 +669,7 @@ def create_admin_user():
user
.
role
=
ROLE_USER
+
ROLE_ADMIN
+
ROLE_DOWNLOAD
+
ROLE_UPLOAD
+
ROLE_EDIT
+
ROLE_DELETE_BOOKS
+
ROLE_PASSWD
user
.
role
=
ROLE_USER
+
ROLE_ADMIN
+
ROLE_DOWNLOAD
+
ROLE_UPLOAD
+
ROLE_EDIT
+
ROLE_DELETE_BOOKS
+
ROLE_PASSWD
user
.
sidebar_view
=
DETAIL_RANDOM
+
SIDEBAR_LANGUAGE
+
SIDEBAR_SERIES
+
SIDEBAR_CATEGORY
+
SIDEBAR_HOT
+
\
user
.
sidebar_view
=
DETAIL_RANDOM
+
SIDEBAR_LANGUAGE
+
SIDEBAR_SERIES
+
SIDEBAR_CATEGORY
+
SIDEBAR_HOT
+
\
SIDEBAR_RANDOM
+
SIDEBAR_AUTHOR
+
SIDEBAR_BEST_RATED
+
SIDEBAR_READ_AND_UNREAD
+
SIDEBAR_RECENT
+
\
SIDEBAR_RANDOM
+
SIDEBAR_AUTHOR
+
SIDEBAR_BEST_RATED
+
SIDEBAR_READ_AND_UNREAD
+
SIDEBAR_RECENT
+
\
SIDEBAR_SORTED
SIDEBAR_SORTED
+
MATURE_CONTENT
user
.
password
=
generate_password_hash
(
DEFAULT_PASS
)
user
.
password
=
generate_password_hash
(
DEFAULT_PASS
)
...
...
cps/web.py
View file @
f6ece5fe
...
@@ -2601,6 +2601,9 @@ def configuration_helper(origin):
...
@@ -2601,6 +2601,9 @@ def configuration_helper(origin):
content
.
config_default_show
=
content
.
config_default_show
+
ub
.
SIDEBAR_RECENT
content
.
config_default_show
=
content
.
config_default_show
+
ub
.
SIDEBAR_RECENT
if
"show_sorted"
in
to_save
:
if
"show_sorted"
in
to_save
:
content
.
config_default_show
=
content
.
config_default_show
+
ub
.
SIDEBAR_SORTED
content
.
config_default_show
=
content
.
config_default_show
+
ub
.
SIDEBAR_SORTED
if
"show_mature_content"
in
to_save
:
content
.
config_default_show
=
content
.
config_default_show
+
ub
.
MATURE_CONTENT
if
content
.
config_logfile
!=
to_save
[
"config_logfile"
]:
if
content
.
config_logfile
!=
to_save
[
"config_logfile"
]:
# check valid path, only path or file
# check valid path, only path or file
if
os
.
path
.
dirname
(
to_save
[
"config_logfile"
]):
if
os
.
path
.
dirname
(
to_save
[
"config_logfile"
]):
...
@@ -2724,6 +2727,7 @@ def new_user():
...
@@ -2724,6 +2727,7 @@ def new_user():
else
:
else
:
content
.
role
=
config
.
config_default_role
content
.
role
=
config
.
config_default_role
content
.
sidebar_view
=
config
.
config_default_show
content
.
sidebar_view
=
config
.
config_default_show
content
.
mature_content
=
bool
(
config
.
config_default_show
&
ub
.
MATURE_CONTENT
)
return
render_title_template
(
"user_edit.html"
,
new_user
=
1
,
content
=
content
,
translations
=
translations
,
return
render_title_template
(
"user_edit.html"
,
new_user
=
1
,
content
=
content
,
translations
=
translations
,
languages
=
languages
,
title
=
_
(
u"Add new user"
))
languages
=
languages
,
title
=
_
(
u"Add new user"
))
...
...
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