Security patch
https://github.com/comfyanonymous/ComfyUI/issues/3473#issuecomment-2109154269
This commit is contained in:
@@ -15,7 +15,7 @@ import { CustomNodesInstaller } from "./custom-nodes-downloader.js";
|
||||
import { AlternativesInstaller } from "./a1111-alter-downloader.js";
|
||||
import { SnapshotManager } from "./snapshot.js";
|
||||
import { ModelInstaller } from "./model-downloader.js";
|
||||
import { manager_instance, setManagerInstance, install_via_git_url, install_pip, rebootAPI, free_models } from "./common.js";
|
||||
import { manager_instance, setManagerInstance, install_via_git_url, install_pip, rebootAPI, free_models, show_message } from "./common.js";
|
||||
import { ComponentBuilderDialog, load_components, set_component_policy, getPureName } from "./components-manager.js";
|
||||
import { set_double_click_policy } from "./node_fixer.js";
|
||||
|
||||
@@ -520,25 +520,21 @@ async function updateComfyUI() {
|
||||
const response = await api.fetchApi('/comfyui_manager/update_comfyui');
|
||||
|
||||
if (response.status == 400) {
|
||||
app.ui.dialog.show('Failed to update ComfyUI.');
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
show_message('Failed to update ComfyUI.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (response.status == 201) {
|
||||
app.ui.dialog.show('ComfyUI has been successfully updated.');
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
show_message('ComfyUI has been successfully updated.');
|
||||
}
|
||||
else {
|
||||
app.ui.dialog.show('ComfyUI is already up to date with the latest version.');
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
show_message('ComfyUI is already up to date with the latest version.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (exception) {
|
||||
app.ui.dialog.show(`Failed to update ComfyUI / ${exception}`);
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
show_message(`Failed to update ComfyUI / ${exception}`);
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
@@ -560,13 +556,12 @@ async function fetchUpdates(update_check_checkbox) {
|
||||
const response = await api.fetchApi(`/customnode/fetch_updates?mode=${mode}`);
|
||||
|
||||
if (response.status != 200 && response.status != 201) {
|
||||
app.ui.dialog.show('Failed to fetch updates.');
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
show_message('Failed to fetch updates.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (response.status == 201) {
|
||||
app.ui.dialog.show("There is an updated extension available.<BR><BR><P><B>NOTE:<BR>Fetch Updates is not an update.<BR>Please update from <button id='cm-install-customnodes-button'>Install Custom Nodes</button> </B></P>");
|
||||
show_message("There is an updated extension available.<BR><BR><P><B>NOTE:<BR>Fetch Updates is not an update.<BR>Please update from <button id='cm-install-customnodes-button'>Install Custom Nodes</button> </B></P>");
|
||||
|
||||
const button = document.getElementById('cm-install-customnodes-button');
|
||||
button.addEventListener("click",
|
||||
@@ -580,19 +575,16 @@ async function fetchUpdates(update_check_checkbox) {
|
||||
}
|
||||
);
|
||||
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
update_check_checkbox.checked = false;
|
||||
}
|
||||
else {
|
||||
app.ui.dialog.show('All extensions are already up-to-date with the latest versions.');
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
show_message('All extensions are already up-to-date with the latest versions.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (exception) {
|
||||
app.ui.dialog.show(`Failed to update custom nodes / ${exception}`);
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
show_message(`Failed to update custom nodes / ${exception}`);
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
@@ -615,11 +607,16 @@ async function updateAll(update_check_checkbox, manager_dialog) {
|
||||
const response1 = await api.fetchApi('/comfyui_manager/update_comfyui');
|
||||
const response2 = await api.fetchApi(`/customnode/update_all?mode=${mode}`);
|
||||
|
||||
if (response1.status == 400 || response2.status == 400) {
|
||||
app.ui.dialog.show('Failed to update ComfyUI or several extensions.<BR><BR>See terminal log.<BR>');
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
if (response2.status == 403) {
|
||||
show_message('This action is not allowed with this security level configuration.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (response1.status == 400 || response2.status == 400) {
|
||||
show_message('Failed to update ComfyUI or several extensions.<BR><BR>See terminal log.<BR>');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(response1.status == 201 || response2.status == 201) {
|
||||
const update_info = await response2.json();
|
||||
|
||||
@@ -633,7 +630,7 @@ async function updateAll(update_check_checkbox, manager_dialog) {
|
||||
updated_list = "<BR>UPDATED: "+update_info.updated.join(", ");
|
||||
}
|
||||
|
||||
app.ui.dialog.show(
|
||||
show_message(
|
||||
"ComfyUI and all extensions have been updated to the latest version.<BR>To apply the updated custom node, please <button class='cm-small-button' id='cm-reboot-button5'>RESTART</button> ComfyUI. And refresh browser.<BR>"
|
||||
+failed_list
|
||||
+updated_list
|
||||
@@ -646,19 +643,15 @@ async function updateAll(update_check_checkbox, manager_dialog) {
|
||||
manager_dialog.close();
|
||||
}
|
||||
});
|
||||
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
}
|
||||
else {
|
||||
app.ui.dialog.show('ComfyUI and all extensions are already up-to-date with the latest versions.');
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
show_message('ComfyUI and all extensions are already up-to-date with the latest versions.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (exception) {
|
||||
app.ui.dialog.show(`Failed to update ComfyUI or several extensions / ${exception}`);
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
show_message(`Failed to update ComfyUI or several extensions / ${exception}`);
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user