diff --git a/auto_pt/views.py b/auto_pt/views.py index 47d817e..2e77471 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -92,7 +92,7 @@ def do_restart(request): msg='重启指令发送成功!!' ).to_dict(), safe=False) return JsonResponse(data=CommonResponse.error( - msg='未配置CONTAINER_NAME(容器名称)环境变量!!' + msg='未配置CONTAINER_NAME(容器名称)环境变量,请自行重启容器!!' ).to_dict(), safe=False) except Exception as e: return JsonResponse(data=CommonResponse.error( @@ -108,14 +108,17 @@ def do_update(request): p = subprocess.Popen('./update.sh', shell=True, stdout=subprocess.PIPE, bufsize=1) p.wait() - # result = [] - # for i in p.stdout.readlines(): - # print(i) - # result.append(i) + out = p.stdout.readlines() + result = [] + for i in out: + result.append(i.decode('utf8')) + print(result) return JsonResponse(data=CommonResponse.success( - msg='更新成功!!', data={ - 'p': str(p.stdout.readlines()) - } + msg='更新成功!!', + data=result + # data={ + # # 'p': str(p.stdout.readlines()).strip("'").strip('[').strip(']').strip() + # } ).to_dict(), safe=False) except Exception as e: return JsonResponse(data=CommonResponse.error( diff --git a/ptools/settings.py b/ptools/settings.py index 9d0c735..b632ed0 100644 --- a/ptools/settings.py +++ b/ptools/settings.py @@ -204,10 +204,10 @@ SIMPLEUI_CONFIG = { }, { 'app': 'update', 'name': '更新', - 'icon': 'fas fa-shield', + 'icon': 'fas fa-code', 'models': [{ 'name': '重启更新', - 'icon': 'fa fa-refresh', + 'icon': 'far fa-surprise', 'url': '/tasks/restart' }, ] }] diff --git a/templates/auto_pt/restart.html b/templates/auto_pt/restart.html index 2099abd..3fc2e1a 100644 --- a/templates/auto_pt/restart.html +++ b/templates/auto_pt/restart.html @@ -93,7 +93,7 @@ ).then(res => { if (res.data.code === 0) { console.log(res, 1) - this.update_note = res.data.data.p.split(',') + this.update_note = res.data.data this.$message({ type: 'success', message: res.data.msg