Skip to content

Commit 4d59c2c

Browse files
加入对config文件权限的修改,禁止mxu修改
1 parent a57069d commit 4d59c2c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

agent/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,11 @@ def _apply_maahub_ui_config(config: dict) -> bool:
235235

236236

237237
def ensure_mxu_ui_config() -> None:
238+
import stat
238239
config_dir = Path(project_root_dir) / "config"
239240
config_dir.mkdir(exist_ok=True)
240241
config_path = config_dir / "mxu-MaaNTE.json"
242+
os.chmod(config_path, stat.S_IWRITE)
241243
config = {}
242244
if config_path.exists():
243245
try:
@@ -252,6 +254,7 @@ def ensure_mxu_ui_config() -> None:
252254
config = {}
253255

254256
changed = _apply_maahub_ui_config(config)
257+
255258
if not changed:
256259
return
257260

@@ -261,6 +264,8 @@ def ensure_mxu_ui_config() -> None:
261264
f.write("\n")
262265
except Exception:
263266
logger.exception("写入 mxu-MaaNTE.json 失败")
267+
268+
os.chmod(config_path, stat.S_IREAD)
264269

265270

266271
def read_interface_version(interface_file_name="./interface.json") -> str:

0 commit comments

Comments
 (0)