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
308fd554
Commit
308fd554
authored
May 09, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1141 (Setting for file size limit on email)
parent
fefb44e6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
21 deletions
+24
-21
admin.py
cps/admin.py
+5
-4
config_sql.py
cps/config_sql.py
+1
-1
helper.py
cps/helper.py
+15
-13
email_edit.html
cps/templates/email_edit.html
+3
-3
No files found.
cps/admin.py
View file @
308fd554
...
...
@@ -485,8 +485,8 @@ def basic_configuration():
return
_configuration_result
()
def
_config_int
(
to_save
,
x
):
return
config
.
set_from_dictionary
(
to_save
,
x
,
int
)
def
_config_int
(
to_save
,
x
,
func
=
int
):
return
config
.
set_from_dictionary
(
to_save
,
x
,
func
)
def
_config_checkbox
(
to_save
,
x
):
...
...
@@ -694,7 +694,7 @@ def _configuration_update_helper():
if
not
db
.
setup_db
(
config
):
return
_configuration_result
(
_
(
'DB Location is not Valid, Please Enter Correct Path'
),
gdriveError
)
if
not
os
.
access
(
os
.
path
.
join
(
config
.
config_calibre_dir
,
"metadata.db"
),
os
.
W_OK
):
flash
(
_
(
u"DB is not
w
riteable"
),
category
=
"warning"
)
flash
(
_
(
u"DB is not
W
riteable"
),
category
=
"warning"
)
config
.
save
()
flash
(
_
(
u"Calibre-Web configuration updated"
),
category
=
"success"
)
...
...
@@ -901,7 +901,7 @@ def edit_mailsettings():
@
admin_required
def
update_mailsettings
():
to_save
=
request
.
form
.
to_dict
()
log
.
debug
(
"update_mailsettings
%
r"
,
to_save
)
#
log.debug("update_mailsettings %r", to_save)
_config_string
(
to_save
,
"mail_server"
)
_config_int
(
to_save
,
"mail_port"
)
...
...
@@ -909,6 +909,7 @@ def update_mailsettings():
_config_string
(
to_save
,
"mail_login"
)
_config_string
(
to_save
,
"mail_password"
)
_config_string
(
to_save
,
"mail_from"
)
_config_int
(
to_save
,
"mail_size"
,
lambda
y
:
int
(
y
)
*
1024
*
1024
)
config
.
save
()
if
to_save
.
get
(
"test"
):
...
...
cps/config_sql.py
View file @
308fd554
...
...
@@ -53,7 +53,7 @@ class _Settings(_Base):
mail_login
=
Column
(
String
,
default
=
'mail@example.com'
)
mail_password
=
Column
(
String
,
default
=
'mypassword'
)
mail_from
=
Column
(
String
,
default
=
'automailer <mail@example.com>'
)
mail_size
=
Column
(
Integer
,
default
=
25
)
mail_size
=
Column
(
Integer
,
default
=
25
*
1024
*
1024
)
config_calibre_dir
=
Column
(
String
)
config_port
=
Column
(
Integer
,
default
=
constants
.
DEFAULT_PORT
)
...
...
cps/helper.py
View file @
308fd554
...
...
@@ -145,22 +145,24 @@ def check_send_to_kindle(entry):
if
not
config
.
config_converterpath
:
# no converter - only for mobi and pdf formats
for
ele
in
iter
(
entry
.
data
):
if
'MOBI'
in
ele
.
format
:
bookformats
.
append
({
'format'
:
'Mobi'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Mobi'
)})
if
'PDF'
in
ele
.
format
:
bookformats
.
append
({
'format'
:
'Pdf'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Pdf'
)})
if
'AZW'
in
ele
.
format
:
bookformats
.
append
({
'format'
:
'Azw'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Azw'
)})
if
ele
.
uncompressed_size
<
config
.
mail_size
:
if
'MOBI'
in
ele
.
format
:
bookformats
.
append
({
'format'
:
'Mobi'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Mobi'
)})
if
'PDF'
in
ele
.
format
:
bookformats
.
append
({
'format'
:
'Pdf'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Pdf'
)})
if
'AZW'
in
ele
.
format
:
bookformats
.
append
({
'format'
:
'Azw'
,
'convert'
:
0
,
'text'
:
_
(
'Send
%(format)
s to Kindle'
,
format
=
'Azw'
)})
else
:
formats
=
list
()
for
ele
in
iter
(
entry
.
data
):
formats
.
append
(
ele
.
format
)
if
ele
.
uncompressed_size
<
config
.
mail_size
:
formats
.
append
(
ele
.
format
)
if
'MOBI'
in
formats
:
bookformats
.
append
({
'format'
:
'Mobi'
,
'convert'
:
0
,
...
...
cps/templates/email_edit.html
View file @
308fd554
...
...
@@ -13,7 +13,7 @@
</div>
<div
class=
"form-group"
>
<label
for=
"mail_port"
>
{{_('SMTP Port')}}
</label>
<input
type=
"number"
min=
"1"
max=
"65535"
class=
"form-control"
name=
"mail_port"
id=
"mail_port"
value=
"{% if config.mail_port != None %}{{ config
.mail_port }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"number"
min=
"1"
max=
"65535"
step=
"1"
class=
"form-control"
name=
"mail_port"
id=
"mail_port"
value=
"{% if content.mail_port != None %}{{ content
.mail_port }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"mail_use_ssl"
>
{{_('Encryption')}}
</label>
...
...
@@ -37,9 +37,9 @@
</div>
<label
for=
"mail_size"
>
{{_('Attachment Size Limit')}}
</label>
<div
class=
"form-group input-group"
>
<input
type=
"number"
min=
"1"
max=
"600"
class=
"form-control"
name=
"attachment_size"
id=
"mail_size"
value=
"{% if config.mail_size != None %}{{ config.mail_size
}}{% endif %}"
>
<input
type=
"number"
min=
"1"
max=
"600"
step=
"1"
class=
"form-control"
name=
"mail_size"
id=
"mail_size"
value=
"{% if content.mail_size != None %}{{ (content.mail_size / 1024 / 1024)|int
}}{% endif %}"
>
<span
class=
"input-group-btn"
>
<button
type=
"button"
id=
"
certfile_path
"
class=
"btn btn-default"
disabled
>
MB
</button>
<button
type=
"button"
id=
"
attachement_size
"
class=
"btn btn-default"
disabled
>
MB
</button>
</span>
</div>
<button
type=
"submit"
name=
"submit"
value=
"submit"
class=
"btn btn-default"
>
{{_('Save')}}
</button>
...
...
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