@@ -1239,7 +1239,19 @@ def api_settings_general():
|
|||||||
with open(CONFIG_FILE_PATH, "w", encoding="utf-8") as f:
|
with open(CONFIG_FILE_PATH, "w", encoding="utf-8") as f:
|
||||||
yaml_inst.dump(config, f)
|
yaml_inst.dump(config, f)
|
||||||
|
|
||||||
|
# 同步更新内存中的配置,避免重启前 update_config() 把新值覆盖回旧值
|
||||||
if _app:
|
if _app:
|
||||||
|
if "max_download_task" in data:
|
||||||
|
_app.config["max_download_task"] = config["max_download_task"]
|
||||||
|
if "log_level" in data:
|
||||||
|
_app.config["log_level"] = config["log_level"]
|
||||||
|
if "save_path" in data and data.get("save_path"):
|
||||||
|
_app.config["save_path"] = config["save_path"]
|
||||||
|
if "proxy" in data:
|
||||||
|
if "proxy" in config:
|
||||||
|
_app.config["proxy"] = dict(config["proxy"])
|
||||||
|
else:
|
||||||
|
_app.config.pop("proxy", None)
|
||||||
_app.restart_program = True
|
_app.restart_program = True
|
||||||
return jsonify({"success": True})
|
return jsonify({"success": True})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user