Merge branch 'master' into prod

This commit is contained in:
idalin 2017-02-23 13:53:36 +08:00
commit c98617a1cb
3 changed files with 38 additions and 24 deletions

View file

@ -61,31 +61,31 @@ msgstr "游客"
#: cps/web.py:734 #: cps/web.py:734
msgid "Requesting update package" msgid "Requesting update package"
msgstr "" msgstr "正在请求更新包"
#: cps/web.py:735 #: cps/web.py:735
msgid "Downloading update package" msgid "Downloading update package"
msgstr "" msgstr "正在下载更新包"
#: cps/web.py:736 #: cps/web.py:736
msgid "Unzipping update package" msgid "Unzipping update package"
msgstr "" msgstr "正在解压更新包"
#: cps/web.py:737 #: cps/web.py:737
msgid "Files are replaced" msgid "Files are replaced"
msgstr "" msgstr "文件已替换"
#: cps/web.py:738 #: cps/web.py:738
msgid "Database connections are closed" msgid "Database connections are closed"
msgstr "" msgstr "数据库连接已关闭"
#: cps/web.py:739 #: cps/web.py:739
msgid "Server is stopped" msgid "Server is stopped"
msgstr "" msgstr "服务器已停止"
#: cps/web.py:740 #: cps/web.py:740
msgid "Update finished, please press okay and reload page" msgid "Update finished, please press okay and reload page"
msgstr "" msgstr "更新完成,请按确定并刷新页面"
#: cps/web.py:810 #: cps/web.py:810
msgid "Latest Books" msgid "Latest Books"
@ -97,7 +97,7 @@ msgstr "热门书籍(最多下载)"
#: cps/web.py:845 #: cps/web.py:845
msgid "Best rated books" msgid "Best rated books"
msgstr "" msgstr "最高评分书籍"
#: cps/templates/index.xml:36 cps/web.py:854 #: cps/templates/index.xml:36 cps/web.py:854
msgid "Random Books" msgid "Random Books"
@ -108,9 +108,9 @@ msgid "Author list"
msgstr "作者列表" msgstr "作者列表"
#: cps/web.py:878 #: cps/web.py:878
#, python-format #, python-forma
msgid "Author: %(name)s" msgid "Author: %(name)s"
msgstr "" msgstr "作者: %(name)s"
#: cps/web.py:880 cps/web.py:908 cps/web.py:1007 cps/web.py:1235 #: cps/web.py:880 cps/web.py:908 cps/web.py:1007 cps/web.py:1235
#: cps/web.py:2115 #: cps/web.py:2115
@ -150,7 +150,7 @@ msgstr "统计"
#: cps/web.py:1061 #: cps/web.py:1061
msgid "Server restarted, please reload page" msgid "Server restarted, please reload page"
msgstr "" msgstr "服务器已重启,请刷新页面"
#: cps/web.py:1063 #: cps/web.py:1063
msgid "Performing shutdown of server, please close window" msgid "Performing shutdown of server, please close window"
@ -158,7 +158,7 @@ msgstr "正在关闭服务器,请关闭窗口"
#: cps/web.py:1073 #: cps/web.py:1073
msgid "Update done" msgid "Update done"
msgstr "" msgstr "更新完成"
#: cps/web.py:1147 cps/web.py:1160 #: cps/web.py:1147 cps/web.py:1160
msgid "search" msgid "search"
@ -475,11 +475,11 @@ msgstr "管理"
#: cps/templates/admin.html:80 #: cps/templates/admin.html:80
msgid "Current commit timestamp" msgid "Current commit timestamp"
msgstr "" msgstr "当前提交时间戳"
#: cps/templates/admin.html:81 #: cps/templates/admin.html:81
msgid "Newest commit timestamp" msgid "Newest commit timestamp"
msgstr "" msgstr "最新提交时间戳"
#: cps/templates/admin.html:83 #: cps/templates/admin.html:83
msgid "Restart Calibre-web" msgid "Restart Calibre-web"
@ -491,11 +491,11 @@ msgstr "停止 Calibre-web"
#: cps/templates/admin.html:85 #: cps/templates/admin.html:85
msgid "Check for update" msgid "Check for update"
msgstr "" msgstr "检查更新"
#: cps/templates/admin.html:86 #: cps/templates/admin.html:86
msgid "Perform Update" msgid "Perform Update"
msgstr "" msgstr "执行更新"
#: cps/templates/admin.html:96 #: cps/templates/admin.html:96
msgid "Do you really want to restart Calibre-web?" msgid "Do you really want to restart Calibre-web?"
@ -519,7 +519,7 @@ msgstr "您确定要关闭 Calibre-web 吗?"
#: cps/templates/admin.html:127 #: cps/templates/admin.html:127
msgid "Updating, please do not reload page" msgid "Updating, please do not reload page"
msgstr "" msgstr "正在更新,请不要刷新页面"
#: cps/templates/book_edit.html:16 cps/templates/search_form.html:6 #: cps/templates/book_edit.html:16 cps/templates/search_form.html:6
msgid "Book Title" msgid "Book Title"
@ -610,7 +610,7 @@ msgstr "启用注册"
#: cps/templates/config_edit.html:52 #: cps/templates/config_edit.html:52
msgid "Default Settings for new users" msgid "Default Settings for new users"
msgstr "" msgstr "新用户默认设置"
#: cps/templates/config_edit.html:55 cps/templates/user_edit.html:80 #: cps/templates/config_edit.html:55 cps/templates/user_edit.html:80
msgid "Admin user" msgid "Admin user"
@ -651,7 +651,7 @@ msgstr "语言"
#: cps/templates/detail.html:74 #: cps/templates/detail.html:74
msgid "Publishing date" msgid "Publishing date"
msgstr "" msgstr "出版日期"
#: cps/templates/detail.html:106 #: cps/templates/detail.html:106
msgid "Description:" msgid "Description:"
@ -723,11 +723,11 @@ msgstr "热门书籍"
#: cps/templates/index.xml:19 #: cps/templates/index.xml:19
msgid "Popular publications from this catalog based on Downloads." msgid "Popular publications from this catalog based on Downloads."
msgstr "" msgstr "基于下载数的热门书籍"
#: cps/templates/index.xml:22 cps/templates/layout.html:129 #: cps/templates/index.xml:22 cps/templates/layout.html:129
msgid "Best rated Books" msgid "Best rated Books"
msgstr "" msgstr "最高评分书籍"
#: cps/templates/index.xml:26 #: cps/templates/index.xml:26
msgid "Popular publications from this catalog based on Rating." msgid "Popular publications from this catalog based on Rating."
@ -933,11 +933,11 @@ msgstr "个作者在此书库"
#: cps/templates/stats.html:45 #: cps/templates/stats.html:45
msgid "Categories in this Library" msgid "Categories in this Library"
msgstr "" msgstr "个分类在此书库"
#: cps/templates/stats.html:49 #: cps/templates/stats.html:49
msgid "Series in this Library" msgid "Series in this Library"
msgstr "" msgstr "个丛书在此书库"
#: cps/templates/user_edit.html:23 #: cps/templates/user_edit.html:23
msgid "Kindle E-Mail" msgid "Kindle E-Mail"
@ -961,7 +961,7 @@ msgstr "显示热门书籍"
#: cps/templates/user_edit.html:53 #: cps/templates/user_edit.html:53
msgid "Show best rated books" msgid "Show best rated books"
msgstr "" msgstr "显示最高评分书籍"
#: cps/templates/user_edit.html:57 #: cps/templates/user_edit.html:57
msgid "Show language selection" msgid "Show language selection"

View file

@ -51,6 +51,7 @@ except ImportError, e:
use_generic_pdf_cover = True use_generic_pdf_cover = True
from cgi import escape from cgi import escape
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'epub', 'mobi', 'azw', 'azw3', 'cbr', 'cbz', 'cbt', 'djvu', 'prc', 'doc', 'docx', 'fb2'])
# Proxy Helper class # Proxy Helper class
class ReverseProxied(object): class ReverseProxied(object):
@ -2136,6 +2137,19 @@ def upload():
db.session.connection().connection.connection.create_function('uuid4', 0, lambda: str(uuid4())) db.session.connection().connection.connection.create_function('uuid4', 0, lambda: str(uuid4()))
if request.method == 'POST' and 'btn-upload' in request.files: if request.method == 'POST' and 'btn-upload' in request.files:
file = request.files['btn-upload'] file = request.files['btn-upload']
file = request.files['btn-upload']
if '.' in file.filename:
file_ext = file.filename.rsplit('.', 1)[-1].lower()
if file_ext not in ALLOWED_EXTENSIONS:
flash(
_('File extension "%s" is not allowed to be uploaded to this server' %
file_ext),
category="error"
)
return redirect(url_for('index'))
else:
flash(_('File to be uploaded must have an extension'), category="error")
return redirect(url_for('index'))
meta = uploader.upload(file) meta = uploader.upload(file)
title = meta.title title = meta.title