Skip to content

Commit

Permalink
improved: cm-cli.py save-snapshot - validate output path
Browse files Browse the repository at this point in the history
fixed: Update all - Properly display the results of the ComfyUI update.
fixed: Update all - An issue where the action results of the custom nodes manager were reflected in the main dialog.

#1548
  • Loading branch information
ltdrdata committed Feb 15, 2025
1 parent d7af7e2 commit 3b0709f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 12 deletions.
12 changes: 11 additions & 1 deletion cm-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,17 @@ def save_snapshot(
] = True,
):
cmd_ctx.set_user_directory(user_directory)
path = core.save_snapshot_with_postfix('snapshot', output, not full_snapshot)

if(not output.endswith('.json') and not output.endswith('.yaml')):
print("ERROR: output path should be either '.json' or '.yaml' file.")
raise typer.Exit(code=1)

dir_path = os.path.dirname(output)
if(dir_path != '' and not os.path.exists(dir_path)):
print(f"ERROR: {output} path not exists.")
raise typer.Exit(code=1)

path = asyncio.run(core.save_snapshot_with_postfix('snapshot', output, not full_snapshot))
print(f"Current snapshot is saved as `{path}`")


Expand Down
3 changes: 1 addition & 2 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]
version_code = [3, 21, 1]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')


Expand Down Expand Up @@ -1619,7 +1619,6 @@ def get_bool(key, default_value):
}

except Exception:
traceback.print_exc()
manager_util.use_uv = False
return {
'http_channel_enabled': False,
Expand Down
1 change: 1 addition & 0 deletions glob/manager_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ async def do_install_model(item) -> str:
nodepack_result[ui_id] = msg
ui_target = "main"
elif kind == 'update-comfyui':
nodepack_result['comfyui'] = msg
ui_target = "main"
else:
nodepack_result[ui_id] = msg
Expand Down
37 changes: 29 additions & 8 deletions js/comfyui-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,35 +698,56 @@ async function onQueueStatus(event) {
return;
}

is_updating_all = false;

let success_list = [];
let failed_list = [];
let comfyui_state = null;

for(let k in event.detail.nodepack_result){
let v = event.detail.nodepack_result[k];

if(v == 'success')
success_list.push(k);
if(v == 'success') {
if(k == 'comfyui')
comfyui_state = 'success';
else
success_list.push(k);
}
else if(v == 'skip') {
// do nothing
if(k == 'comfyui')
comfyui_state = 'skip';
}
else
failed_list.push(k);
}

let msg = "";

if(success_list.length == 0) {
if(success_list.length == 0 && comfyui_state != 'success') {
if(failed_list.length == 0) {
msg += "All custom nodes are already up to date.";
}
}
else {
msg = "To apply the updates, you need to <button class='cm-small-button' id='cm-reboot-button5'>RESTART</button> ComfyUI.<hr>";
msg += "The following custom nodes have been updated:<ul>";
for(let x in success_list) {
msg += '<li>'+success_list[x]+'</li>';

if(comfyui_state == 'success') {
msg += "ComfyUI is updated.<BR><BR>";
}
else if(comfyui_state == 'skip') {
msg += "ComfyUI is already up-to-date.<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>';
}
msg += "</ul>";
}
msg += "</ul>";

setNeedRestart(true);
}
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"
version = "3.21.1"
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 3b0709f

Please sign in to comment.