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
This commit is contained in:
Dr.Lt.Data 2025-01-11 11:38:12 +09:00
parent 041f4e4bb5
commit 830be27eb2
6 changed files with 33 additions and 8 deletions

View File

@ -41,7 +41,7 @@ import manager_downloader
from node_package import InstalledNodePackage 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 '') 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) custom_nodes = await self.get_custom_nodes(channel, mode)
the_node = custom_nodes.get(node_id) the_node = custom_nodes.get(node_id)
if the_node is not None: 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: else:
result = ManagedResult('install') result = ManagedResult('install')
return result.fail(f"Node '{node_id}@{version_spec}' not found in [{channel}, {mode}]") return result.fail(f"Node '{node_id}@{version_spec}' not found in [{channel}, {mode}]")
@ -1346,6 +1349,8 @@ class UnifiedManager:
elif version_spec == 'nightly': elif version_spec == 'nightly':
cnr_utils.generate_cnr_id(to_path, node_id) cnr_utils.generate_cnr_id(to_path, node_id)
self.active_nodes[node_id] = 'nightly', to_path self.active_nodes[node_id] = 'nightly', to_path
else:
return res
return res.with_target(version_spec) return res.with_target(version_spec)

View File

@ -858,6 +858,8 @@ async def install_custom_node(request):
cnr_id = json_data.get('id') cnr_id = json_data.get('id')
skip_post_install = json_data.get('skip_post_install') skip_post_install = json_data.get('skip_post_install')
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', 'latest')
if selected_version != 'nightly': if selected_version != 'nightly':
@ -865,14 +867,22 @@ async def install_custom_node(request):
node_spec_str = f"{cnr_id}@{selected_version}" node_spec_str = f"{cnr_id}@{selected_version}"
else: else:
node_spec_str = f"{cnr_id}@nightly" 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: else:
# unknown # unknown
unknown_name = os.path.basename(json_data['files'][0]) unknown_name = os.path.basename(json_data['files'][0])
node_spec_str = f"{unknown_name}@unknown" 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) # apply security policy if not cnr node (nightly isn't regarded as cnr node)
if risky_level is None: 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): if not is_allowed_security_level(risky_level):
logging.error(SECURITY_MESSAGE_GENERAL) logging.error(SECURITY_MESSAGE_GENERAL)
@ -888,7 +898,11 @@ async def install_custom_node(request):
# discard post install if skip_post_install mode # discard post install if skip_post_install mode
if res.action not in ['skip', 'enable', 'install-git', 'install-cnr', 'switch-cnr']: 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.") return web.Response(status=200, text="Installation success.")

View File

@ -45,6 +45,11 @@ async function tryInstallCustomNode(event) {
show_message('This action is not allowed with this security level configuration.'); show_message('This action is not allowed with this security level configuration.');
return false; return false;
} }
else if(response.status == 400) {
let msg = await res.text();
show_message(msg);
return false;
}
} }
let response = await api.fetchApi("/manager/reboot"); let response = await api.fetchApi("/manager/reboot");

View File

@ -96,7 +96,7 @@ function internalCustomConfirm(message, confirmMessage, cancelMessage) {
export function show_message(msg) { export function show_message(msg) {
app.ui.dialog.show(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) { export async function sleep(ms) {

View File

@ -1281,7 +1281,7 @@ export class CustomNodesManager {
body: JSON.stringify(data) body: JSON.stringify(data)
}); });
if (res.error) { if (res.status != 200) {
errorMsg = `${item.title} ${mode} failed: `; errorMsg = `${item.title} ${mode} failed: `;
if(res.status == 403) { if(res.status == 403) {
@ -1289,7 +1289,7 @@ export class CustomNodesManager {
} else if(res.status == 404) { } else if(res.status == 404) {
errorMsg += `With the current security level configuration, only custom nodes from the <B>"default channel"</B> can be installed.`; errorMsg += `With the current security level configuration, only custom nodes from the <B>"default channel"</B> can be installed.`;
} else { } else {
errorMsg += res.error.message; errorMsg += await res.text();
} }
break; break;
@ -1310,6 +1310,7 @@ export class CustomNodesManager {
if (errorMsg) { if (errorMsg) {
this.showError(errorMsg); this.showError(errorMsg);
show_message("Installation Error:\n"+errorMsg);
} else { } else {
this.showStatus(`${label} ${list.length} custom node(s) successfully`); this.showStatus(`${label} ${list.length} custom node(s) successfully`);
} }

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.6" version = "3.6.1"
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"]