New custom nodes manager (#744)
* new custom nodes manager * fix loading * replace build-in sha1 with md5 * better description link * fix the update button disappears if open dialog again * fix restart required status if open dialog again * merge with main branch * add trust icon for author * fixed grid theme for Comfy.ColorPalette * fix get_unresolved * remove useless file * supports better theme with comfyui color palette * add extensions column * fixed conflicts
This commit is contained in:
66
js/common.js
66
js/common.js
@@ -24,72 +24,6 @@ export function rebootAPI() {
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function install_checked_custom_node(grid_rows, target_i, caller, mode) {
|
||||
if(caller) {
|
||||
let failed = '';
|
||||
|
||||
caller.disableButtons();
|
||||
|
||||
for(let i in grid_rows) {
|
||||
if(!grid_rows[i].checkbox.checked && i != target_i)
|
||||
continue;
|
||||
|
||||
var target;
|
||||
|
||||
if(grid_rows[i].data.custom_node) {
|
||||
target = grid_rows[i].data.custom_node;
|
||||
}
|
||||
else {
|
||||
target = grid_rows[i].data;
|
||||
}
|
||||
|
||||
caller.startInstall(target);
|
||||
|
||||
try {
|
||||
const response = await api.fetchApi(`/customnode/${mode}`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(target)
|
||||
});
|
||||
|
||||
if(response.status == 403) {
|
||||
show_message('This action is not allowed with this security level configuration.');
|
||||
caller.updateMessage('');
|
||||
await caller.invalidateControl();
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.status == 404) {
|
||||
show_message('With the current security level configuration, only custom nodes from the <B>"default channel"</B> can be installed.');
|
||||
caller.updateMessage('');
|
||||
await caller.invalidateControl();
|
||||
return;
|
||||
}
|
||||
|
||||
if(response.status == 400) {
|
||||
show_message(`${mode} failed: ${target.title}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const status = await response.json();
|
||||
app.ui.dialog.close();
|
||||
target.installed = 'True';
|
||||
continue;
|
||||
}
|
||||
catch(exception) {
|
||||
failed += `<BR> ${target.title}`;
|
||||
}
|
||||
}
|
||||
|
||||
if(failed != '') {
|
||||
show_message(`${mode} failed: ${failed}`);
|
||||
}
|
||||
|
||||
await caller.invalidateControl();
|
||||
caller.updateMessage("<BR>To apply the installed/updated/disabled/enabled custom node, please <button id='cm-reboot-button1' class='cm-small-button'>RESTART</button> ComfyUI. And refresh browser.", 'cm-reboot-button1');
|
||||
}
|
||||
};
|
||||
|
||||
export var manager_instance = null;
|
||||
|
||||
export function setManagerInstance(obj) {
|
||||
|
||||
Reference in New Issue
Block a user