mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2026-01-28 23:10:16 +08:00
fix: robust config writer
This commit is contained in:
parent
57861e9cbd
commit
164f25fb43
@ -15,7 +15,7 @@ version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' i
|
|||||||
|
|
||||||
DEFAULT_CHANNEL = "https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main"
|
DEFAULT_CHANNEL = "https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main"
|
||||||
|
|
||||||
manager_core_config_path = os.path.abspath(os.path.join(folder_paths.get_user_directory(), 'default', 'manager-ext.ini'))
|
manager_ext_config_path = os.path.abspath(os.path.join(folder_paths.get_user_directory(), 'default', 'manager-ext.ini'))
|
||||||
cached_config = None
|
cached_config = None
|
||||||
|
|
||||||
|
|
||||||
@ -41,14 +41,19 @@ def write_config():
|
|||||||
'model_download_by_agent': get_config()['model_download_by_agent'],
|
'model_download_by_agent': get_config()['model_download_by_agent'],
|
||||||
'security_level': get_config()['security_level'],
|
'security_level': get_config()['security_level'],
|
||||||
}
|
}
|
||||||
with open(manager_core_config_path, 'w') as configfile:
|
|
||||||
|
directory = os.path.dirname(manager_ext_config_path)
|
||||||
|
if not os.path.exists(directory):
|
||||||
|
os.makedirs(directory)
|
||||||
|
|
||||||
|
with open(manager_ext_config_path, 'w') as configfile:
|
||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
|
|
||||||
|
|
||||||
def read_config():
|
def read_config():
|
||||||
try:
|
try:
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(manager_core_config_path)
|
config.read(manager_ext_config_path)
|
||||||
default_conf = config['default']
|
default_conf = config['default']
|
||||||
|
|
||||||
# policy migration: disable_unsecure_features -> security_level
|
# policy migration: disable_unsecure_features -> security_level
|
||||||
|
|||||||
@ -900,7 +900,7 @@ if hasattr(PromptServer.instance, "app"):
|
|||||||
def sanitize(data):
|
def sanitize(data):
|
||||||
return data.replace("<", "<").replace(">", ">")
|
return data.replace("<", "<").replace(">", ">")
|
||||||
|
|
||||||
if not os.path.exists(ext_core.manager_core_config_path):
|
if not os.path.exists(ext_core.manager_ext_config_path):
|
||||||
ext_core.get_config()
|
ext_core.get_config()
|
||||||
ext_core.write_config()
|
ext_core.write_config()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user