From 115234ac246a131d7e929487efbc733047ba05bc Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Thu, 22 Feb 2024 17:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E5=8E=BB=E6=9C=80=E6=96=B0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/api/api.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pywxdump/api/api.py b/pywxdump/api/api.py index 7b8e647..995163c 100644 --- a/pywxdump/api/api.py +++ b/pywxdump/api/api.py @@ -573,6 +573,31 @@ def merge(): # END 这部分为专业工具的api +# 检查更新 +@api.route('/api/check_update', methods=["GET", 'POST']) +@error9999 +def check_update(): + """ + 检查更新 + :return: + """ + url = "https://api.github.com/repos/xaoyaoo/PyWxDump/tags" + try: + import requests + res = requests.get(url) + if res.status_code == 200: + data = res.json() + NEW_VERSION = data[0].get("name") + if NEW_VERSION[1:] != pywxdump.__version__: + return ReJson(0, NEW_VERSION) + else: + return ReJson(2001, body="已经是最新版本") + else: + return ReJson(2001, body="status_code is not 200") + except Exception as e: + return ReJson(9999, msg=str(e)) +# END 检查更新 + @api.route('/') @error9999