From a820138a31f5679543325ac11fc6cf8bed24e7c9 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Fri, 26 Aug 2022 09:30:07 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BC=98=E5=8C=96=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E6=8C=89=E9=92=AE=EF=BC=8C=E5=9C=A8=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8FCONTAINER=5FNAME=E6=9C=AA=E8=AE=BE=E7=BD=AE=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto_pt/views.py | 8 +++++++- templates/auto_pt/restart.html | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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() {