Merge branch 'network_dev' into dev

This commit is contained in:
DLmaster361
2025-07-13 23:00:59 +08:00
9 changed files with 104 additions and 13 deletions

View File

@@ -30,7 +30,6 @@ import zipfile
import requests
import subprocess
import time
import psutil
from functools import partial
from pathlib import Path
@@ -47,6 +46,7 @@ from PySide6.QtCore import QThread, Signal, QTimer, QEventLoop
from typing import List, Dict, Union
from app.core import Config
from app.services import System
@@ -113,7 +113,14 @@ class DownloadProcess(QThread):
start_time = time.time()
response = requests.get(
self.url, headers=headers, timeout=10, stream=True
self.url,
headers=headers,
timeout=10,
stream=True,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
)
if response.status_code not in [200, 206]:
@@ -332,6 +339,10 @@ class DownloadManager(QDialog):
allow_redirects=True,
timeout=10,
stream=True,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
) as response:
if response.status_code == 200:
return response.url
@@ -339,7 +350,14 @@ class DownloadManager(QDialog):
elif self.config["mode"] == "MirrorChyan":
with requests.get(
self.config["url"], allow_redirects=True, timeout=10, stream=True
self.config["url"],
allow_redirects=True,
timeout=10,
stream=True,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
) as response:
if response.status_code == 200:
return response.url
@@ -448,7 +466,14 @@ class DownloadManager(QDialog):
url = self.get_download_url("下载")
self.downloaded_size_list: List[List[int, bool]] = []
response = requests.head(url, timeout=10)
response = requests.head(
url,
timeout=10,
proxies={
"http": Config.get(Config.update_ProxyAddress),
"https": Config.get(Config.update_ProxyAddress),
},
)
self.file_size = int(response.headers.get("content-length", 0))
part_size = self.file_size // self.config["thread_numb"]

View File

@@ -361,6 +361,9 @@ class AUTO_MAA(MSFluentWindow):
# 检查密码
self.setting.check_PASSWORD()
# 获取关卡号信息
Config.get_stage()
# 获取主题图像
if Config.get(Config.function_HomeImageMode) == "主题图像":
self.home.get_home_image()

View File

@@ -1164,6 +1164,15 @@ class UpdaterSettingCard(HeaderCardWidget):
configItem=Config.update_ThreadNumb,
parent=self,
)
self.card_ProxyAddress = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="网络代理地址",
content="使用网络代理软件时,若出现网络连接问题,请尝试设置代理地址,此设置全局生效",
text="请输入代理地址",
qconfig=Config,
configItem=Config.update_ProxyAddress,
parent=self,
)
self.card_ProxyUrlList = UrlListSettingCard(
icon=FluentIcon.SETTING,
title="代理地址列表",
@@ -1196,6 +1205,7 @@ class UpdaterSettingCard(HeaderCardWidget):
Layout.addWidget(self.card_IfAutoUpdate)
Layout.addWidget(self.card_UpdateType)
Layout.addWidget(self.card_ThreadNumb)
Layout.addWidget(self.card_ProxyAddress)
Layout.addWidget(self.card_ProxyUrlList)
Layout.addWidget(self.card_MirrorChyanCDK)
self.viewLayout.addLayout(Layout)