diff --git a/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.mo b/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.mo index d3a83c0d..5cb1b1c9 100644 Binary files a/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.mo and b/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.mo differ diff --git a/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po b/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po index 5356f3b2..c68904f6 100644 --- a/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po +++ b/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po @@ -61,31 +61,31 @@ msgstr "游客" #: cps/web.py:734 msgid "Requesting update package" -msgstr "" +msgstr "正在请求更新包" #: cps/web.py:735 msgid "Downloading update package" -msgstr "" +msgstr "正在下载更新包" #: cps/web.py:736 msgid "Unzipping update package" -msgstr "" +msgstr "正在解压更新包" #: cps/web.py:737 msgid "Files are replaced" -msgstr "" +msgstr "文件已替换" #: cps/web.py:738 msgid "Database connections are closed" -msgstr "" +msgstr "数据库连接已关闭" #: cps/web.py:739 msgid "Server is stopped" -msgstr "" +msgstr "服务器已停止" #: cps/web.py:740 msgid "Update finished, please press okay and reload page" -msgstr "" +msgstr "更新完成,请按确定并刷新页面" #: cps/web.py:810 msgid "Latest Books" @@ -97,7 +97,7 @@ msgstr "热门书籍(最多下载)" #: cps/web.py:845 msgid "Best rated books" -msgstr "" +msgstr "最高评分书籍" #: cps/templates/index.xml:36 cps/web.py:854 msgid "Random Books" @@ -108,9 +108,9 @@ msgid "Author list" msgstr "作者列表" #: cps/web.py:878 -#, python-format +#, python-forma 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:2115 @@ -150,7 +150,7 @@ msgstr "统计" #: cps/web.py:1061 msgid "Server restarted, please reload page" -msgstr "" +msgstr "服务器已重启,请刷新页面" #: cps/web.py:1063 msgid "Performing shutdown of server, please close window" @@ -158,7 +158,7 @@ msgstr "正在关闭服务器,请关闭窗口" #: cps/web.py:1073 msgid "Update done" -msgstr "" +msgstr "更新完成" #: cps/web.py:1147 cps/web.py:1160 msgid "search" @@ -475,11 +475,11 @@ msgstr "管理" #: cps/templates/admin.html:80 msgid "Current commit timestamp" -msgstr "" +msgstr "当前提交时间戳" #: cps/templates/admin.html:81 msgid "Newest commit timestamp" -msgstr "" +msgstr "最新提交时间戳" #: cps/templates/admin.html:83 msgid "Restart Calibre-web" @@ -491,11 +491,11 @@ msgstr "停止 Calibre-web" #: cps/templates/admin.html:85 msgid "Check for update" -msgstr "" +msgstr "检查更新" #: cps/templates/admin.html:86 msgid "Perform Update" -msgstr "" +msgstr "执行更新" #: cps/templates/admin.html:96 msgid "Do you really want to restart Calibre-web?" @@ -519,7 +519,7 @@ msgstr "您确定要关闭 Calibre-web 吗?" #: cps/templates/admin.html:127 msgid "Updating, please do not reload page" -msgstr "" +msgstr "正在更新,请不要刷新页面" #: cps/templates/book_edit.html:16 cps/templates/search_form.html:6 msgid "Book Title" @@ -610,7 +610,7 @@ msgstr "启用注册" #: cps/templates/config_edit.html:52 msgid "Default Settings for new users" -msgstr "" +msgstr "新用户默认设置" #: cps/templates/config_edit.html:55 cps/templates/user_edit.html:80 msgid "Admin user" @@ -651,7 +651,7 @@ msgstr "语言" #: cps/templates/detail.html:74 msgid "Publishing date" -msgstr "" +msgstr "出版日期" #: cps/templates/detail.html:106 msgid "Description:" @@ -723,11 +723,11 @@ msgstr "热门书籍" #: cps/templates/index.xml:19 msgid "Popular publications from this catalog based on Downloads." -msgstr "" +msgstr "基于下载数的热门书籍" #: cps/templates/index.xml:22 cps/templates/layout.html:129 msgid "Best rated Books" -msgstr "" +msgstr "最高评分书籍" #: cps/templates/index.xml:26 msgid "Popular publications from this catalog based on Rating." @@ -933,11 +933,11 @@ msgstr "个作者在此书库" #: cps/templates/stats.html:45 msgid "Categories in this Library" -msgstr "" +msgstr "个分类在此书库" #: cps/templates/stats.html:49 msgid "Series in this Library" -msgstr "" +msgstr "个丛书在此书库" #: cps/templates/user_edit.html:23 msgid "Kindle E-Mail" @@ -961,7 +961,7 @@ msgstr "显示热门书籍" #: cps/templates/user_edit.html:53 msgid "Show best rated books" -msgstr "" +msgstr "显示最高评分书籍" #: cps/templates/user_edit.html:57 msgid "Show language selection" diff --git a/cps/web.py b/cps/web.py index a33748e0..69cefe1a 100755 --- a/cps/web.py +++ b/cps/web.py @@ -51,6 +51,7 @@ except ImportError, e: use_generic_pdf_cover = True from cgi import escape +ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'epub', 'mobi', 'azw', 'azw3', 'cbr', 'cbz', 'cbt', 'djvu', 'prc', 'doc', 'docx', 'fb2']) # Proxy Helper class class ReverseProxied(object): @@ -2136,6 +2137,19 @@ def upload(): db.session.connection().connection.connection.create_function('uuid4', 0, lambda: str(uuid4())) if request.method == 'POST' and 'btn-upload' in request.files: 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) title = meta.title