Skip to content

Commit

Permalink
improved: Update All - Show link on the result board
Browse files Browse the repository at this point in the history
fixed: Update All - Updates for unknown nodes were not being applied
fixed: corner case crash whilte install/updating

#1168
  • Loading branch information
ltdrdata committed Feb 16, 2025
1 parent 1579c58 commit fa1b514
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 37 deletions.
3 changes: 1 addition & 2 deletions cm-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
except:
print("\n[bold yellow]WARN: The `COMFYUI_PATH` environment variable is not set. Assuming `custom_nodes/ComfyUI-Manager/../../` as the ComfyUI path.[/bold yellow]", file=sys.stderr)
comfy_path = os.path.abspath(os.path.join(manager_util.comfyui_manager_path, '..', '..'))

sys.path.append(comfy_path)
sys.path.append(comfy_path)

import utils.extra_config
import cm_global
Expand Down
11 changes: 0 additions & 11 deletions custom-node-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -14202,17 +14202,6 @@
"install_type": "git-clone",
"description": "multiline text node that strips c-style comments (i.e.'//' and '/* ... */') before passing output string downstream"
},
{
"author": "noarche",
"title": "noarche/Color Enhance",
"id": "color-enhance",
"reference": "https://github.com/noarche/sd-webui-color-enhance",
"files": [
"https://github.com/noarche/sd-webui-color-enhance"
],
"install_type": "git-clone",
"description": "Script for [a/AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) and node for ComfyUI to enhance colors.\nThis is the same algorithm GIMP/GEGL uses for color enhancement. The gist of this implementation is that it converts the color space to [CIELCh(ab) and normalizes the chroma (or '[a/colorfulness](https://en.wikipedia.org/wiki/Colorfulness)') component. Original source can be found in the link below."
},
{
"author": "emojiiii",
"title": "ComfyUI_Emojiiii_Custom_Nodes",
Expand Down
16 changes: 11 additions & 5 deletions glob/manager_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from node_package import InstalledNodePackage


version_code = [3, 21, 5]
version_code = [3, 22]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')


Expand Down Expand Up @@ -345,6 +345,7 @@ def __init__(self, action):
self.msg = None
self.target = None
self.postinstall = lambda: True
self.ver = None

def append(self, item):
self.items.append(item)
Expand All @@ -366,6 +367,10 @@ def with_postinstall(self, postinstall):
self.postinstall = postinstall
return self

def with_ver(self, ver):
self.ver = ver
return self


class UnifiedManager:
def __init__(self):
Expand Down Expand Up @@ -789,6 +794,7 @@ async def get_custom_nodes(self, channel, mode):
node_id = v['id']
else:
node_id = v['files'][0].split('/')[-1]
v['repository'] = v['files'][0]
res[node_id] = v
elif len(v['files']) > 1:
res[v['files'][0]] = v # A custom node composed of multiple url is treated as a single repository with one representative path
Expand Down Expand Up @@ -1334,14 +1340,14 @@ def unified_update(self, node_id, version_spec=None, instant_execution=False, no
version_spec = self.resolve_unspecified_version(node_id, guess_mode='active')

if version_spec is None:
return ManagedResult('update').fail(f'Update not available: {node_id}@{version_spec}')
return ManagedResult('update').fail(f'Update not available: {node_id}@{version_spec}').with_ver(version_spec)

if version_spec == 'nightly':
return self.repo_update(self.active_nodes[node_id][1], instant_execution=instant_execution, no_deps=no_deps, return_postinstall=return_postinstall).with_target('nightly')
return self.repo_update(self.active_nodes[node_id][1], instant_execution=instant_execution, no_deps=no_deps, return_postinstall=return_postinstall).with_target('nightly').with_ver('nightly')
elif version_spec == 'unknown':
return self.repo_update(self.unknown_active_nodes[node_id][1], instant_execution=instant_execution, no_deps=no_deps, return_postinstall=return_postinstall).with_target('unknown')
return self.repo_update(self.unknown_active_nodes[node_id][1], instant_execution=instant_execution, no_deps=no_deps, return_postinstall=return_postinstall).with_target('unknown').with_ver('unknown')
else:
return self.cnr_switch_version(node_id, instant_execution=instant_execution, no_deps=no_deps, return_postinstall=return_postinstall)
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):
"""
Expand Down
36 changes: 32 additions & 4 deletions glob/manager_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,25 +416,41 @@ async def do_install(item) -> str:
traceback.print_exc()
return f"Installation failed:\n{node_spec_str}"

async def do_update(item) -> str:
async def do_update(item):
ui_id, node_name, node_ver = item

try:
res = core.unified_manager.unified_update(node_name, node_ver)

if res.ver == 'unknown':
url = core.unified_manager.unknown_active_nodes[node_name][0]
title = os.path.basename(url)
else:
url = core.unified_manager.cnr_map[node_name].get('repository')
title = core.unified_manager.cnr_map[node_name]['name']

manager_util.clear_pip_cache()

if url is not None:
base_res = {'url': url, 'title': title}
else:
base_res = {'title': title}

if res.result:
if res.action == 'skip':
return 'skip'
base_res['msg'] = 'skip'
return base_res
else:
return 'success'
base_res['msg'] = 'success'
return base_res

base_res['msg'] = f"An error occurred while updating '{node_name}'."
logging.error(f"\nERROR: An error occurred while updating '{node_name}'.")
return base_res
except Exception:
traceback.print_exc()

return f"An error occurred while updating '{node_name}'."
return {'msg':f"An error occurred while updating '{node_name}'."}

async def do_update_comfyui() -> str:
try:
Expand Down Expand Up @@ -607,6 +623,9 @@ async def do_install_model(item) -> str:
elif kind == 'update-comfyui':
nodepack_result['comfyui'] = msg
ui_target = "main"
elif kind == 'update':
nodepack_result[ui_id] = msg['msg']
ui_target = "nodepack_manager"
else:
nodepack_result[ui_id] = msg
ui_target = "nodepack_manager"
Expand Down Expand Up @@ -711,6 +730,15 @@ async def update_all(request):
update_item = k, k, v[0]
task_queue.put(("update-main", update_item))

for k, v in core.unified_manager.unknown_active_nodes.items():
if k == 'comfyui-manager':
# skip updating comfyui-manager if desktop version
if os.environ.get('__COMFYUI_DESKTOP_VERSION__'):
continue

update_item = k, k, 'unknown'
task_queue.put(("update-main", update_item))

return web.Response(status=200)


Expand Down
42 changes: 28 additions & 14 deletions js/comfyui-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,17 +707,15 @@ async function onQueueStatus(event) {
for(let k in event.detail.nodepack_result){
let v = event.detail.nodepack_result[k];

if(v == 'success') {
if(k == 'comfyui')
comfyui_state = 'success';
else
success_list.push(k);
if(k == 'comfyui') {
comfyui_state = v;
continue;
}
else if(v == 'skip') {
if(k == 'comfyui')
comfyui_state = 'skip';

if(v.msg == 'success') {
success_list.push(k);
}
else
else if(v.msg != 'skip')
failed_list.push(k);
}

Expand All @@ -737,14 +735,22 @@ async function onQueueStatus(event) {
else if(comfyui_state == 'skip') {
msg += "ComfyUI is already up-to-date.<BR><BR>"
}
else if(comfyui_state != null) {
msg += "Failed to update ComfyUI.<BR><BR>"
}

if(success_list.length > 0) {
msg += "The following custom nodes have been updated:<ul>";
for(let x in success_list) {
if(success_list[x] == 'comfyui')
continue;

msg += '<li>'+success_list[x]+'</li>';
let k = success_list[x];
let url = event.detail.nodepack_result[k].url;
let title = event.detail.nodepack_result[k].title;
if(url) {
msg += `<li><a href='${url}' target='_blank'>${title}</a></li>`;
}
else {
msg += `<li>${k}</li>`;
}
}
msg += "</ul>";
}
Expand All @@ -755,7 +761,15 @@ async function onQueueStatus(event) {
if(failed_list.length > 0) {
msg += '<br>The update for the following custom nodes has failed:<ul>';
for(let x in failed_list) {
msg += '<li>'+failed_list[x]+'</li>';
let k = failed_list[x];
let url = event.detail.nodepack_result[k].url;
let title = event.detail.nodepack_result[k].title;
if(url) {
msg += `<li><a href='${url}' target='_blank'>${title}</a></li>`;
}
else {
msg += `<li>${k}</li>`;
}
}

msg += '</ul>'
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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.21.5"
version = "3.22"
license = { file = "LICENSE.txt" }
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]

Expand Down

0 comments on commit fa1b514

Please sign in to comment.