mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-18 02:43:00 +08:00
improved: is_local_mode - use ipaddress module instead of string match
refactor: get_config() - ensure lowercase option when returning dict https://github.com/ltdrdata/ComfyUI-Manager/issues/1546
This commit is contained in:
parent
a6816d53d7
commit
12351bada7
@ -42,7 +42,7 @@ import manager_downloader
|
|||||||
from node_package import InstalledNodePackage
|
from node_package import InstalledNodePackage
|
||||||
|
|
||||||
|
|
||||||
version_code = [3, 21, 1]
|
version_code = [3, 21, 2]
|
||||||
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
||||||
|
|
||||||
|
|
||||||
@ -1583,16 +1583,6 @@ def read_config():
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(manager_config_path)
|
config.read(manager_config_path)
|
||||||
default_conf = config['default']
|
default_conf = config['default']
|
||||||
|
|
||||||
# policy migration: disable_unsecure_features -> security_level
|
|
||||||
if 'disable_unsecure_features' in default_conf:
|
|
||||||
if default_conf['disable_unsecure_features'].lower() == 'true':
|
|
||||||
security_level = 'strong'
|
|
||||||
else:
|
|
||||||
security_level = 'normal'
|
|
||||||
else:
|
|
||||||
security_level = default_conf['security_level'] if 'security_level' in default_conf else 'normal'
|
|
||||||
|
|
||||||
manager_util.use_uv = default_conf['use_uv'].lower() == 'true' if 'use_uv' in default_conf else False
|
manager_util.use_uv = default_conf['use_uv'].lower() == 'true' if 'use_uv' in default_conf else False
|
||||||
|
|
||||||
def get_bool(key, default_value):
|
def get_bool(key, default_value):
|
||||||
@ -1600,22 +1590,22 @@ def read_config():
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'http_channel_enabled': get_bool('http_channel_enabled', False),
|
'http_channel_enabled': get_bool('http_channel_enabled', False),
|
||||||
'preview_method': default_conf.get('preview_method', manager_funcs.get_current_preview_method()),
|
'preview_method': default_conf.get('preview_method', manager_funcs.get_current_preview_method()).lower(),
|
||||||
'git_exe': default_conf.get('git_exe', ''),
|
'git_exe': default_conf.get('git_exe', ''),
|
||||||
'use_uv': get_bool('use_uv', False),
|
'use_uv': get_bool('use_uv', False),
|
||||||
'channel_url': default_conf.get('channel_url', DEFAULT_CHANNEL),
|
'channel_url': default_conf.get('channel_url', DEFAULT_CHANNEL),
|
||||||
'default_cache_as_channel_url': get_bool('default_cache_as_channel_url', False),
|
'default_cache_as_channel_url': get_bool('default_cache_as_channel_url', False),
|
||||||
'share_option': default_conf.get('share_option', 'all'),
|
'share_option': default_conf.get('share_option', 'all').lower(),
|
||||||
'bypass_ssl': get_bool('bypass_ssl', False),
|
'bypass_ssl': get_bool('bypass_ssl', False),
|
||||||
'file_logging': get_bool('file_logging', True),
|
'file_logging': get_bool('file_logging', True),
|
||||||
'component_policy': default_conf.get('component_policy', 'workflow'),
|
'component_policy': default_conf.get('component_policy', 'workflow').lower(),
|
||||||
'windows_selector_event_loop_policy': get_bool('windows_selector_event_loop_policy', False),
|
'windows_selector_event_loop_policy': get_bool('windows_selector_event_loop_policy', False),
|
||||||
'model_download_by_agent': get_bool('model_download_by_agent', False),
|
'model_download_by_agent': get_bool('model_download_by_agent', False),
|
||||||
'downgrade_blacklist': default_conf.get('downgrade_blacklist', ''),
|
'downgrade_blacklist': default_conf.get('downgrade_blacklist', '').lower(),
|
||||||
'skip_migration_check': get_bool('skip_migration_check', False),
|
'skip_migration_check': get_bool('skip_migration_check', False),
|
||||||
'always_lazy_install': get_bool('always_lazy_install', False),
|
'always_lazy_install': get_bool('always_lazy_install', False),
|
||||||
'network_mode': default_conf.get('network_mode', 'public'),
|
'network_mode': default_conf.get('network_mode', 'public').lower(),
|
||||||
'security_level': security_level,
|
'security_level': default_conf.get('security_level', 'normal').lower(),
|
||||||
}
|
}
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@ -55,8 +55,14 @@ def handle_stream(stream, prefix):
|
|||||||
from comfy.cli_args import args
|
from comfy.cli_args import args
|
||||||
import latent_preview
|
import latent_preview
|
||||||
|
|
||||||
|
def is_loopback(address):
|
||||||
|
import ipaddress
|
||||||
|
try:
|
||||||
|
return ipaddress.ip_address(address).is_loopback
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
|
||||||
is_local_mode = args.listen.startswith('127.') or args.listen.startswith('local.')
|
is_local_mode = is_loopback(args.listen)
|
||||||
|
|
||||||
|
|
||||||
model_dir_name_map = {
|
model_dir_name_map = {
|
||||||
@ -85,11 +91,11 @@ def is_allowed_security_level(level):
|
|||||||
return False
|
return False
|
||||||
elif level == 'high':
|
elif level == 'high':
|
||||||
if is_local_mode:
|
if is_local_mode:
|
||||||
return core.get_config()['security_level'].lower() in ['weak', 'normal-']
|
return core.get_config()['security_level'] in ['weak', 'normal-']
|
||||||
else:
|
else:
|
||||||
return core.get_config()['security_level'].lower() == 'weak'
|
return core.get_config()['security_level'] == 'weak'
|
||||||
elif level == 'middle':
|
elif level == 'middle':
|
||||||
return core.get_config()['security_level'].lower() in ['weak', 'normal', 'normal-']
|
return core.get_config()['security_level'] in ['weak', 'normal', 'normal-']
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "comfyui-manager"
|
name = "comfyui-manager"
|
||||||
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
||||||
version = "3.21.1"
|
version = "3.21.2"
|
||||||
license = { file = "LICENSE.txt" }
|
license = { file = "LICENSE.txt" }
|
||||||
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]
|
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user