diff --git a/auto_pt/views.py b/auto_pt/views.py index 7828b23..71af786 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -131,6 +131,12 @@ def restart_container(request): res = scraper.get('https://gitee.com/ngfchl/ptools/raw/master/update.md') update_notes = markdown.markdown(res.text, extensions=['tables']) print(update_notes) + restart = 'false' + if os.environ.get('CONTAINER_NAME'): + restart = 'true' return render(request, 'auto_pt/restart.html', - context={'update_notes': update_notes} + context={ + 'update_notes': update_notes, + 'restart': restart + } ) diff --git a/templates/auto_pt/restart.html b/templates/auto_pt/restart.html index 5fdcd34..93a2b1b 100644 --- a/templates/auto_pt/restart.html +++ b/templates/auto_pt/restart.html @@ -11,7 +11,7 @@ 更新日志 更新 - 重启 + 重启
@@ -39,7 +39,8 @@ // element: 指定用vue来管理页面中的哪个标签区域 el: '#app', data: { - update_note: ['请先拉取更新哦'] + update_note: ['请先拉取更新哦'], + restart:{{ restart }}, }, methods: { do_restart() {