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
f2cd93dc
Commit
f2cd93dc
authored
Apr 29, 2021
by
cbartondock
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/janeczku/calibre-web
parents
c2c46369
ed2fa4cd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
89 deletions
+87
-89
admin.py
cps/admin.py
+19
-5
Calibre-Web TestSummary_Linux.html
test/Calibre-Web TestSummary_Linux.html
+68
-84
No files found.
cps/admin.py
View file @
f2cd93dc
...
...
@@ -47,7 +47,7 @@ from .helper import check_valid_domain, send_test_mail, reset_password, generate
valid_email
,
check_username
from
.gdriveutils
import
is_gdrive_ready
,
gdrive_support
from
.render_template
import
render_title_template
,
get_sidebar_config
from
.
import
debug_info
from
.
import
debug_info
,
_BABEL_TRANSLATIONS
try
:
from
functools
import
wraps
...
...
@@ -369,13 +369,13 @@ def edit_list_user(param):
if
"pk[]"
in
vals
:
users
=
all_user
.
filter
(
ub
.
User
.
id
.
in_
(
vals
[
'pk[]'
]))
.
all
()
else
:
return
""
return
_
(
"Malformed request"
),
400
if
'field_index'
in
vals
:
vals
[
'field_index'
]
=
vals
[
'field_index'
][
0
]
if
'value'
in
vals
:
vals
[
'value'
]
=
vals
[
'value'
][
0
]
elif
not
(
'value[]'
in
vals
):
return
""
return
_
(
"Malformed request"
),
400
for
user
in
users
:
try
:
if
param
in
[
'denied_tags'
,
'allowed_tags'
,
'allowed_column_value'
,
'denied_column_value'
]:
...
...
@@ -418,9 +418,23 @@ def edit_list_user(param):
elif
param
==
'locale'
:
if
user
.
name
==
"Guest"
:
raise
Exception
(
_
(
"Guest's Locale is determined automatically and can't be set"
))
user
.
locale
=
vals
[
'value'
]
if
vals
[
'value'
]
in
_BABEL_TRANSLATIONS
:
user
.
locale
=
vals
[
'value'
]
else
:
raise
Exception
(
_
(
"No Valid Locale Given"
))
elif
param
==
'default_language'
:
user
.
default_language
=
vals
[
'value'
]
languages
=
calibre_db
.
session
.
query
(
db
.
Languages
)
\
.
join
(
db
.
books_languages_link
)
\
.
join
(
db
.
Books
)
\
.
filter
(
calibre_db
.
common_filters
())
\
.
group_by
(
text
(
'books_languages_link.lang_code'
))
.
all
()
lang_codes
=
[
lang
.
lang_code
for
lang
in
languages
]
+
[
"all"
]
if
vals
[
'value'
]
in
lang_codes
:
user
.
default_language
=
vals
[
'value'
]
else
:
raise
Exception
(
_
(
"No Valid Book Language Given"
))
else
:
return
_
(
"Parameter not found"
),
400
except
Exception
as
ex
:
log
.
debug_or_exception
(
ex
)
return
str
(
ex
),
400
...
...
test/Calibre-Web TestSummary_Linux.html
View file @
f2cd93dc
This diff is collapsed.
Click to expand it.
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