Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 39 additions & 26 deletions app/task/general/AutoProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,24 +567,28 @@ async def update_config(self):
logger.info("脚本直控配置:跳过回写用户独立配置")
return

if self.script_config.get("Script", "ConfigPathMode") == "Folder":
shutil.rmtree(
Path.cwd()
/ f"data/{self.script_info.script_id}/{self.cur_user_uid}/ConfigFile",
ignore_errors=True,
if not self.script_config_path.exists():
logger.warning(
f"脚本配置不存在,跳过回写用户独立配置: {self.script_config_path}"
)
return

user_config_dir = (
Path.cwd()
/ f"data/{self.script_info.script_id}/{self.cur_user_uid}/ConfigFile"
)
if self.script_config.get("Script", "ConfigPathMode") == "Folder":
shutil.rmtree(user_config_dir, ignore_errors=True)
shutil.copytree(
self.script_config_path,
Path.cwd()
/ f"data/{self.script_info.script_id}/{self.cur_user_uid}/ConfigFile",
user_config_dir,
dirs_exist_ok=True,
)
elif self.script_config.get("Script", "ConfigPathMode") == "File":
user_config_dir.mkdir(parents=True, exist_ok=True)
shutil.copy(
self.script_config_path,
Path.cwd()
/ f"data/{self.script_info.script_id}/{self.cur_user_uid}/ConfigFile"
/ self.script_config_path.name,
user_config_dir / self.script_config_path.name,
)
logger.success("通用脚本配置文件已更新")

Expand Down Expand Up @@ -625,24 +629,33 @@ async def set_general(self) -> None:
return

# 导入配置文件
user_config_dir = (
Path.cwd()
/ f"data/{self.script_info.script_id}/{self.cur_user_uid}/ConfigFile"
)
if self.script_config.get("Script", "ConfigPathMode") == "Folder":
if self.script_config_path.is_dir():
shutil.rmtree(self.script_config_path)
elif self.script_config_path.exists():
self.script_config_path.unlink()
shutil.copytree(
Path.cwd()
/ f"data/{self.script_info.script_id}/{self.cur_user_uid}/ConfigFile",
self.script_config_path,
dirs_exist_ok=True,
)
if user_config_dir.exists():
if self.script_config_path.is_dir():
shutil.rmtree(self.script_config_path)
elif self.script_config_path.exists():
self.script_config_path.unlink()
shutil.copytree(
user_config_dir,
self.script_config_path,
dirs_exist_ok=True,
)
else:
logger.warning(
f"用户独立配置尚不存在,本次沿用脚本自身配置: {user_config_dir}"
)
elif self.script_config.get("Script", "ConfigPathMode") == "File":
shutil.copy(
Path.cwd()
/ f"data/{self.script_info.script_id}/{self.cur_user_uid}/ConfigFile"
/ self.script_config_path.name,
self.script_config_path,
)
user_config_file = user_config_dir / self.script_config_path.name
if user_config_file.exists():
shutil.copy(user_config_file, self.script_config_path)
else:
logger.warning(
f"用户独立配置尚不存在,本次沿用脚本自身配置: {user_config_file}"
)

logger.info("脚本运行参数配置完成: 自动代理")

Expand Down
6 changes: 6 additions & 0 deletions app/task/general/ScriptConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ async def final_task(self):
logger.info("脚本直控配置:跳过回写用户独立配置")
return

if not self.script_config_path.exists():
logger.warning(
f"脚本配置不存在,跳过回写用户独立配置: {self.script_config_path}"
)
return

shutil.rmtree(
Path.cwd()
/ f"data/{self.script_info.script_id}/{self.cur_user_item.user_id}/ConfigFile",
Expand Down
3 changes: 2 additions & 1 deletion res/version.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
"MFW专项 准备运行环境确实找不到 uv 时改为给出可照做的中文提示,写明 uv.exe 该放的完整路径,以及本机已有完整 Python 3.12 时可改设环境变量跳过下载 by [@qiyinxi](https://github.com/qiyinxi)",
"MFW专项 修复脚本侧强制停止任务(如 MaaEnd 分辨率不达标时的强停)被记成「任务完成」的问题:现在被强停的任务按失败记录,本轮剩余任务不再投递,不会再出现整轮一件事没做却报成全部成功 by [@qiyinxi](https://github.com/qiyinxi)",
"MAA专项 修复 MAA 卡死后不会被判定为超时、任务一直挂着的问题:MAA 每隔一段时间输出的日志停滞提示被当成任务仍在推进,把超时计时反复重置,剿灭等超时阈值长于提示间隔的模式永远等不到超时;现已识别新旧两版 MAA 的该提示,MAA 的五种界面语言均生效 by [@qiyinxi](https://github.com/qiyinxi)",
"MAA专项 修复关闭理智作战后活动关优先任务一并从任务队列中消失的问题 by [@1w1w11w1](https://github.com/1w1w11w1)"
"MAA专项 修复关闭理智作战后活动关优先任务一并从任务队列中消失的问题 by [@1w1w11w1](https://github.com/1w1w11w1)",
"通用脚本 修复用户独立配置在「尚未跑过脚本设置」或「配置路径填错」时直接报 FileNotFoundError 把任务判成异常的问题:写入方向改为源不存在就沿用脚本自身配置,回写方向改为源不存在就跳过并给出提示、并且不再先把已有备份删掉,File 模式回写也会自动补建目标目录"
]
},
"v5.5.0-beta.2": {
Expand Down