From bd0d96eb9ded5a2f9465e3db335de9ef3f34c28b Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Tue, 6 Sep 2022 00:52:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/version.txt | 1 + utils/update.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 js/version.txt create mode 100644 utils/update.py diff --git a/js/version.txt b/js/version.txt new file mode 100644 index 0000000..711ee4f --- /dev/null +++ b/js/version.txt @@ -0,0 +1 @@ +3.1.3 \ No newline at end of file diff --git a/utils/update.py b/utils/update.py new file mode 100644 index 0000000..d3149cb --- /dev/null +++ b/utils/update.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# File : update.py +# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------ +# Date : 2022/9/6 + +import requests +import os + +def getLocalVer(): + base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录 + version_path = os.path.join(base_path, f'js/version.txt') + if not os.path.exists(version_path): + with open(version_path,mode='w+',encoding='utf-8') as f: + version = '1.0.0' + f.write(version) + else: + with open(version_path,encoding='utf-8') as f: + version = f.read() + return version + +def getOnlineVer(): + ver = '1.0.1' + try: + r = requests.get('',timeout=(2,2)) + ver = r.text + except Exception as e: + print(f'{e}') + return ver \ No newline at end of file -- GitLab