From 4d51a7620e0063d6aa8e3776d25f85ea9d1daf01 Mon Sep 17 00:00:00 2001 From: qinglong Date: Sun, 14 Jun 2026 15:58:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20version.json=E5=88=87=E5=9B=9Edev?= =?UTF-8?q?=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 8a59105..f1bc2c0 100644 --- a/version.json +++ b/version.json @@ -1,7 +1,7 @@ { "framework": { "version": "v0.8.0", - "url": "https://git.yeij.top/AskaEth/SenSu/archive/main.zip", + "url": "https://git.yeij.top/AskaEth/SenSu/archive/dev.zip", "notes": "Sentinel横版折线图+磁盘分区+负载/SWAP/温度 | Windows兼容 | 自动更新+备份回滚 | 插件导入安装 | 安全加固29项" }, "plugins": { From 3f5b01f8172acc8501b567fe070b5d19c663f704 Mon Sep 17 00:00:00 2001 From: qinglong Date: Sun, 14 Jun 2026 16:03:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E4=BB=8Eversion.json=E8=AF=BB=E5=8F=96=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=88=A0version=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/framework/base_config.yaml.example | 1 - services/update_service.py | 31 +++++++++++------------ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/config/framework/base_config.yaml.example b/config/framework/base_config.yaml.example index 7a92c0f..52b7419 100644 --- a/config/framework/base_config.yaml.example +++ b/config/framework/base_config.yaml.example @@ -1,7 +1,6 @@ framework: debug: true name: SenSu - version: v0.8.0 branch: dev repo_url: https://git.yeij.top/AskaEth/SenSu logging: diff --git a/services/update_service.py b/services/update_service.py index 54f4774..1be15db 100644 --- a/services/update_service.py +++ b/services/update_service.py @@ -149,11 +149,16 @@ class UpdateService: return None def _current_version(self) -> str: + """从 version.json 读取本地版本号""" try: - init = self.sm.get_service("init") - return init.get_config("base").get("framework", {}).get("version", "0.0.0").lstrip("vV") + vf = _PROJECT_ROOT / "version.json" + if vf.exists(): + with open(vf) as f: + data = json.load(f) + return data.get("framework", {}).get("version", "0.0.0").lstrip("vV") except Exception: - return "0.0.0" + pass + return "0.0.0" # ── 执行更新 ── @@ -250,21 +255,15 @@ class UpdateService: # 4.5 同步版本号到旧配置文件 try: - old_cfg_path = str(_PROJECT_ROOT / "config" / "framework" / "base_config.yaml") - new_tpl_path = str(_PROJECT_ROOT / "config" / "framework" / "base_config.yaml.example") - if os.path.exists(old_cfg_path) and os.path.exists(new_tpl_path): - import yaml as _yaml - with open(new_tpl_path) as f: - new_tpl = _yaml.safe_load(f) - new_ver = new_tpl.get("framework", {}).get("version", "") + # 同步版本号到 version.json + vf = _PROJECT_ROOT / "version.json" + if vf.exists(): + with open(vf) as f: + vdata = json.load(f) + new_ver = vdata.get("framework", {}).get("version", "") if new_ver: - with open(old_cfg_path) as f: - old_cfg = _yaml.safe_load(f) or {} - old_cfg.setdefault("framework", {})["version"] = new_ver - with open(old_cfg_path, "w") as f: - _yaml.dump(old_cfg, f, default_flow_style=False, allow_unicode=True) self._log(f"版本号已同步: {new_ver}") - logger.info(f"📝 版本号已同步: {new_ver}") + logger.info(f"📝 版本号已同步: {new_ver}") except Exception as e: logger.warning(f"版本号同步失败: {e}") From b29b236a52e1eac8f717b618476fac33e9b07c2f Mon Sep 17 00:00:00 2001 From: qinglong Date: Sun, 14 Jun 2026 16:04:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20version.json=E2=86=92main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index f1bc2c0..8a59105 100644 --- a/version.json +++ b/version.json @@ -1,7 +1,7 @@ { "framework": { "version": "v0.8.0", - "url": "https://git.yeij.top/AskaEth/SenSu/archive/dev.zip", + "url": "https://git.yeij.top/AskaEth/SenSu/archive/main.zip", "notes": "Sentinel横版折线图+磁盘分区+负载/SWAP/温度 | Windows兼容 | 自动更新+备份回滚 | 插件导入安装 | 安全加固29项" }, "plugins": {