diff --git a/auto_pt/views.py b/auto_pt/views.py index 0cfd64e..c3c242f 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -205,14 +205,17 @@ def do_update(request): site_obj = Site.objects.update_or_create(defaults=site_rules, url=site_rules.get('url')) print(site_obj[0].name + (' 规则新增成功!' if site_obj[1] else '规则更新成功!')) print('更新完毕,开始重启') - do_restart(request) + print(request.GET.get('restart')) + flag = request.GET.get('restart') == 'true' + if flag: + do_restart(request) # cid = socket.gethostname() # reboot = subprocess.Popen('docker restart {}'.format(cid), shell=True, stdout=subprocess.PIPE, ) # out = reboot.stdout.readline().decode('utf8') # client.api.inspect_container(cid) # StartedAt = client.api.inspect_container(cid).get('State').get('StartedAt') return JsonResponse(data=CommonResponse.error( - msg='更新成功,重启指令发送成功,容器重启中 ...' + msg='更新成功,重启指令发送成功,容器重启中 ...' if flag else '更新成功,未映射docker路径请手动重启容器 ...' ).to_dict(), safe=False) except Exception as e: return JsonResponse(data=CommonResponse.error( diff --git a/templates/111.html b/templates/111.html deleted file mode 100644 index 11388b8..0000000 --- a/templates/111.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - Title - - - - -
- PTools更新日志 - -
- -
-
-
v2022.08.13
-
-
- - - -
- - -
    -
  1. -

    正式命名为PTools,感谢群友

    -
  2. -
  3. 支持铂金家

  4. -
  5. 提供了通用配置,可自行添加站点(网站细节不同,不保证能用)

  6. -
  7. 支持数据导入导出

  8. -
  9. 提供docker,支持映射数据库文件

  10. -
-
- -
    -
  1. 增加时魔

  2. -
  3. 优化签到信息显示
  4. -
  5. 优化个人数据通知
  6. -
-
- -
    -
  1. 增加HD天空验证码签到功能开关

  2. -
-
- -
    -
  1. 增加HD天空验证码签到功能

  2. -
  3. 打包第二版docker进行测试,无数据备份

  4. -
-
- -
    -
  1. 实现企业微信通知,需要自行抓取个人公网IP

  2. -
-
- -
    -
  1. 实现签到、拉取个人数据以及拉取首页促销种子的自动化

  2. -
  3. 打包第一版docker进行测试,无数据备份

  4. -
-
- -
    -
  1. 优化代码,降低数据库读写频次
  2. -
-
- -
    -
  1. 开启多线程模式,大幅降低等待时间
  2. -
-
-
-
-
-
-
- - \ No newline at end of file diff --git a/templates/auto_pt/restart.html b/templates/auto_pt/restart.html deleted file mode 100644 index ef31073..0000000 --- a/templates/auto_pt/restart.html +++ /dev/null @@ -1,255 +0,0 @@ -{% load static %} - - - - - - -
- -
- - 更新提示 - - {{ update_tips }} + 容器已运行:{{ delta }} - - - -{# 刷新页面#} - - 规则更新 - - - 代码更新 - - - 重启容器 - - - -
-
- - -
    -
  • -
-
-
- - - -
- 本地日志 -
- - - -

-

-
- -
-
-
-
- - -
- 更新日志 -
- - - -

-

-
- -
-
-
-
-
- -
-
-
- - - - - - diff --git a/templates/auto_pt/update.html b/templates/auto_pt/update.html index 7ef3d68..e0982e7 100644 --- a/templates/auto_pt/update.html +++ b/templates/auto_pt/update.html @@ -23,8 +23,34 @@ - 重启更新 - 重启 + + 重启更新 + + + 重启 + + + 更新 +
@@ -95,7 +121,7 @@ update_notes: {{ update_notes | safe }}, local_logs: {{ local_logs | safe }}, {#local_log: [],#} - {#update_log: [],#} + restart: {{ restart }}, update: {{ update }}, local_log_width: 24, }, @@ -148,14 +174,19 @@ }); }, - do_update() { + do_update(restart) { + console.log(restart) this.$confirm('此操作会拉取软件更新软件,并重启容器,是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { axios.get( - "{% url "do_update" %}" + "{% url "do_update" %}", { + params: { + restart: restart + } + } ).then(res => { if (res.data.code === 0) { console.log(res, 1)