修复:

- 手动点击「检查更新」无视「跳过检查更新」设置:必定输出日志,发现新版本时照常弹窗询问下载(跳过设置只作用于启动时的自动检查)
This commit is contained in:
RoyirinRosmontis
2026-08-24 12:35:41 +08:00
parent 5620f0051e
commit 2120009c8c
+5 -5
View File
@@ -1541,7 +1541,7 @@ class SettingsDialog(QDialog):
parent._update_done.connect(self._on_check_done) parent._update_done.connect(self._on_check_done)
except TypeError: except TypeError:
pass # 已连接过,忽略 pass # 已连接过,忽略
threading.Thread(target=parent._check_update, daemon=True).start() threading.Thread(target=parent._check_update, kwargs={"manual": True}, daemon=True).start()
def _on_check_done(self): def _on_check_done(self):
self.lb_hint.setText("检查完成,结果见主界面日志") self.lb_hint.setText("检查完成,结果见主界面日志")
@@ -2145,14 +2145,14 @@ class MainWindow(QWidget):
self.traffic_up.setText(f"↑{_fmt_bytes(up_rate)}/s") self.traffic_up.setText(f"↑{_fmt_bytes(up_rate)}/s")
self.traffic_down.setText(f"↓{_fmt_bytes(down_rate)}/s") self.traffic_down.setText(f"↓{_fmt_bytes(down_rate)}/s")
self.traffic_total.setText(_fmt_bytes(up_total + down_total)) self.traffic_total.setText(_fmt_bytes(up_total + down_total))
def _check_update(self): def _check_update(self, manual=False):
"""后台检查服务器是否有新版本。""" """后台检查服务器是否有新版本;manual=True 时无视「跳过检查更新」设置。"""
# 先初始化结果,任何路径(含跳过)完成后 _on_update_done 都能安全读取 # 先初始化结果,任何路径(含跳过)完成后 _on_update_done 都能安全读取
self._latest_version = "" self._latest_version = ""
self._download_url = "" self._download_url = ""
try: try:
if _skip_update_check(): if _skip_update_check() and not manual:
return # 设置跳过:不检查也不打日志 return # 设置跳过(仅自动检查):不检查也不打日志
import json, urllib.request import json, urllib.request
# 基于 Gitea 仓库 releases API 检查更新;config.json 无 update_url 时用默认地址 # 基于 Gitea 仓库 releases API 检查更新;config.json 无 update_url 时用默认地址
url = str(_config_val("update_url", "") or "").strip() url = str(_config_val("update_url", "") or "").strip()