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
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)

View File

@ -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.")

View File

@ -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");

View File

@ -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) {

View File

@ -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 <B>"default channel"</B> 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`);
}

View File

@ -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"]