删除版本号获取

This commit is contained in:
ui-beam-9 2025-04-29 22:30:43 +08:00
parent ecb30f7aa1
commit 9a320cba65

View File

@ -77,62 +77,6 @@ def safe_print(text):
except Exception as e:
print("[ERROR] Print error: %s" % str(e))
# 获取最新版本号
def get_latest_version():
"""获取最新版本号"""
try:
version_url = "https://gitea.ui-beam.cn/ui_beam/NetEaseDSMonitor/raw/branch/main/VERSION.txt"
# 添加身份验证
username = "bug"
password = "12345678"
auth_string = base64.b64encode('%s:%s' % (username, password))
# 创建请求对象并添加认证头
request = urllib2.Request(version_url)
request.add_header('Authorization', 'Basic %s' % auth_string)
# 尝试不使用代理下载
try:
# 禁用代理
proxy_handler = urllib2.ProxyHandler({})
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)
response = urllib2.urlopen(request, timeout=30)
version = response.read().strip()
return version
except urllib2.URLError as e:
log_message("[WARNING] 不使用代理获取版本失败,尝试使用代理: %s" % str(e))
# 使用代理重试
proxy_handler = urllib2.ProxyHandler({
'http': 'http://CD-WEBPROXY02.yajuenet.internal:8080',
'https': 'http://CD-WEBPROXY02.yajuenet.internal:8080'
})
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)
response = urllib2.urlopen(request, timeout=30)
version = response.read().strip()
return version
except Exception as e:
error_msg = u"获取版本号失败: %s" % unicode(str(e), 'gbk', 'ignore')
log_message("[ERROR] %s" % error_msg)
# 如果获取失败直接从文件URL解析出固定版本号格式
try:
# 搜索files_to_download中最新的版本号
for url_path, _, _ in FILES_TO_DOWNLOAD:
if "VERSION" in url_path.upper():
log_message("[INFO] 尝试从文件路径解析版本号: %s" % url_path)
return "v" + datetime.now().strftime("%Y%m%d%H%M%S")
except:
pass
return u"未知版本"
# 非中文字符界面信息
MESSAGES = {
'tool_title': u"网易大神审核数据监控系统安装工具",