fixed: When enabling the selected items, it fixed an issue where it performed a latest installation instead of enabling the previously disabled ones.

fixed: robust skipping installing/uninstalling/enabling of ComfyUI-Manager
This commit is contained in:
Dr.Lt.Data 2025-02-25 22:19:07 +09:00
parent 42b15ad4a5
commit ea7aafb3e6
3 changed files with 38 additions and 8 deletions

View File

@ -42,7 +42,7 @@ import manager_downloader
from node_package import InstalledNodePackage from node_package import InstalledNodePackage
version_code = [3, 26, 2] version_code = [3, 27]
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 '')
@ -997,7 +997,7 @@ class UnifiedManager:
return result return result
def unified_enable(self, node_id, version_spec=None): def unified_enable(self, node_id: str, version_spec=None):
""" """
priority if version_spec == None priority if version_spec == None
1. CNR latest in disk 1. CNR latest in disk
@ -1009,6 +1009,9 @@ class UnifiedManager:
result = ManagedResult('enable') result = ManagedResult('enable')
if 'comfyui-manager' in node_id.lower():
return result.fail(f"ignored: enabling '{node_id}'")
if version_spec is None: if version_spec is None:
version_spec = self.resolve_unspecified_version(node_id, guess_mode='inactive') version_spec = self.resolve_unspecified_version(node_id, guess_mode='inactive')
if version is None: if version is None:
@ -1074,9 +1077,12 @@ class UnifiedManager:
self.active_nodes[node_id] = version_spec, to_path self.active_nodes[node_id] = version_spec, to_path
return result.with_target(to_path) return result.with_target(to_path)
def unified_disable(self, node_id, is_unknown): def unified_disable(self, node_id: str, is_unknown):
result = ManagedResult('disable') result = ManagedResult('disable')
if 'comfyui-manager' in node_id.lower():
return result.fail(f"ignored: disabling '{node_id}'")
if is_unknown: if is_unknown:
version_spec = 'unknown' version_spec = 'unknown'
else: else:
@ -1132,6 +1138,9 @@ class UnifiedManager:
""" """
result = ManagedResult('uninstall') result = ManagedResult('uninstall')
if 'comfyui-manager' in node_id.lower():
return result.fail(f"ignored: uninstalling '{node_id}'")
if is_unknown: if is_unknown:
# remove from actives # remove from actives
repo_and_path = self.unknown_active_nodes.get(node_id) repo_and_path = self.unknown_active_nodes.get(node_id)
@ -1188,9 +1197,12 @@ class UnifiedManager:
return result return result
def cnr_install(self, node_id, version_spec=None, instant_execution=False, no_deps=False, return_postinstall=False): def cnr_install(self, node_id: str, version_spec=None, instant_execution=False, no_deps=False, return_postinstall=False):
result = ManagedResult('install-cnr') result = ManagedResult('install-cnr')
if 'comfyui-manager' in node_id.lower():
return result.fail(f"ignored: installing '{node_id}'")
node_info = cnr_utils.install_node(node_id, version_spec) node_info = cnr_utils.install_node(node_id, version_spec)
if node_info is None or not node_info.download_url: if node_info is None or not node_info.download_url:
return result.fail(f'not available node: {node_id}@{version_spec}') return result.fail(f'not available node: {node_id}@{version_spec}')
@ -1235,10 +1247,13 @@ class UnifiedManager:
return result return result
def repo_install(self, url, repo_path, instant_execution=False, no_deps=False, return_postinstall=False): def repo_install(self, url: str, repo_path: str, instant_execution=False, no_deps=False, return_postinstall=False):
result = ManagedResult('install-git') result = ManagedResult('install-git')
result.append(url) result.append(url)
if 'comfyui-manager' in url.lower():
return result.fail(f"ignored: installing '{url}'")
if not is_valid_url(url): if not is_valid_url(url):
return result.fail(f"Invalid git url: {url}") return result.fail(f"Invalid git url: {url}")
@ -1359,7 +1374,7 @@ class UnifiedManager:
else: else:
return self.cnr_switch_version(node_id, instant_execution=instant_execution, no_deps=no_deps, return_postinstall=return_postinstall).with_ver('cnr') return self.cnr_switch_version(node_id, instant_execution=instant_execution, no_deps=no_deps, return_postinstall=return_postinstall).with_ver('cnr')
async def install_by_id(self, node_id, version_spec=None, channel=None, mode=None, instant_execution=False, no_deps=False, return_postinstall=False): async def install_by_id(self, node_id: str, version_spec=None, channel=None, mode=None, instant_execution=False, no_deps=False, return_postinstall=False):
""" """
priority if version_spec == None priority if version_spec == None
1. CNR latest 1. CNR latest
@ -1368,6 +1383,9 @@ class UnifiedManager:
remark: latest version_spec is not allowed. Must be resolved before call. remark: latest version_spec is not allowed. Must be resolved before call.
""" """
if 'comfyui-manager' in node_id.lower():
return ManagedResult('skip').fail(f"ignored: installing '{node_id}'")
repo_url = None repo_url = None
if version_spec is None: if version_spec is None:
if self.is_enabled(node_id): if self.is_enabled(node_id):
@ -3039,6 +3057,10 @@ async def restore_snapshot(snapshot_path, git_helper_extras=None):
# normalize github repo # normalize github repo
for k, v in _git_info.items(): for k, v in _git_info.items():
# robust filter out comfyui-manager while restoring snapshot
if 'comfyui-manager' in k.lower():
continue
norm_k = git_utils.normalize_url(k) norm_k = git_utils.normalize_url(k)
git_info[norm_k] = v git_info[norm_k] = v

View File

@ -1195,7 +1195,15 @@ async def install_custom_node(request):
git_url = None git_url = None
if json_data['version'] != 'unknown': if json_data['version'] != 'unknown':
selected_version = json_data.get('selected_version', 'latest') selected_version = json_data.get('selected_version')
if skip_post_install:
if cnr_id in core.unified_manager.nightly_inactive_nodes or cnr_id in core.unified_manager.cnr_inactive_nodes:
core.unified_manager.unified_enable(cnr_id)
return web.Response(status=200)
else:
selected_version = 'latest'
if selected_version != 'nightly': if selected_version != 'nightly':
risky_level = 'low' risky_level = 'low'
node_spec_str = f"{cnr_id}@{selected_version}" node_spec_str = f"{cnr_id}@{selected_version}"

View File

@ -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.26.2" version = "3.27"
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", "toml", "uv", "chardet"] dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions", "toml", "uv", "chardet"]