diff --git a/auto_pt/views.py b/auto_pt/views.py index 711e14d..8e924f1 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -314,6 +314,9 @@ def update_page(request): # 获取docker对象 client = docker.from_env() # 从内部获取容器id + cid = '' + delta = 0 + restart = 'false' for c in client.api.containers(): if 'ngfchl/ptools' in c.get('Image'): cid = c.get('Id') @@ -379,6 +382,8 @@ def do_update(request): del site_rules['id'] site_obj = Site.objects.update_or_create(defaults=site_rules, url=site_rules.get('url')) logger.info(site_obj[0].name + (' 规则新增成功!' if site_obj[1] else '规则更新成功!')) + logger.info('更新完毕') + """ logger.info('更新完毕,开始重启') cid = request.GET.get('cid') flag = (cid == '') @@ -390,6 +395,10 @@ def do_update(request): return JsonResponse(data=CommonResponse.error( msg='更新成功,重启指令发送成功,容器重启中 ...' if not flag else '更新成功,未映射docker路径请手动重启容器 ...' ).to_dict(), safe=False) + """ + return JsonResponse(data=CommonResponse.error( + msg='更新成功,刷新页面后享用!' + ).to_dict(), safe=False) except Exception as e: # raise return JsonResponse(data=CommonResponse.error( diff --git a/templates/auto_pt/update.html b/templates/auto_pt/update.html index 310c109..3a33bda 100644 --- a/templates/auto_pt/update.html +++ b/templates/auto_pt/update.html @@ -9,33 +9,33 @@
- - 重启更新 - - + {# #} + {# 重启更新#} + {# #} + {# #} - 重启 + 重启 + content="如果更新后更新功能未生效,请重启容器!!"> 更新 + v-if="update">更新