Skip to content

Commit

Permalink
porting to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
cdhigh committed Mar 26, 2024
1 parent 86badd7 commit 7d01d94
Show file tree
Hide file tree
Showing 19 changed files with 557 additions and 358 deletions.
1 change: 1 addition & 0 deletions application/back_end/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class InBox(MyBaseModel):
sender = CharField()
to = CharField()
subject = CharField()
status = CharField()
size = IntegerField(default=0)
datetime = DateTimeField(default=datetime.datetime.utcnow)
body = TextField(default='', index=False)
Expand Down
5 changes: 3 additions & 2 deletions application/back_end/task_queue_apscheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
elif _broker_url.startswith(('sqlite://', 'mysql://', 'postgresql://')):
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
jobstores = {"default": SQLAlchemyJobStore(url=_broker_url)}
elif _broker_url == '':
jobstores = {} #default is memory store
elif _broker_url == 'memory':
from apscheduler.jobstores.memory import MemoryJobStore
jobstores = {"default": MemoryJobStore()}
else:
raise ValueError('Unsupported TASK_QUEUE_BROKER_URL type: {_broker_url}')

Expand Down
11 changes: 6 additions & 5 deletions application/back_end/task_queue_rq.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#Author: cdhigh <https://github.com/cdhigh>
import os, sys, json

#启动rq
#set FLASK_APP=main.py
#启动rq的worker命令,在shell下执行
#windows: set FLASK_APP=main.py
#linux: export FLASK_APP=main.py
#flask rq worker

from flask_rq2 import RQ
Expand All @@ -15,9 +16,9 @@
def init_task_queue_service(app):
app.config['RQ_REDIS_URL'] = app.config['TASK_QUEUE_BROKER_URL']
rq.init_app(app)
#windows不支持,暂时屏蔽,正式版本需要取消注释
#check_deliver.cron('0 */1 * * *', 'check_deliver') #每隔一个小时执行一次
#remove_logs.cron('0 0 */1 * *', 'remove_logs') #每隔24小时执行一次
#windows不支持,暂时屏蔽,正式版本需要取消注释, TODO
check_deliver.cron('40 */1 * * *', 'check_deliver') #每隔一个小时执行一次
remove_logs.cron('0 0 */1 * *', 'remove_logs') #每隔24小时执行一次
return rq

@rq.job
Expand Down
3 changes: 2 additions & 1 deletion application/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
abbrUpl: '{{_("Upl")|safe}}',
abbrSep: '{{_("Sep")|safe}}',
abbrLog: '{{_("Log")|safe}}',
abbrEmb: '{{_("Emb")|safe}}'
abbrEmb: '{{_("Emb")|safe}}',
testEmailOk: '{{_("The test email has been successfully sent to [{0}]. Please check your inbox or spam folder to confirm its delivery. Depending on your email server, there may be a slight delay.")|safe}}'
};
</script>
{% block javascript_inhead %}
Expand Down
17 changes: 16 additions & 1 deletion application/templates/setting.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@
{{_("You have not yet set up your email address. Please go to the 'Admin' page to add your email address firstly.")}}
</p>
{% endif %}
<hr/>
<p style="text-align:center;">
<input type="submit" class="pure-button pure-button-primary pure-input-rounded" value="{{_('Save settings')}}" />
<button type="submit" class="pure-button pure-button-primary pure-input-rounded">{{_('Save settings')}} </button>
&nbsp;&nbsp;&nbsp;&nbsp;
<button type="button" class="pure-button pure-input-rounded" onclick="SendTestEmail()"> {{_("Send Test Email")}}</button>
</p>
</form>
</div>
Expand Down Expand Up @@ -309,5 +312,17 @@
$('#sm_save_path').hide();
}
}

//发送测试邮件
function SendTestEmail() {
$.post("/send_test_email", {url: window.location.href}, function (data) {
if (data.status == "ok") {
ShowSimpleModalDialog('<p>{0}</p>'.format(i18n.testEmailOk.format(data.email)));
} else {
alert(data.status);
}
});
return false;
}
</script>
{% endblock -%}
Binary file modified application/translations/tr_TR/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit 7d01d94

Please sign in to comment.