From b40d6397859129e122c8bf4c1b23aebe931a401e Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Thu, 6 Apr 2023 21:31:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=BF=BD=E7=95=A5=E7=AC=AC?= =?UTF-8?q?=E5=9B=9B=E4=BD=8D=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/utils/updater.py | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/pkg/utils/updater.py b/pkg/utils/updater.py index 57f81a9a..8e995ef2 100644 --- a/pkg/utils/updater.py +++ b/pkg/utils/updater.py @@ -34,6 +34,23 @@ def pull_latest(repo_path: str) -> bool: return True +def is_newer_ignored_bugfix_ver(new_tag: str, old_tag: str): + """判断版本是否更新,忽略第四位版本""" + if new_tag == old_tag: + return False + + new_tag = new_tag.split(".") + old_tag = old_tag.split(".") + if len(new_tag) < 4: + return True + + # 合成前三段,判断是否相同 + new_tag = ".".join(new_tag[:3]) + old_tag = ".".join(old_tag[:3]) + + return new_tag != old_tag + + def get_release_list() -> list: """获取发行列表""" rls_list_resp = requests.get( @@ -64,8 +81,12 @@ def update_all(cli: bool = False) -> bool: latest_rls = {} rls_notes = [] + latest_tag_name = "" for rls in rls_list: rls_notes.append(rls['name']) # 使用发行名称作为note + if latest_tag_name == "": + latest_tag_name = rls['tag_name'] + if rls['tag_name'] == current_tag: break @@ -76,7 +97,7 @@ def update_all(cli: bool = False) -> bool: else: print("更新日志: {}".format(rls_notes)) - if latest_rls == {}: # 没有新版本 + if latest_rls == {} and not is_newer_ignored_bugfix_ver(latest_tag_name, current_tag): # 没有新版本 return False # 下载最新版本的zip到temp目录 @@ -227,11 +248,13 @@ def is_new_version_available() -> bool: current_tag = get_current_tag() # 检查是否有新版本 + latest_tag_name = "" for rls in rls_list: - if rls['tag_name'] == current_tag: - return False - else: - return True + if latest_tag_name == "": + latest_tag_name = rls['tag_name'] + break + + return is_newer_ignored_bugfix_ver(latest_tag_name, current_tag) def get_rls_notes() -> list: From d81b457bbadd80fbff59bf29003593bcf9b14a9b Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Thu, 6 Apr 2023 21:34:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=90=8E=E4=B8=8D=E5=B1=95=E7=A4=BA=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=89=8D=E7=89=88=E6=9C=AC=E7=9A=84=E6=9B=B4=E6=96=B0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=20(#340)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/utils/updater.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/utils/updater.py b/pkg/utils/updater.py index 8e995ef2..909adeb6 100644 --- a/pkg/utils/updater.py +++ b/pkg/utils/updater.py @@ -171,9 +171,9 @@ def update_all(cli: bool = False) -> bool: # 通知管理员 if not cli: import pkg.utils.context - pkg.utils.context.get_qqbot_manager().notify_admin("已更新到最新版本: {}\n更新日志:\n{}\n新功能通常可以在config-template.py中看到,完整的更新日志请前往 https://github.com/RockChinQ/QChatGPT/releases 查看".format(current_tag, "\n".join(rls_notes))) + pkg.utils.context.get_qqbot_manager().notify_admin("已更新到最新版本: {}\n更新日志:\n{}\n完整的更新日志请前往 https://github.com/RockChinQ/QChatGPT/releases 查看".format(current_tag, "\n".join(rls_notes[:-1]))) else: - print("已更新到最新版本: {}\n更新日志:\n{}\n新功能通常可以在config-template.py中看到,完整的更新日志请前往 https://github.com/RockChinQ/QChatGPT/releases 查看".format(current_tag, "\n".join(rls_notes))) + print("已更新到最新版本: {}\n更新日志:\n{}\n完整的更新日志请前往 https://github.com/RockChinQ/QChatGPT/releases 查看".format(current_tag, "\n".join(rls_notes[:-1]))) return True