浏览代码

fix(panel-update): poll for restart, fix dark-mode version label

Co-Authored-By: Claude Opus 4.7 <[email protected]>
MHSanaei 2 天之前
父节点
当前提交
59c55dfc92
共有 2 个文件被更改,包括 22 次插入2 次删除
  1. 0 0
      web/assets/css/custom.min.css
  2. 22 2
      web/html/index.html

文件差异内容过多而无法显示
+ 0 - 0
web/assets/css/custom.min.css


+ 22 - 2
web/html/index.html

@@ -1407,14 +1407,34 @@
           class: themeSwitcher.currentTheme,
           cancelText: '{{ i18n "cancel"}}',
           onOk: async () => {
+            const targetVersion = panelUpdateModal.info.latestVersion || '';
+            const baseTip = '{{ i18n "pages.index.dontRefresh"}}';
+            const tipPrefix = targetVersion ? `${baseTip} (${targetVersion})` : baseTip;
             panelUpdateModal.hide();
-            this.loading(true, '{{ i18n "pages.index.dontRefresh"}}');
+            this.loading(true, tipPrefix);
             const msg = await HttpUtil.post('/panel/api/server/updatePanel');
             if (!msg.success) {
               this.loading(false);
               return;
             }
-            await PromiseUtil.sleep(15000);
+
+            // Wait for the running process to exit, then poll the new panel
+            // until it answers (up to ~90s). Reload as soon as it's back.
+            await PromiseUtil.sleep(5000);
+            this.loading(true, tipPrefix);
+            const deadline = Date.now() + 90_000;
+            let back = false;
+            while (Date.now() < deadline) {
+              try {
+                const r = await axios.get('/panel/api/server/status', { timeout: 2000 });
+                if (r && r.data && r.data.success) { back = true; break; }
+              } catch (_) { /* still restarting */ }
+              await PromiseUtil.sleep(2000);
+            }
+            if (back) {
+              this.$message.success('{{ i18n "pages.index.panelUpdateStartedPopover" }}');
+              await PromiseUtil.sleep(800);
+            }
             window.location.reload();
           },
         });

部分文件因为文件数量过多而无法显示