diff --git a/application/back_end/db_models.py b/application/back_end/db_models.py index dfc79772..51af8b1f 100644 --- a/application/back_end/db_models.py +++ b/application/back_end/db_models.py @@ -35,7 +35,7 @@ class KeUser(MyBaseModel): # kindleEar User book_config = JSONField(default=JSONField.dict_default) share_links = JSONField(default=JSONField.dict_default) #evernote/wiz/pocket/instapaper包含子字典,微博/facebook/twitter等仅包含0/1 - covers = JSONField(default=JSONField.dict_default) #保存封面图片数据库ID {'order':,'cover0':,...'cover6':} + covers = JSONField(default=JSONField.dict_default) #保存封面图片数据库ID {'enable':,'order':,'cover0':,...'cover6':} send_mail_service = JSONField(default=JSONField.dict_default) #{'service':,...} custom = JSONField(default=JSONField.dict_default) #留着扩展,避免后续一些小特性还需要升级数据表结构 diff --git a/application/static/base.js b/application/static/base.js index 3ea3e078..2da5e838 100644 --- a/application/static/base.js +++ b/application/static/base.js @@ -1310,6 +1310,7 @@ function SetCoverToDefaultImg(idx) { function startUploadCoversToServer(url) { var totalSize = 0; var fileDatas = new FormData(); + fileDatas.append('enable', $('#enableCover').val()); fileDatas.append('order', $('#coverOrder').val()); for (var idx = 0; idx < 7; idx++) { var coverName = 'cover' + idx; diff --git a/application/templates/adv_uploadcover.html b/application/templates/adv_uploadcover.html index 66fd6cdf..907031dc 100644 --- a/application/templates/adv_uploadcover.html +++ b/application/templates/adv_uploadcover.html @@ -4,21 +4,28 @@ {% endblock -%} {% block advcontent -%} -
+
{{_("Upload cover image")}} -

{{_("Upload cover images from local with an aspect ratio of approximately 0.65.")}}

+

{{_("Upload cover images from local with an aspect ratio of approximately 0.625.")}}

+
+ + +
+
+ + +
+
-
- - -
-
    {% for idx in range(7) -%} diff --git a/application/translations/messages.pot b/application/translations/messages.pot index 4ee3942b..4bbe525e 100644 --- a/application/translations/messages.pot +++ b/application/translations/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-11-23 21:29-0300\n" +"POT-Creation-Date: 2024-11-24 09:32-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -383,6 +383,7 @@ msgid "" msgstr "" #: application/templates/adv_inboundmail.html:16 +#: application/templates/adv_uploadcover.html:15 #: application/templates/book_summarizer.html:19 #: application/templates/book_translator.html:22 msgid "Disable" @@ -465,23 +466,35 @@ msgid "Upload cover image" msgstr "" #: application/templates/adv_uploadcover.html:10 -msgid "Upload cover images from local with an aspect ratio of approximately 0.65." +msgid "" +"Upload cover images from local with an aspect ratio of approximately " +"0.625." msgstr "" -#: application/templates/adv_uploadcover.html:15 -msgid "Rule to pick cover images" +#: application/templates/adv_uploadcover.html:13 +msgid "Include cover" +msgstr "" + +#: application/templates/adv_uploadcover.html:16 +#: application/templates/book_summarizer.html:18 +#: application/templates/book_translator.html:21 +msgid "Enable" msgstr "" -#: application/templates/adv_uploadcover.html:17 +#: application/templates/adv_uploadcover.html:20 +msgid "Rule for cover" +msgstr "" + +#: application/templates/adv_uploadcover.html:22 msgid "Random" msgstr "" -#: application/templates/adv_uploadcover.html:18 +#: application/templates/adv_uploadcover.html:23 #: application/templates/base.html:127 msgid "Weekday" msgstr "" -#: application/templates/adv_uploadcover.html:42 +#: application/templates/adv_uploadcover.html:49 msgid "Upload/Update" msgstr "" @@ -1150,11 +1163,6 @@ msgstr "" msgid "Your browser does not support the audio element." msgstr "" -#: application/templates/book_summarizer.html:18 -#: application/templates/book_translator.html:21 -msgid "Enable" -msgstr "" - #: application/templates/book_summarizer.html:29 msgid "Model" msgstr "" @@ -1688,8 +1696,8 @@ msgstr "" msgid "Word" msgstr "" -#: application/view/admin.py:48 application/view/adv.py:434 -#: application/view/adv.py:486 application/view/settings.py:66 +#: application/view/admin.py:48 application/view/adv.py:437 +#: application/view/adv.py:489 application/view/settings.py:66 #: application/view/translator.py:87 application/view/translator.py:171 #: application/view/translator.py:253 msgid "Settings Saved!" @@ -1803,34 +1811,34 @@ msgstr "" msgid "Append qrcode of url to article" msgstr "" -#: application/view/adv.py:378 application/view/share.py:54 +#: application/view/adv.py:381 application/view/share.py:54 #: application/view/subscribe.py:250 msgid "Unknown command: {}" msgstr "" -#: application/view/adv.py:436 application/view/adv.py:488 +#: application/view/adv.py:439 application/view/adv.py:491 msgid "The format is invalid." msgstr "" -#: application/view/adv.py:520 +#: application/view/adv.py:523 msgid "Authorization Error!
    {}" msgstr "" -#: application/view/adv.py:541 +#: application/view/adv.py:544 msgid "Success authorized by Pocket!" msgstr "" -#: application/view/adv.py:547 +#: application/view/adv.py:550 msgid "" "Failed to request authorization of Pocket!
    See details " "below:

    {}" msgstr "" -#: application/view/adv.py:568 +#: application/view/adv.py:571 msgid "The Instapaper service encountered an error. Please try again later." msgstr "" -#: application/view/adv.py:581 +#: application/view/adv.py:584 msgid "Request type [{}] unsupported" msgstr "" diff --git a/application/translations/tr_TR/LC_MESSAGES/messages.mo b/application/translations/tr_TR/LC_MESSAGES/messages.mo index a554048e..b89746d9 100644 Binary files a/application/translations/tr_TR/LC_MESSAGES/messages.mo and b/application/translations/tr_TR/LC_MESSAGES/messages.mo differ diff --git a/application/translations/tr_TR/LC_MESSAGES/messages.po b/application/translations/tr_TR/LC_MESSAGES/messages.po index eb73df84..95b3587d 100644 --- a/application/translations/tr_TR/LC_MESSAGES/messages.po +++ b/application/translations/tr_TR/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-11-23 21:29-0300\n" +"POT-Creation-Date: 2024-11-24 09:32-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: tr_TR\n" @@ -386,6 +386,7 @@ msgstr "" "yapılandırmanız gerekmektedir." #: application/templates/adv_inboundmail.html:16 +#: application/templates/adv_uploadcover.html:15 #: application/templates/book_summarizer.html:19 #: application/templates/book_translator.html:22 msgid "Disable" @@ -470,25 +471,37 @@ msgid "Upload cover image" msgstr "Kapak resmi yükle" #: application/templates/adv_uploadcover.html:10 -msgid "Upload cover images from local with an aspect ratio of approximately 0.65." +msgid "" +"Upload cover images from local with an aspect ratio of approximately " +"0.625." msgstr "" -"Yaklaşık 0.65 en boy oranına sahip kapak resimlerini yerel olarak " +"Yaklaşık 0.625 en boy oranına sahip kapak resimlerini yerel olarak " "yükleyin." -#: application/templates/adv_uploadcover.html:15 -msgid "Rule to pick cover images" -msgstr "Kapak resimlerini seçme kuralı" +#: application/templates/adv_uploadcover.html:13 +msgid "Include cover" +msgstr "Kapak Dahil" + +#: application/templates/adv_uploadcover.html:16 +#: application/templates/book_summarizer.html:18 +#: application/templates/book_translator.html:21 +msgid "Enable" +msgstr "Etkinleştir" + +#: application/templates/adv_uploadcover.html:20 +msgid "Rule for cover" +msgstr "Kapak Kuralı" -#: application/templates/adv_uploadcover.html:17 +#: application/templates/adv_uploadcover.html:22 msgid "Random" msgstr "Rastgele" -#: application/templates/adv_uploadcover.html:18 +#: application/templates/adv_uploadcover.html:23 #: application/templates/base.html:127 msgid "Weekday" msgstr "Hafta içi gün" -#: application/templates/adv_uploadcover.html:42 +#: application/templates/adv_uploadcover.html:49 msgid "Upload/Update" msgstr "Yükle/Güncelle" @@ -1168,11 +1181,6 @@ msgstr "Metin" msgid "Your browser does not support the audio element." msgstr "Tarayıcınız ses öğesini desteklemiyor." -#: application/templates/book_summarizer.html:18 -#: application/templates/book_translator.html:21 -msgid "Enable" -msgstr "Etkinleştir" - #: application/templates/book_summarizer.html:29 msgid "Model" msgstr "Model" @@ -1722,8 +1730,8 @@ msgstr "Ek olarak ilet" msgid "Word" msgstr "Kelime" -#: application/view/admin.py:48 application/view/adv.py:434 -#: application/view/adv.py:486 application/view/settings.py:66 +#: application/view/admin.py:48 application/view/adv.py:437 +#: application/view/adv.py:489 application/view/settings.py:66 #: application/view/translator.py:87 application/view/translator.py:171 #: application/view/translator.py:253 msgid "Settings Saved!" @@ -1837,24 +1845,24 @@ msgstr "Tarayıcıda aç" msgid "Append qrcode of url to article" msgstr "Makaleye URL'nin QR kodunu ekle" -#: application/view/adv.py:378 application/view/share.py:54 +#: application/view/adv.py:381 application/view/share.py:54 #: application/view/subscribe.py:250 msgid "Unknown command: {}" msgstr "Bilinmeyen komut: {}" -#: application/view/adv.py:436 application/view/adv.py:488 +#: application/view/adv.py:439 application/view/adv.py:491 msgid "The format is invalid." msgstr "Format geçersiz." -#: application/view/adv.py:520 +#: application/view/adv.py:523 msgid "Authorization Error!
    {}" msgstr "Yetkilendirme Hatası!
    {}" -#: application/view/adv.py:541 +#: application/view/adv.py:544 msgid "Success authorized by Pocket!" msgstr "Pocket tarafından yetkilendirilen başarı!" -#: application/view/adv.py:547 +#: application/view/adv.py:550 msgid "" "Failed to request authorization of Pocket!
    See details " "below:

    {}" @@ -1862,13 +1870,13 @@ msgstr "" "Pocket yetkilendirme isteği başarısız oldu!
    Aşağıdaki ayrıntılara " "bakın:

    {}" -#: application/view/adv.py:568 +#: application/view/adv.py:571 msgid "The Instapaper service encountered an error. Please try again later." msgstr "" "Instapaper servisi bir hata ile karşılaştı. Lütfen daha sonra tekrar " "deneyin." -#: application/view/adv.py:581 +#: application/view/adv.py:584 msgid "Request type [{}] unsupported" msgstr "İstek türü [{}] desteklenmiyor" diff --git a/application/translations/zh/LC_MESSAGES/messages.mo b/application/translations/zh/LC_MESSAGES/messages.mo index 721eebcf..63f54378 100644 Binary files a/application/translations/zh/LC_MESSAGES/messages.mo and b/application/translations/zh/LC_MESSAGES/messages.mo differ diff --git a/application/translations/zh/LC_MESSAGES/messages.po b/application/translations/zh/LC_MESSAGES/messages.po index 41537521..62907a79 100644 --- a/application/translations/zh/LC_MESSAGES/messages.po +++ b/application/translations/zh/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: KindleEar v3.0.0\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-11-23 21:29-0300\n" +"POT-Creation-Date: 2024-11-24 09:32-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: zh\n" @@ -384,6 +384,7 @@ msgid "" msgstr "为了使能入站邮件功能,还需要配置白名单列表。" #: application/templates/adv_inboundmail.html:16 +#: application/templates/adv_uploadcover.html:15 #: application/templates/book_summarizer.html:19 #: application/templates/book_translator.html:22 msgid "Disable" @@ -466,23 +467,35 @@ msgid "Upload cover image" msgstr "上传封面图像" #: application/templates/adv_uploadcover.html:10 -msgid "Upload cover images from local with an aspect ratio of approximately 0.65." -msgstr "从本机上传封面图像,建议宽高比为0.65左右。" +msgid "" +"Upload cover images from local with an aspect ratio of approximately " +"0.625." +msgstr "从本机上传封面图像,建议宽高比为0.625左右。" -#: application/templates/adv_uploadcover.html:15 -msgid "Rule to pick cover images" -msgstr "封面图像使用顺序" +#: application/templates/adv_uploadcover.html:13 +msgid "Include cover" +msgstr "推送封面" + +#: application/templates/adv_uploadcover.html:16 +#: application/templates/book_summarizer.html:18 +#: application/templates/book_translator.html:21 +msgid "Enable" +msgstr "启用" + +#: application/templates/adv_uploadcover.html:20 +msgid "Rule for cover" +msgstr "封面规则" -#: application/templates/adv_uploadcover.html:17 +#: application/templates/adv_uploadcover.html:22 msgid "Random" msgstr "随机" -#: application/templates/adv_uploadcover.html:18 +#: application/templates/adv_uploadcover.html:23 #: application/templates/base.html:127 msgid "Weekday" msgstr "周内日" -#: application/templates/adv_uploadcover.html:42 +#: application/templates/adv_uploadcover.html:49 msgid "Upload/Update" msgstr "上传/更新" @@ -1151,11 +1164,6 @@ msgstr "原文" msgid "Your browser does not support the audio element." msgstr "您的浏览器不支持audio标签。" -#: application/templates/book_summarizer.html:18 -#: application/templates/book_translator.html:21 -msgid "Enable" -msgstr "启用" - #: application/templates/book_summarizer.html:29 msgid "Model" msgstr "Model" @@ -1691,8 +1699,8 @@ msgstr "作为附件转发" msgid "Word" msgstr "单词" -#: application/view/admin.py:48 application/view/adv.py:434 -#: application/view/adv.py:486 application/view/settings.py:66 +#: application/view/admin.py:48 application/view/adv.py:437 +#: application/view/adv.py:489 application/view/settings.py:66 #: application/view/translator.py:87 application/view/translator.py:171 #: application/view/translator.py:253 msgid "Settings Saved!" @@ -1806,34 +1814,34 @@ msgstr "在浏览器打开" msgid "Append qrcode of url to article" msgstr "在每篇文章后附加文章链接的二维码" -#: application/view/adv.py:378 application/view/share.py:54 +#: application/view/adv.py:381 application/view/share.py:54 #: application/view/subscribe.py:250 msgid "Unknown command: {}" msgstr "未知命令:{}" -#: application/view/adv.py:436 application/view/adv.py:488 +#: application/view/adv.py:439 application/view/adv.py:491 msgid "The format is invalid." msgstr "格式非法。" -#: application/view/adv.py:520 +#: application/view/adv.py:523 msgid "Authorization Error!
    {}" msgstr "申请授权过程失败!
    {}" -#: application/view/adv.py:541 +#: application/view/adv.py:544 msgid "Success authorized by Pocket!" msgstr "已经成功获得Pocket的授权!" -#: application/view/adv.py:547 +#: application/view/adv.py:550 msgid "" "Failed to request authorization of Pocket!
    See details " "below:

    {}" msgstr "申请Pocket授权失败!
    错误信息参考如下:

    {}" -#: application/view/adv.py:568 +#: application/view/adv.py:571 msgid "The Instapaper service encountered an error. Please try again later." msgstr "Instapaper服务器异常,请稍候再试。" -#: application/view/adv.py:581 +#: application/view/adv.py:584 msgid "Request type [{}] unsupported" msgstr "不支持你请求的命令类型 [{}]" diff --git a/application/view/adv.py b/application/view/adv.py index 517d0933..7b5f97b1 100644 --- a/application/view/adv.py +++ b/application/view/adv.py @@ -277,6 +277,7 @@ def AdvUploadCoverImage(user: KeUser): covers = {} jsonCovers = '' if user: + covers['enable'] = user.covers.get('enable', '') covers['order'] = user.covers.get('order', 'random') for idx in range(7): coverName = f'cover{idx}' @@ -292,11 +293,13 @@ def AdvUploadCoverAjaxPost(user: KeUser): MAX_WIDTH = 832 MAX_HEIGHT = 1280 ret = {'status': 'ok'} + form = request.form covers = user.covers - covers['order'] = request.form.get('order', 'random') + covers['enable'] = form.get('enable', '') + covers['order'] = form.get('order', 'random') for idx in range(7): coverName = f'cover{idx}' - upload = request.files.get(coverName) or request.form.get(coverName) + upload = request.files.get(coverName) or form.get(coverName) if not upload: continue diff --git a/application/work/worker.py b/application/work/worker.py index aeae3ab2..590160f7 100644 --- a/application/work/worker.py +++ b/application/work/worker.py @@ -98,6 +98,10 @@ def WorkerImpl(userName: str, recipeId: Union[list,str,None]=None, reason='cron' ro.translator = bked.translator.copy() #设置网页翻译器信息 ro.tts = bked.tts.copy() #文本转语音设置,需要中途修改tts内容 ro.summarizer = bked.summarizer.copy() #AI摘要器的配置信息 + + #如果书籍没有设置封面,则使用用户全局设置 + if ro.cover_url is None and not user.covers.get('enable', ''): + ro.cover_url = False #如果需要登录网站 if ro.needs_subscription: