fix(ci): 适配新下载站模式

This commit is contained in:
DLmaster361
2025-05-06 17:42:24 +08:00
parent fd75dda2b1
commit 890886d62d
7 changed files with 113 additions and 133 deletions

View File

@@ -136,11 +136,3 @@ jobs:
gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_release_note gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_release_note
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -p ${{ secrets.SSH_PORT }} -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
- name: Upload Release to Server
run: scp -P ${{ secrets.SSH_PORT }} -r artifacts/* ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:/mnt/data/AUTO_MAA/

View File

@@ -536,7 +536,7 @@ class MaaUserConfig(QConfig):
"Info", "Info",
"SeriesNumb", "SeriesNumb",
"1", "1",
OptionsValidator(["1000", "6", "5", "4", "3", "2", "1"]), OptionsValidator(["1000", "6", "5", "4", "3", "2", "1", "-1"]),
) )
self.Info_GameId = ConfigItem("Info", "GameId", "-") self.Info_GameId = ConfigItem("Info", "GameId", "-")
self.Info_GameId_1 = ConfigItem("Info", "GameId_1", "-") self.Info_GameId_1 = ConfigItem("Info", "GameId_1", "-")

View File

@@ -315,119 +315,120 @@ class MemberManager(QWidget):
def member_downloader(self): def member_downloader(self):
"""脚本下载器""" """脚本下载器"""
if not Config.get(Config.update_MirrorChyanCDK):
logger.warning("脚本下载器未设置CDK")
MainInfoBar.push_info_bar(
"warning",
"未设置Mirror酱CDK",
"下载器依赖于Mirror酱未设置CDK时无法使用",
5000,
)
return None
choice = ComboBoxMessageBox( choice = ComboBoxMessageBox(
self.window(), self.window(),
"选择一个脚本类型以下载相应脚本", "选择一个脚本类型以下载相应脚本",
["选择脚本类型"], ["选择脚本类型"],
[["MAA"]], [["MAA", "StarRailAssistant"]],
) )
if choice.exec() and choice.input[0].currentIndex() != -1: if choice.exec() and choice.input[0].currentIndex() != -1:
if choice.input[0].currentText() == "MAA": app_name = choice.input[0].currentText()
(Config.app_path / "script/MAA").mkdir(parents=True, exist_ok=True) (Config.app_path / f"script/{app_name}").mkdir(parents=True, exist_ok=True)
folder = QFileDialog.getExistingDirectory( folder = QFileDialog.getExistingDirectory(
self, "选择MAA下载目录", str(Config.app_path / "script/MAA") self,
f"选择{app_name}下载目录",
str(Config.app_path / f"script/{app_name}"),
)
if not folder:
logger.warning(f"选择{app_name}下载目录时未选择文件夹")
MainInfoBar.push_info_bar(
"warning", "警告", f"未选择{app_name}下载目录", 5000
) )
if not folder: return None
logger.warning("选择MAA下载目录时未选择文件夹")
MainInfoBar.push_info_bar(
"warning", "警告", "未选择MAA下载目录", 5000
)
return None
# 从mirrorc服务器获取最新版本信息 if app_name in ["MAA"]:
Network.set_info(
mode="get",
url=f"https://mirrorchyan.com/api/resources/MAA/latest?user_agent=AutoMaaGui&cdk={Crypto.win_decryptor(Config.get(Config.update_MirrorChyanCDK))}&os=win&arch=x64&channel=stable",
)
Network.start()
Network.loop.exec()
if Network.stutus_code == 200:
maa_info = Network.response_json
else:
if Network.response_json: url = f"https://mirrorchyan.com/api/resources/{app_name}/latest?user_agent=AutoMaaGui&cdk={Crypto.win_decryptor(Config.get(Config.update_MirrorChyanCDK))}&os=win&arch=x64&channel=stable"
maa_info = Network.response_json elif app_name in ["StarRailAssistant"]:
if maa_info["code"] != 0: url = f"https://mirrorchyan.com/api/resources/{app_name}/latest?user_agent=AutoMaaGui&cdk={Crypto.win_decryptor(Config.get(Config.update_MirrorChyanCDK))}&channel=stable"
logger.error(f"获取版本信息时出错:{maa_info["msg"]}") # 从mirrorc服务器获取最新版本信息
Network.set_info(mode="get", url=url)
Network.start()
Network.loop.exec()
if Network.stutus_code == 200:
app_info = Network.response_json
else:
error_remark_dict = { if Network.response_json:
1001: "获取版本信息的URL参数不正确",
7001: "填入的 CDK 已过期",
7002: "填入的 CDK 错误",
7003: "填入的 CDK 今日下载次数已达上限",
7004: "填入的 CDK 类型和待下载的资源不匹配",
7005: "填入的 CDK 已被封禁",
8001: "对应架构和系统下的资源不存在",
8002: "错误的系统参数",
8003: "错误的架构参数",
8004: "错误的更新通道参数",
1: maa_info["msg"],
}
if maa_info["code"] in error_remark_dict: app_info = Network.response_json
MainInfoBar.push_info_bar(
"error",
"获取版本信息时出错",
error_remark_dict[maa_info["code"]],
-1,
)
else:
MainInfoBar.push_info_bar(
"error",
"获取版本信息时出错",
"意料之外的错误,请及时联系项目组以获取来自 Mirror 酱的技术支持",
-1,
)
return None if app_info["code"] != 0:
logger.warning(f"获取版本信息时出错:{Network.error_message}") logger.error(f"获取版本信息时出错:{app_info["msg"]}")
MainInfoBar.push_info_bar(
"warning",
"获取版本信息时出错",
f"网络错误:{Network.stutus_code}",
5000,
)
return None
maa_version = list( error_remark_dict = {
map( 1001: "获取版本信息的URL参数不正确",
int, 7001: "填入的 CDK 已过期",
maa_info["data"]["version_name"][1:] 7002: "填入的 CDK 错误",
.replace("-beta", "") 7003: "填入的 CDK 今日下载次数已达上限",
.split("."), 7004: "填入的 CDK 类型和待下载的资源不匹配",
) 7005: "填入的 CDK 已被封禁",
) 8001: "对应架构和系统下的资源不存在",
while len(maa_version) < 4: 8002: "错误的系统参数",
maa_version.append(0) 8003: "错误的架构参数",
8004: "错误的更新通道参数",
self.downloader = DownloadManager( 1: app_info["msg"],
Path(folder),
"MAA",
maa_version,
(
{
"mode": "MirrorChyan",
"thread_numb": 1,
"url": maa_info["data"]["url"],
} }
if "url" in maa_info["data"]
else { if app_info["code"] in error_remark_dict:
"mode": "Proxy", MainInfoBar.push_info_bar(
"thread_numb": Config.get(Config.update_ThreadNumb), "error",
} "获取版本信息时出错",
), error_remark_dict[app_info["code"]],
-1,
)
else:
MainInfoBar.push_info_bar(
"error",
"获取版本信息时出错",
"意料之外的错误,请及时联系项目组以获取来自 Mirror 酱的技术支持",
-1,
)
return None
logger.warning(f"获取版本信息时出错:{Network.error_message}")
MainInfoBar.push_info_bar(
"warning",
"获取版本信息时出错",
f"网络错误:{Network.stutus_code}",
5000,
) )
self.downloader.setWindowIcon( return None
QIcon(str(Config.app_path / "resources/icons/AUTO_MAA_Updater.ico"))
) self.downloader = DownloadManager(
self.downloader.show() Path(folder),
self.downloader.run() app_name,
None,
{
"mode": "MirrorChyan",
"thread_numb": 1,
"url": app_info["data"]["url"],
},
)
self.downloader.setWindowTitle("AUTO_MAA下载器 - Mirror酱渠道")
self.downloader.setWindowIcon(
QIcon(str(Config.app_path / "resources/icons/MirrorChyan.ico"))
)
self.downloader.show()
self.downloader.run()
def show_password(self): def show_password(self):
@@ -1425,7 +1426,7 @@ class MemberManager(QWidget):
icon=FluentIcon.GAME, icon=FluentIcon.GAME,
title="连战次数", title="连战次数",
content="连战次数较大时建议搭配剩余理智关卡使用", content="连战次数较大时建议搭配剩余理智关卡使用",
texts=["AUTO", "6", "5", "4", "3", "2", "1"], texts=["AUTO", "6", "5", "4", "3", "2", "1", "不选择"],
qconfig=self.config, qconfig=self.config,
configItem=self.config.Info_SeriesNumb, configItem=self.config.Info_SeriesNumb,
parent=self, parent=self,

View File

@@ -15,7 +15,7 @@
AppId={{D116A92A-E174-4699-B777-61C5FD837B19} AppId={{D116A92A-E174-4699-B777-61C5FD837B19}
AppName={#MyAppName} AppName={#MyAppName}
AppVersion={#MyAppVersion} AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion} AppVerName={#MyAppName}
AppPublisher={#MyAppPublisher} AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL} AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL} AppSupportURL={#MyAppURL}
@@ -71,7 +71,7 @@ var
function InitializeUninstall: Boolean; function InitializeUninstall: Boolean;
begin begin
DeleteDataQuestion := MsgBox('您是否要移除所有用户数据文件与子组件?', mbConfirmation, MB_YESNO) = IDYES; DeleteDataQuestion := MsgBox('您确认要完全移除 AUTO_MAA 的所有用户数据文件与子组件', mbConfirmation, MB_YESNO) = IDYES;
Result := True; Result := True;
end; end;
@@ -79,15 +79,11 @@ procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin begin
if CurUninstallStep = usPostUninstall then if CurUninstallStep = usPostUninstall then
begin begin
if DeleteDataQuestion then
begin
DelTree(ExpandConstant('{app}\config'), True, True, True);
DelTree(ExpandConstant('{app}\data'), True, True, True);
DelTree(ExpandConstant('{app}\debug'), True, True, True);
DelTree(ExpandConstant('{app}\history'), True, True, True);
DelTree(ExpandConstant('{app}\script'), True, True, True);
end;
DelTree(ExpandConstant('{app}\app'), True, True, True); DelTree(ExpandConstant('{app}\app'), True, True, True);
DelTree(ExpandConstant('{app}\resources'), True, True, True); DelTree(ExpandConstant('{app}\resources'), True, True, True);
if DeleteDataQuestion then
begin
DelTree(ExpandConstant('{app}'), True, True, True);
end;
end; end;
end; end;

View File

@@ -266,14 +266,14 @@ class DownloadManager(QDialog):
def run(self) -> None: def run(self) -> None:
if self.name == "MAA": if self.name == "AUTO_MAA":
self.download_task1()
elif self.name == "AUTO_MAA":
if self.config["mode"] == "Proxy": if self.config["mode"] == "Proxy":
self.test_speed_task1() self.test_speed_task1()
self.speed_test_accomplish.connect(self.download_task1) self.speed_test_accomplish.connect(self.download_task1)
elif self.config["mode"] == "MirrorChyan": elif self.config["mode"] == "MirrorChyan":
self.download_task1() self.download_task1()
elif self.config["mode"] == "MirrorChyan":
self.download_task1()
def get_download_url(self, mode: str) -> Union[str, Dict[str, str]]: def get_download_url(self, mode: str) -> Union[str, Dict[str, str]]:
"""获取下载链接""" """获取下载链接"""
@@ -300,23 +300,6 @@ class DownloadManager(QDialog):
elif mode == "下载": elif mode == "下载":
if self.name == "MAA":
if self.config["mode"] == "Proxy":
return f"https://jp-download.fearr.xyz/MAA/MAA-{version_text(self.version)}-win-x64.zip"
elif self.config["mode"] == "MirrorChyan":
with requests.get(
self.config["url"],
allow_redirects=True,
timeout=10,
stream=True,
) as response:
if response.status_code == 200:
return response.url
if self.name == "AUTO_MAA": if self.name == "AUTO_MAA":
if self.config["mode"] == "Proxy": if self.config["mode"] == "Proxy":
@@ -349,6 +332,14 @@ class DownloadManager(QDialog):
if response.status_code == 200: if response.status_code == 200:
return response.url return response.url
elif self.config["mode"] == "MirrorChyan":
with requests.get(
self.config["url"], allow_redirects=True, timeout=10, stream=True
) as response:
if response.status_code == 200:
return response.url
def test_speed_task1(self) -> None: def test_speed_task1(self) -> None:
if self.isInterruptionRequested: if self.isInterruptionRequested:

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -20,7 +20,7 @@
}, },
"4.3.6.3": { "4.3.6.3": {
"新增功能": [ "新增功能": [
"下载器支持调用Mirror酱" "下载器支持调用Mirror酱"
], ],
"修复BUG": [ "修复BUG": [
"修复Mirror酱更新检查报错不显示详细信息的问题" "修复Mirror酱更新检查报错不显示详细信息的问题"