回退到v20250414155609
This commit is contained in:
parent
fa68a3dc3f
commit
5faaeb3891
1
VERSION.txt
Normal file
1
VERSION.txt
Normal file
@ -0,0 +1 @@
|
||||
v20250414155609
|
@ -27,7 +27,7 @@ except:
|
||||
|
||||
# 基本配置
|
||||
#COS_URL = "http://cos.ui-beam.com/work_scripts/monitor/dev/latest/"
|
||||
COS_URL = "https://gitea.ui-beam.cn/ui_beam/NetEaseDSMonitor/raw/branch/main/"
|
||||
COS_URL = "https://gitea.ui-beam.cn/ui_beam/NetEaseDSMonitor/raw/branch/main"
|
||||
TEMP_DIR = os.path.join(os.path.expanduser("~"), "Desktop", "monitor_temp")
|
||||
LOG_FILE = os.path.join(TEMP_DIR, "download_log.txt")
|
||||
|
||||
@ -204,17 +204,43 @@ def download_file(url_path, local_path, use_proxy=False):
|
||||
'https': 'http://CD-WEBPROXY02.yajuenet.internal:8080'
|
||||
})
|
||||
opener = urllib2.build_opener(proxy_handler)
|
||||
|
||||
# 添加基本身份验证
|
||||
username = "bug"
|
||||
password = "123454678"
|
||||
auth_string = base64.b64encode('%s:%s' % (username, password))
|
||||
opener.addheaders = [('Authorization', 'Basic %s' % auth_string)]
|
||||
|
||||
urllib2.install_opener(opener)
|
||||
else:
|
||||
# 禁用代理
|
||||
# 禁用代理,但仍添加基本身份验证
|
||||
proxy_handler = urllib2.ProxyHandler({})
|
||||
opener = urllib2.build_opener(proxy_handler)
|
||||
|
||||
# 添加基本身份验证
|
||||
username = "bug"
|
||||
password = "12345678"
|
||||
auth_string = base64.b64encode('%s:%s' % (username, password))
|
||||
opener.addheaders = [('Authorization', 'Basic %s' % auth_string)]
|
||||
|
||||
urllib2.install_opener(opener)
|
||||
|
||||
# 下载文件
|
||||
response = urllib2.urlopen(full_url, timeout=30)
|
||||
content = response.read()
|
||||
|
||||
# 检查是否是批处理文件,如果是则进行行尾转换
|
||||
is_batch_file = url_path.lower().endswith('.bat') or url_path.lower().endswith('.cmd')
|
||||
|
||||
if is_batch_file:
|
||||
log_message("[INFO] 批处理文件行尾转换: %s" % local_path)
|
||||
# 将LF转换为CRLF
|
||||
content_str = content.replace('\n', '\r\n')
|
||||
# 确保没有重复的\r\n
|
||||
content_str = content_str.replace('\r\r\n', '\r\n')
|
||||
# 转回二进制
|
||||
content = content_str
|
||||
|
||||
# 写入文件
|
||||
with open(full_local_path, 'wb') as f:
|
||||
f.write(content)
|
||||
|
Loading…
x
Reference in New Issue
Block a user