Skip to content

Commit

Permalink
3.0.0d1
Browse files Browse the repository at this point in the history
  • Loading branch information
cdhigh committed Apr 14, 2024
1 parent 9e7ca5f commit 415e742
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ def convert(self, recipes, opts, file_ext, log, output_dir, fs):
log.warning(msg)
continue

feed_index_start += len(ro.feed_objects)
self.feeds.extend(ro.feed_objects)
self.aborted_articles.extend(ro.aborted_articles)
self.failed_downloads.extend(ro.failed_downloads)
self.index_htmls.append((ro.title, ro.get_root_index_html_name()))
self.recipe_objects.append(ro)
if ro.feed_objects:
feed_index_start += len(ro.feed_objects)
self.feeds.extend(ro.feed_objects)
self.aborted_articles.extend(ro.aborted_articles)
self.failed_downloads.extend(ro.failed_downloads)
self.index_htmls.append((ro.title, ro.get_root_index_html_name()))
self.recipe_objects.append(ro)

#可能会有些副作用,前面的conversion_options会影响后面的recipe
for key, val in ro.conversion_options.items():
Expand Down
7 changes: 0 additions & 7 deletions application/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
def Home():
return render_template('home.html')

@bpHome.route('/env')
def Test():
strEnv = []
for d in os.environ:
strEnv.append("<pre><p>" + str(d).rjust(28) + " | " + str(os.environ[d]) + "</p></pre>")
return ''.join(strEnv)

@bpHome.route('/images/<path:image_file>')
def ImageFileRoute(image_file):
imgDir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'images'))
Expand Down
15 changes: 12 additions & 3 deletions application/static/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function BrowserLanguage() {
if (lang.indexOf('-') != -1) {
return lang.substring(0, lang.indexOf('-'));
} else {
return lang.substring(0, 2);
return lang; //.substring(0, 2);
}
}

Expand Down Expand Up @@ -592,8 +592,17 @@ function ShowSimpleModalDialog(content) {

//显示一个分享自定义RSS的对话框
function ShowShareDialog(id, title){
var all_languages = ['aa','ab','af','ak','sq','am','ar','an','hy','as','av','ae','ay','az','ba','bm','eu','be','bn','bh','bi','bo','bs','br','bg','my','ca','cs','ch','ce','zh','cu','cv','kw','co','cr','cy','cs','da','de','dv','nl','dz','el','en','eo','et','eu','ee','fo','fa','fj','fi','fr','fy','ff','ga','de','gd','ga','gl','gv','el','gn','gu','ht','ha','he','hz','hi','ho','hr','hu','hy','ig','is','io','ii','iu','ie','ia','id','ik','is','it','jv','ja','kl','kn','ks','ka','kr','kk','km','ki','rw','ky','kv','kg','ko','kj','ku','lo','la','lv','li','ln','lt','lb','lu','lg','mk','mh','ml','mi','mr','ms','mi','mk','mg','mt','mn','mi','ms','my','na','nv','nr','nd','ng','ne','nl','nn','nb','no','oc','oj','or','om','os','pa','fa','pi','pl','pt','ps','qu','rm','ro','ro','rn','ru','sg','sa','si','sk','sk','sl','se','sm','sn','sd','so','st','es','sq','sc','sr','ss','su','sw','sv','ty','ta','tt','te','tg','tl','th','bo','ti','to','tn','ts','tk','tr','tw','ug','uk','ur','uz','ve','vi','vo','cy','wa','wo','xh','yi','yo','za','zh','zu'];
var languages = ['en','fr','zh','es','pt','de','it','ja','ru','tr','ko','ar','cs','nl','el','hi','ms','bn','fa','ur','sw','vi','pa','jv','tl','ha'];
var all_languages = ['aa','ab','af','ak','sq','am','ar','an','hy','as','av','ae','ay','az','ba','bm','eu','be','bn',
'bh','bi','bo','bs','br','bg','my','ca','cs','ch','ce','zh','cu','cv','kw','co','cr','cy','cs','da','de','dv','nl',
'dz','el','en','eo','et','eu','ee','fo','fa','fj','fi','fr','fy','ff','ga','de','gd','ga','gl','gv','el','gn','gu',
'ht','ha','he','hz','hi','ho','hr','hu','hy','ig','is','io','ii','iu','ie','ia','id','ik','is','it','jv','ja','kl',
'kn','ks','ka','kr','kk','km','ki','rw','ky','kv','kg','ko','kj','ku','lo','la','lv','li','ln','lt','lb','lu','lg',
'mk','mh','ml','mi','mr','ms','mi','mk','mg','mt','mn','mi','ms','my','na','nv','nr','nd','ng','ne','nl','nn','nb',
'no','oc','oj','or','om','os','pa','fa','pi','pl','pt','ps','qu','rm','ro','ro','rn','ru','sg','sa','si','sk','sk',
'sl','se','sm','sn','sd','so','st','es','sq','sc','sr','ss','su','sw','sv','ty','ta','tt','te','tg','tl','th','bo',
'ti','to','tn','ts','tk','tr','tw','ug','uk','ur','uz','ve','vi','vo','cy','wa','wo','xh','yi','yo','za','zh','zu'];
var languages = ['en','fr','zh','es','pt','de','it','ja','ru','tr','ko','ar','cs','nl','el','hi','ms','bn','fa','ur',
'sw','vi','pa','jv','tl','ha','da','in','no','pl','ro','sv','th'];
var userLang = BrowserLanguage();
var modal = new tingle.modal({footer: true});
var ostr = ['<h2>' + i18n.shareLinksHappiness + '</h2>'];
Expand Down
2 changes: 2 additions & 0 deletions application/templates/setting.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@
{% if 'smtp' in sm_services -%}
<option value="smtp" {% if sm_srv_type == 'smtp' %}selected="selected"{% endif %}>SMTP</option>
{% endif -%}
{% if 'local' in sm_services -%}
<option value="local" {% if sm_srv_type == 'local' %}selected="selected"{% endif %}>local (debug)</option>
{% endif -%}
</select>
</div>
<div class="pure-control-group" id="sm_apikey">
Expand Down
9 changes: 9 additions & 0 deletions application/view/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ def SendTestEmailPost():

return {'status': status, 'emails': emails}

#显示环境变量的值
@bpSetting.route('/env')
@login_required()
def DisplayEnv():
strEnv = []
for d in os.environ:
strEnv.append("<pre><p>" + str(d).rjust(28) + " | " + str(os.environ[d]) + "</p></pre>")
return ''.join(strEnv)

#设置国际化语种
@bpSetting.route("/setlocale/<langCode>")
def SetLang(langCode):
Expand Down
7 changes: 5 additions & 2 deletions application/work/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ def WorkerImpl(userName: str, recipeId: list=None, log=None):
else:
save_delivery_log(user, title, 0, status='nonews')

elaspTime = time.time() - startTime
elaspTime = (time.time() - startTime) / 60.0
if ret:
ret = '\n'.join(ret)
ret += f'\nTime: {elaspTime} seconds.'
if '\n' in ret:
ret += f'\nConsumed time: {elaspTime:.1f} minutes.'
else:
ret += f' [Consumed time: {elaspTime:.1f} minutes].'
else:
ret = "There are no new feeds available."
log.warning(ret)
Expand Down
4 changes: 1 addition & 3 deletions docs/Chinese/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ gcloud beta app deploy --version=1 app.yaml
### 其他说明
1. 初始账号和密码为 admin/admin。
2. 部署时出现下面的几个提示时记得按 y,因为光标自动下移到了下一行,往往会忘记按 y,否则会一直卡在这里。

```
Updating config [cron]...API [cloudscheduler.googleapis.com] not enabled on project [xxx]. Would you like to enable and retry (this will take a few minutes)
Updating config [queue]...API [cloudtasks.googleapis.com] not enabled on project [xxx]. Would you like to enable and retry (this will take a few minutes)
```

```

3. 如果出现部署失败并且多次尝试后仍然无法解决,比如"Timed out fetching pod."之类的错误,可以关停此id,然后重建一个,部署时选择其他区域。

Expand Down
22 changes: 20 additions & 2 deletions tests/readme.developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

gcloud app deploy cron.yaml
gcloud app deploy queue.yaml
gcloud services list | grep datastore.googleapis.com

# Windows 安装celery
* 安装并启动redis服务,(Windows只能安装redis3 <https://github.com/MicrosoftArchive/redis/releases>)
Expand Down Expand Up @@ -60,9 +61,17 @@ gcloud app deploy queue.yaml
# KindleEar额外自带的Python库,这些库不用pip安装,不在requirements.txt里面
* readability-lxml: 修改了其htmls.py|shorten_title()

# 关于翻译的注意事项
# 关于i18n翻译
* javascript的翻译没有采用其他复杂或引入其他依赖的方案,而是简单粗暴的在base.html里面将要翻译的字段预先翻译,
然后保存到一个全局字典
* 文本字符串有修改后,逐个执行三个脚本。
第一个脚本提取文本到messages.pot,第二个将文本更新到messages.po,翻译后使用第三个脚本编译为messages.mo
```bat
tools\pybabel_extract.bat
tools\pybabel_update.bat
tools\pybabel_compile.bat
```
* 在po后查找fuzzy,更新翻译后,将fuzzy标识行删除


# Docker
Expand All @@ -72,6 +81,7 @@ cp ./docker/Dockerfile .
sudo docker build -t kindleear/kindleear .
#or
sudo docker build --no-cache -t kindleear/kindleear .
sudo docker tag id kindleear/kindleear:version
```

## 常用Docker命令
Expand All @@ -84,9 +94,17 @@ sudo docker ps -a
sudo docker compose up -d
sudo docker run -d
sudo docker run -it id /bin/bash

sudo docker login
sudo docker push kindleear/kindleear:tag
sudo docker push kindleear/kindleear
```


# 申请Let’s Encrypt ssl证书
* sudo apt update && sudo apt install certbot
* sudo certbot certonly --manual --preferred-challenges=dns --email [email protected] -d www.yourdomain.com
* 添加txt记录

# Python托管平台的一些了解
* [appengine](https://cloud.google.com):必须绑定信用卡,但有免费额度,有收发邮件服务,任务队列,后台进程
* [Heroku](https://www.heroku.com): 没有免费额度,入门套餐也需要付费
Expand Down
1 change: 1 addition & 0 deletions tools/run_flask.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ set TASK_QUEUE_SERVICE=apscheduler
set TASK_QUEUE_BROKER_URL=redis://127.0.0.1:6379/
set KE_TEMP_DIR=d:/temp
set LOG_LEVEL=debug
set HIDE_MAIL_TO_LOCAL=no
python -m flask run --host=0.0.0.0 --debug
pause

0 comments on commit 415e742

Please sign in to comment.