Skip to content

feat(update): 允许关闭自动下载并保留手动下载入口 - #420

Closed
MistEO wants to merge 3 commits into
mainfrom
codex/issue-362
Closed

MistEO wants to merge 3 commits into
mainfrom
codex/issue-362

Conversation

@MistEO

@MistEO MistEO commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

更新设置提供默认开启的「自动下载更新」开关。关闭后仍检查并提示新版本,设置页和更新气泡均可明确点击「立即下载」;进行中切换下载源可继续。

设置页手动下载成功后保存完整待安装元信息及实际下载路径,重启可恢复;纯预览在后端与静态配置均不可用时也恢复空实例的本地偏好,有效主机配置始终优先。

AI 意见复核:UpdatePanel 原本已保存待安装信息;completed 状态在自动检查前/返回后均受 busy 保护,不会重复下载。多客户端整份旧配置覆盖由 #423 的条件写入处理。

验证:63 项测试、构建和格式检查通过。生产组件/配置服务回归可捕获修改前的两处遗漏;浏览器验证保存、重载恢复、失败下载、检查期间完成下载及手动入口。

Closes #362.

AI 使用信息:

  • Agent:Codex /root(实现与审查);模型:GPT-6(具体变体未知);思考强度:未知。
  • Agent:Codex /root/fix_proxy(初审与浏览器验证);模型:GPT-6(具体变体未知);思考强度:未知。
  • Agent:Codex /root/export_screencap(复核修复与组合验证);模型:GPT-6(具体变体未知);思考强度:未知。

Copilot AI balanced review requested due to automatic review settings November 4, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T10:49:28.586325Z 54009e8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 54009e84b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好 - 我发现了 4 个问题

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/components/UpdatePanel.tsx" line_range="360-366" />
<code_context>
-              <span>{t('mirrorChyan.preparingDownload')}</span>
-            </div>
+            <button
+              onClick={() => startDownload()}
+              className="flex items-center gap-2 px-3 py-2 text-sm bg-accent text-white hover:bg-accent-hover rounded-lg transition-colors"
+            >
+              <Download className="w-4 h-4" />
+              {t('mirrorChyan.downloadNow')}
+            </button>
           )}
         </div>
       </div>
</code_context>
<issue_to_address>
**Downloaded updates disappear after restart**

When a user starts a manual download from either update panel and exits before installing it, the manual `startDownload` handlers do not save pending-update information after a successful download, so startup cannot restore the package for installation and the user must find or download it again.

Save the pending-update information after a successful manual download in both update panels.

Also at `src/components/settings/UpdateSection.tsx:683-690`.
</issue_to_address>

### Comment 2
<location path="src/App.tsx" line_range="764" />
<code_context>
-        // 无实例时单独恢复定时检查偏好
+        // 无实例时单独恢复更新偏好
         const state = useAppStore.getState();
+        state.setAutoDownloadUpdates(config.settings.autoDownloadUpdates !== false);
         state.setScheduledUpdateCheckEnabled(config.settings.scheduledUpdateCheckEnabled === true);
         state.setScheduledUpdateCheckTime(
</code_context>
<issue_to_address>
**Disabled auto-downloads turn back on**

When the saved auto-download preference is false and startup has no instances, the no-instance restore path applies the fetched or fallback config instead of the saved browser preference, so `setAutoDownloadUpdates` restores `true` and automatic downloads resume.

Restore the saved auto-download preference when loading a config with no instances.
</issue_to_address>

### Comment 3
<location path="src/stores/appStore.ts" line_range="2520" />
<code_context>
           confirmBeforeDelete: state.confirmBeforeDelete,
           maxLogsPerInstance: state.maxLogsPerInstance,
           autoClearLogsOnLaunch: state.autoClearLogsOnLaunch,
+          autoDownloadUpdates: state.autoDownloadUpdates,
           scheduledUpdateCheckEnabled: state.scheduledUpdateCheckEnabled,
           scheduledUpdateCheckTime: state.scheduledUpdateCheckTime,
</code_context>
<issue_to_address>
**Concurrent save restores downloads**

When multiple clients edit the same config before the stale client processes the other client’s config-changed event, a stale client serializes its old `autoDownloadUpdates: true` value in the full config after another client saves `false`; the later save overwrites that preference, so automatic downloads are re-enabled and the user can receive an update download they disabled.

Merge settings against the latest config or reject stale writes using a revision/version check.

Also at `src/stores/appStore.ts:2617`.
</issue_to_address>

### Comment 4
<location path="src/components/UpdatePanel.tsx" line_range="360-366" />
<code_context>
-              <span>{t('mirrorChyan.preparingDownload')}</span>
-            </div>
+            <button
+              onClick={() => startDownload()}
+              className="flex items-center gap-2 px-3 py-2 text-sm bg-accent text-white hover:bg-accent-hover rounded-lg transition-colors"
+            >
+              <Download className="w-4 h-4" />
+              {t('mirrorChyan.downloadNow')}
+            </button>
           )}
         </div>
       </div>
</code_context>
<issue_to_address>
**Completed manual updates download again**

When a user downloads an update manually with auto-download off, re-enables auto-download before installing it, and a later startup or scheduled check finds the same update, the manual-download handlers do not set `downloadStartedRef`; later `startAutoDownload` checks only that ref, the URL, and the current preference—not whether a manual download already completed. After auto-download is re-enabled, a subsequent check of the same version starts another download, wasting bandwidth and replacing the completed status.

Have automatic checks recognize an already-completed download for the reported update and skip downloading it again.

Also at `src/components/settings/UpdateSection.tsx:683-690`.
</issue_to_address>

关联问题

#362 建议为「启动时自动检查/下载更新」增加用户可控开关 · 1 of 1 met

# Requirement Status Notes
1 让自动下载更新可选,避免强制下载。 ✅ Met 新增默认开启的自动下载开关;关闭时仍检查并提示更新,更新设置页和更新气泡均提供手动下载入口。

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Original comment in English

Hey - I've found 4 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/components/UpdatePanel.tsx" line_range="360-366" />
<code_context>
-              <span>{t('mirrorChyan.preparingDownload')}</span>
-            </div>
+            <button
+              onClick={() => startDownload()}
+              className="flex items-center gap-2 px-3 py-2 text-sm bg-accent text-white hover:bg-accent-hover rounded-lg transition-colors"
+            >
+              <Download className="w-4 h-4" />
+              {t('mirrorChyan.downloadNow')}
+            </button>
           )}
         </div>
       </div>
</code_context>
<issue_to_address>
**Downloaded updates disappear after restart**

When a user starts a manual download from either update panel and exits before installing it, the manual `startDownload` handlers do not save pending-update information after a successful download, so startup cannot restore the package for installation and the user must find or download it again.

Save the pending-update information after a successful manual download in both update panels.

Also at `src/components/settings/UpdateSection.tsx:683-690`.
</issue_to_address>

### Comment 2
<location path="src/App.tsx" line_range="764" />
<code_context>
-        // 无实例时单独恢复定时检查偏好
+        // 无实例时单独恢复更新偏好
         const state = useAppStore.getState();
+        state.setAutoDownloadUpdates(config.settings.autoDownloadUpdates !== false);
         state.setScheduledUpdateCheckEnabled(config.settings.scheduledUpdateCheckEnabled === true);
         state.setScheduledUpdateCheckTime(
</code_context>
<issue_to_address>
**Disabled auto-downloads turn back on**

When the saved auto-download preference is false and startup has no instances, the no-instance restore path applies the fetched or fallback config instead of the saved browser preference, so `setAutoDownloadUpdates` restores `true` and automatic downloads resume.

Restore the saved auto-download preference when loading a config with no instances.
</issue_to_address>

### Comment 3
<location path="src/stores/appStore.ts" line_range="2520" />
<code_context>
           confirmBeforeDelete: state.confirmBeforeDelete,
           maxLogsPerInstance: state.maxLogsPerInstance,
           autoClearLogsOnLaunch: state.autoClearLogsOnLaunch,
+          autoDownloadUpdates: state.autoDownloadUpdates,
           scheduledUpdateCheckEnabled: state.scheduledUpdateCheckEnabled,
           scheduledUpdateCheckTime: state.scheduledUpdateCheckTime,
</code_context>
<issue_to_address>
**Concurrent save restores downloads**

When multiple clients edit the same config before the stale client processes the other client’s config-changed event, a stale client serializes its old `autoDownloadUpdates: true` value in the full config after another client saves `false`; the later save overwrites that preference, so automatic downloads are re-enabled and the user can receive an update download they disabled.

Merge settings against the latest config or reject stale writes using a revision/version check.

Also at `src/stores/appStore.ts:2617`.
</issue_to_address>

### Comment 4
<location path="src/components/UpdatePanel.tsx" line_range="360-366" />
<code_context>
-              <span>{t('mirrorChyan.preparingDownload')}</span>
-            </div>
+            <button
+              onClick={() => startDownload()}
+              className="flex items-center gap-2 px-3 py-2 text-sm bg-accent text-white hover:bg-accent-hover rounded-lg transition-colors"
+            >
+              <Download className="w-4 h-4" />
+              {t('mirrorChyan.downloadNow')}
+            </button>
           )}
         </div>
       </div>
</code_context>
<issue_to_address>
**Completed manual updates download again**

When a user downloads an update manually with auto-download off, re-enables auto-download before installing it, and a later startup or scheduled check finds the same update, the manual-download handlers do not set `downloadStartedRef`; later `startAutoDownload` checks only that ref, the URL, and the current preference—not whether a manual download already completed. After auto-download is re-enabled, a subsequent check of the same version starts another download, wasting bandwidth and replacing the completed status.

Have automatic checks recognize an already-completed download for the reported update and skip downloading it again.

Also at `src/components/settings/UpdateSection.tsx:683-690`.
</issue_to_address>

Linked issues

#362 建议为「启动时自动检查/下载更新」增加用户可控开关 · 1 of 1 met

# Requirement Status Notes
1 让自动下载更新可选,避免强制下载。 ✅ Met 新增默认开启的自动下载开关;关闭时仍检查并提示更新,更新设置页和更新气泡均提供手动下载入口。

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/components/UpdatePanel.tsx Resolved
Comment thread src/App.tsx Resolved
Comment thread src/stores/appStore.ts Resolved
Comment thread src/components/UpdatePanel.tsx Resolved
@MistEO MistEO closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

建议为「启动时自动检查/下载更新」增加用户可控开关

2 participants