From 830be27eb2208b8cf54c2927c17fbe53f13943c1 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Sat, 11 Jan 2025 11:38:12 +0900 Subject: [PATCH] FIXED: Resolved an issue that occurred when attempting to install the nightly version if it was not registered in `custom-node-list.json`. FIXED: Improved error reporting for invalid Git URLs. https://github.com/ltdrdata/ComfyUI-Manager/issues/1413 --- glob/manager_core.py | 9 +++++++-- glob/manager_server.py | 18 ++++++++++++++++-- js/cm-api.js | 5 +++++ js/common.js | 2 +- js/custom-nodes-manager.js | 5 +++-- pyproject.toml | 2 +- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/glob/manager_core.py b/glob/manager_core.py index 294f38b8..c2e88dbb 100644 --- a/glob/manager_core.py +++ b/glob/manager_core.py @@ -41,7 +41,7 @@ import manager_downloader from node_package import InstalledNodePackage -version_code = [3, 6] +version_code = [3, 6, 1] version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') @@ -1321,7 +1321,10 @@ class UnifiedManager: custom_nodes = await self.get_custom_nodes(channel, mode) the_node = custom_nodes.get(node_id) if the_node is not None: - repo_url = the_node['files'][0] + if version_spec is 'unknown': + repo_url = the_node['files'][0] + else: # nightly + repo_url = the_node['reference'] else: result = ManagedResult('install') return result.fail(f"Node '{node_id}@{version_spec}' not found in [{channel}, {mode}]") @@ -1346,6 +1349,8 @@ class UnifiedManager: elif version_spec == 'nightly': cnr_utils.generate_cnr_id(to_path, node_id) self.active_nodes[node_id] = 'nightly', to_path + else: + return res return res.with_target(version_spec) diff --git a/glob/manager_server.py b/glob/manager_server.py index c8ae8787..6a266bb3 100644 --- a/glob/manager_server.py +++ b/glob/manager_server.py @@ -858,6 +858,8 @@ async def install_custom_node(request): cnr_id = json_data.get('id') skip_post_install = json_data.get('skip_post_install') + git_url = None + if json_data['version'] != 'unknown': selected_version = json_data.get('selected_version', 'latest') if selected_version != 'nightly': @@ -865,14 +867,22 @@ async def install_custom_node(request): node_spec_str = f"{cnr_id}@{selected_version}" else: node_spec_str = f"{cnr_id}@nightly" + git_url = json_data.get('reference') + if git_url is None: + logging.error(f"[ComfyUI-Manager] Following node pack doesn't provide `nightly` version: ${git_url}") + return web.Response(status=404, text=f"Following node pack doesn't provide `nightly` version: ${git_url}") else: # unknown unknown_name = os.path.basename(json_data['files'][0]) node_spec_str = f"{unknown_name}@unknown" + git_url = json_data.get('files') # apply security policy if not cnr node (nightly isn't regarded as cnr node) if risky_level is None: - risky_level = await get_risky_level(json_data['files'], json_data.get('pip', [])) + if git_url is not None: + risky_level = await get_risky_level(git_url, json_data.get('pip', [])) + else: + return web.Response(status=404, text=f"Following node pack doesn't provide `nightly` version: ${git_url}") if not is_allowed_security_level(risky_level): logging.error(SECURITY_MESSAGE_GENERAL) @@ -888,7 +898,11 @@ async def install_custom_node(request): # discard post install if skip_post_install mode if res.action not in ['skip', 'enable', 'install-git', 'install-cnr', 'switch-cnr']: - return web.Response(status=400, text=f"Installation failed: {res}") + logging.error(f"[ComfyUI-Manager] Installation failed:\n{res.msg}") + return web.Response(status=400, text=res.msg) + elif not res.result: + logging.error(f"[ComfyUI-Manager] Installation failed:\n{res.msg}") + return web.Response(status=400, text=res.msg) return web.Response(status=200, text="Installation success.") diff --git a/js/cm-api.js b/js/cm-api.js index 58df1169..dabc6f1d 100644 --- a/js/cm-api.js +++ b/js/cm-api.js @@ -45,6 +45,11 @@ async function tryInstallCustomNode(event) { show_message('This action is not allowed with this security level configuration.'); return false; } + else if(response.status == 400) { + let msg = await res.text(); + show_message(msg); + return false; + } } let response = await api.fetchApi("/manager/reboot"); diff --git a/js/common.js b/js/common.js index 51a67e03..ace1885a 100644 --- a/js/common.js +++ b/js/common.js @@ -96,7 +96,7 @@ function internalCustomConfirm(message, confirmMessage, cancelMessage) { export function show_message(msg) { app.ui.dialog.show(msg); - app.ui.dialog.element.style.zIndex = 1099; + app.ui.dialog.element.style.zIndex = 1100; } export async function sleep(ms) { diff --git a/js/custom-nodes-manager.js b/js/custom-nodes-manager.js index b4b4352a..7ad6e9b4 100644 --- a/js/custom-nodes-manager.js +++ b/js/custom-nodes-manager.js @@ -1281,7 +1281,7 @@ export class CustomNodesManager { body: JSON.stringify(data) }); - if (res.error) { + if (res.status != 200) { errorMsg = `${item.title} ${mode} failed: `; if(res.status == 403) { @@ -1289,7 +1289,7 @@ export class CustomNodesManager { } else if(res.status == 404) { errorMsg += `With the current security level configuration, only custom nodes from the "default channel" can be installed.`; } else { - errorMsg += res.error.message; + errorMsg += await res.text(); } break; @@ -1310,6 +1310,7 @@ export class CustomNodesManager { if (errorMsg) { this.showError(errorMsg); + show_message("Installation Error:\n"+errorMsg); } else { this.showStatus(`${label} ${list.length} custom node(s) successfully`); } diff --git a/pyproject.toml b/pyproject.toml index c075e02c..70246ee0 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.6" +version = "3.6.1" license = { file = "LICENSE.txt" } dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]