From ea7aafb3e631914c0e0ec8d0cbcbfbcedaebe10a Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Tue, 25 Feb 2025 22:19:07 +0900 Subject: [PATCH] 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 --- glob/manager_core.py | 34 ++++++++++++++++++++++++++++------ glob/manager_server.py | 10 +++++++++- pyproject.toml | 2 +- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/glob/manager_core.py b/glob/manager_core.py index ba6840de..4dc0577d 100644 --- a/glob/manager_core.py +++ b/glob/manager_core.py @@ -42,7 +42,7 @@ import manager_downloader 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 '') @@ -997,7 +997,7 @@ class UnifiedManager: 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 1. CNR latest in disk @@ -1009,6 +1009,9 @@ class UnifiedManager: result = ManagedResult('enable') + if 'comfyui-manager' in node_id.lower(): + return result.fail(f"ignored: enabling '{node_id}'") + if version_spec is None: version_spec = self.resolve_unspecified_version(node_id, guess_mode='inactive') if version is None: @@ -1074,9 +1077,12 @@ class UnifiedManager: self.active_nodes[node_id] = version_spec, 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') + if 'comfyui-manager' in node_id.lower(): + return result.fail(f"ignored: disabling '{node_id}'") + if is_unknown: version_spec = 'unknown' else: @@ -1132,6 +1138,9 @@ class UnifiedManager: """ result = ManagedResult('uninstall') + if 'comfyui-manager' in node_id.lower(): + return result.fail(f"ignored: uninstalling '{node_id}'") + if is_unknown: # remove from actives repo_and_path = self.unknown_active_nodes.get(node_id) @@ -1188,9 +1197,12 @@ class UnifiedManager: 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') + 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) if node_info is None or not node_info.download_url: return result.fail(f'not available node: {node_id}@{version_spec}') @@ -1235,10 +1247,13 @@ class UnifiedManager: 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.append(url) + if 'comfyui-manager' in url.lower(): + return result.fail(f"ignored: installing '{url}'") + if not is_valid_url(url): return result.fail(f"Invalid git url: {url}") @@ -1359,7 +1374,7 @@ class UnifiedManager: else: 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 1. CNR latest @@ -1368,6 +1383,9 @@ class UnifiedManager: 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 if version_spec is None: if self.is_enabled(node_id): @@ -3039,6 +3057,10 @@ async def restore_snapshot(snapshot_path, git_helper_extras=None): # normalize github repo 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) git_info[norm_k] = v diff --git a/glob/manager_server.py b/glob/manager_server.py index 99e52a5f..d374f782 100644 --- a/glob/manager_server.py +++ b/glob/manager_server.py @@ -1195,7 +1195,15 @@ async def install_custom_node(request): git_url = None 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': risky_level = 'low' node_spec_str = f"{cnr_id}@{selected_version}" diff --git a/pyproject.toml b/pyproject.toml index d370b3cf..34aa02a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] 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." -version = "3.26.2" +version = "3.27" license = { file = "LICENSE.txt" } dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions", "toml", "uv", "chardet"]