mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/jxxghp/MoviePilot.git
synced 2026-09-20 08:03:34 +08:00
fix(update): refresh current application version
This commit is contained in:
@@ -235,12 +235,14 @@ class SystemUpdateManager(metaclass=SingletonClass):
|
||||
return next(item for item in state["updates"] if item["type"] == target)
|
||||
|
||||
def _sync_aggregate(self, state: dict[str, Any]) -> dict[str, Any]:
|
||||
"""从两类明细重新计算旧版顶层字段和汇总进度。"""
|
||||
"""从两类明细重新计算旧版顶层字段、当前版本和汇总进度。"""
|
||||
application = self._get_item(state, _APPLICATION)
|
||||
current_version = get_app_version()
|
||||
application["current_version"] = current_version
|
||||
state.update(
|
||||
{
|
||||
"state": application.get("state", "idle"),
|
||||
"current_version": get_app_version(),
|
||||
"current_version": current_version,
|
||||
"version": application.get("version"),
|
||||
"frontend_version": application.get("frontend_version"),
|
||||
"release_name": application.get("release_name"),
|
||||
|
||||
@@ -153,6 +153,20 @@ def test_check_logs_when_application_is_current(monkeypatch, tmp_path):
|
||||
assert logs == ["MoviePilot 主程序已是最新版本:v3.0.0"]
|
||||
|
||||
|
||||
def test_status_refreshes_stale_application_version(monkeypatch, tmp_path):
|
||||
"""旧状态文件中的主程序版本应在读取时更新为当前运行版本。"""
|
||||
manager = _manager(monkeypatch, tmp_path)
|
||||
monkeypatch.setattr(update_module, "get_app_version", lambda: "v3.0.0")
|
||||
manager._write_item("application", state="idle")
|
||||
|
||||
monkeypatch.setattr(update_module, "get_app_version", lambda: "v3.0.3")
|
||||
status = manager.get_status()
|
||||
application = next(item for item in status.updates if item.type == "application")
|
||||
|
||||
assert status.current_version == "v3.0.3"
|
||||
assert application.current_version == "v3.0.3"
|
||||
|
||||
|
||||
def test_public_download_request_omits_github_authorization(monkeypatch, tmp_path):
|
||||
"""公开归档下载不得复用 GitHub API 的认证请求头。"""
|
||||
manager = _manager(monkeypatch, tmp_path)
|
||||
|
||||
Reference in New Issue
Block a user