mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-16 18:02:58 +08:00
fixed: invalid skipping of pip dependencies installation if ==, ~=
removed: useless badge related code
This commit is contained in:
parent
15ecb5b1d4
commit
585cc0d991
@ -36,7 +36,7 @@ import manager_downloader
|
|||||||
from node_package import InstalledNodePackage
|
from node_package import InstalledNodePackage
|
||||||
|
|
||||||
|
|
||||||
version_code = [3, 3, 6]
|
version_code = [3, 3, 7]
|
||||||
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
||||||
|
|
||||||
|
|
||||||
@ -263,6 +263,27 @@ def is_installed(name):
|
|||||||
print(f"[ComfyUI-Manager] skip black listed pip installation: '{name}'")
|
print(f"[ComfyUI-Manager] skip black listed pip installation: '{name}'")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
pkg = manager_util.get_installed_packages().get(name.lower())
|
||||||
|
if pkg is None:
|
||||||
|
return False # update if not installed
|
||||||
|
|
||||||
|
if match is None:
|
||||||
|
return True # don't update if version is not specified
|
||||||
|
|
||||||
|
if match.group(2) in ['>', '>=']:
|
||||||
|
if manager_util.StrictVersion(pkg) < manager_util.StrictVersion(match.group(3)):
|
||||||
|
return False
|
||||||
|
elif manager_util.StrictVersion(pkg) > manager_util.StrictVersion(match.group(3)):
|
||||||
|
print(f"[SKIP] Downgrading pip package isn't allowed: {name.lower()} (cur={pkg})")
|
||||||
|
|
||||||
|
if match.group(2) == '==':
|
||||||
|
if manager_util.StrictVersion(pkg) < manager_util.StrictVersion(match.group(3)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if match.group(2) == '~=':
|
||||||
|
if manager_util.StrictVersion(pkg) == manager_util.StrictVersion(match.group(3)):
|
||||||
|
return False
|
||||||
|
|
||||||
return name.lower() in manager_util.get_installed_packages()
|
return name.lower() in manager_util.get_installed_packages()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -153,10 +153,6 @@ def set_preview_method(method):
|
|||||||
set_preview_method(core.get_config()['preview_method'])
|
set_preview_method(core.get_config()['preview_method'])
|
||||||
|
|
||||||
|
|
||||||
def set_badge_mode(mode):
|
|
||||||
core.get_config()['badge_mode'] = mode
|
|
||||||
|
|
||||||
|
|
||||||
def set_default_ui_mode(mode):
|
def set_default_ui_mode(mode):
|
||||||
core.get_config()['default_ui'] = mode
|
core.get_config()['default_ui'] = mode
|
||||||
|
|
||||||
@ -1153,17 +1149,6 @@ async def preview_method(request):
|
|||||||
return web.Response(status=200)
|
return web.Response(status=200)
|
||||||
|
|
||||||
|
|
||||||
@routes.get("/manager/badge_mode")
|
|
||||||
async def badge_mode(request):
|
|
||||||
if "value" in request.rel_url.query:
|
|
||||||
set_badge_mode(request.rel_url.query['value'])
|
|
||||||
core.write_config()
|
|
||||||
else:
|
|
||||||
return web.Response(text=core.get_config()['badge_mode'], status=200)
|
|
||||||
|
|
||||||
return web.Response(status=200)
|
|
||||||
|
|
||||||
|
|
||||||
@routes.get("/manager/default_ui")
|
@routes.get("/manager/default_ui")
|
||||||
async def default_ui_mode(request):
|
async def default_ui_mode(request):
|
||||||
if "value" in request.rel_url.query:
|
if "value" in request.rel_url.query:
|
||||||
|
|||||||
@ -103,24 +103,6 @@ docStyle.innerHTML = `
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#cm-channel-badge {
|
|
||||||
color: white;
|
|
||||||
background-color: #AA0000;
|
|
||||||
width: 220px;
|
|
||||||
height: 23px;
|
|
||||||
font-size: 13px;
|
|
||||||
border-radius: 5px;
|
|
||||||
left: 5px;
|
|
||||||
top: 5px;
|
|
||||||
align-content: center;
|
|
||||||
justify-content: center;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: bold;
|
|
||||||
float: left;
|
|
||||||
vertical-align: middle;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom-nodes-grid a {
|
#custom-nodes-grid a {
|
||||||
color: #5555FF;
|
color: #5555FF;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -244,7 +226,6 @@ var update_comfyui_button = null;
|
|||||||
var switch_comfyui_button = null;
|
var switch_comfyui_button = null;
|
||||||
var fetch_updates_button = null;
|
var fetch_updates_button = null;
|
||||||
var update_all_button = null;
|
var update_all_button = null;
|
||||||
var badge_mode = "none";
|
|
||||||
let share_option = 'all';
|
let share_option = 'all';
|
||||||
|
|
||||||
// copied style from https://github.com/pythongosssss/ComfyUI-Custom-Scripts
|
// copied style from https://github.com/pythongosssss/ComfyUI-Custom-Scripts
|
||||||
@ -426,14 +407,6 @@ const style = `
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function init_badge_mode() {
|
|
||||||
api.fetchApi('/manager/badge_mode')
|
|
||||||
.then(response => response.text())
|
|
||||||
.then(data => { badge_mode = data; })
|
|
||||||
}
|
|
||||||
|
|
||||||
async function init_share_option() {
|
async function init_share_option() {
|
||||||
api.fetchApi('/manager/share_option')
|
api.fetchApi('/manager/share_option')
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
@ -450,7 +423,6 @@ async function init_notice(notice) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
await init_badge_mode();
|
|
||||||
await init_share_option();
|
await init_share_option();
|
||||||
|
|
||||||
async function fetchNicknames() {
|
async function fetchNicknames() {
|
||||||
@ -517,65 +489,6 @@ function getNickname(node, nodename) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawBadge(node, orig, restArgs) {
|
|
||||||
let ctx = restArgs[0];
|
|
||||||
const r = orig?.apply?.(node, restArgs);
|
|
||||||
|
|
||||||
if (!node.flags.collapsed && badge_mode != 'none' && node.constructor.title_mode != LiteGraph.NO_TITLE) {
|
|
||||||
let text = "";
|
|
||||||
if (badge_mode.startsWith('id_nick'))
|
|
||||||
text = `#${node.id} `;
|
|
||||||
|
|
||||||
let nick = node.getNickname();
|
|
||||||
if (nick) {
|
|
||||||
if (nick == 'ComfyUI') {
|
|
||||||
if(badge_mode.endsWith('hide')) {
|
|
||||||
nick = "";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nick = "🦊"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nick.length > 25) {
|
|
||||||
text += nick.substring(0, 23) + "..";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
text += nick;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (text != "") {
|
|
||||||
let fgColor = "white";
|
|
||||||
let bgColor = "#0F1F0F";
|
|
||||||
let visible = true;
|
|
||||||
|
|
||||||
ctx.save();
|
|
||||||
ctx.font = "12px sans-serif";
|
|
||||||
const sz = ctx.measureText(text);
|
|
||||||
ctx.fillStyle = bgColor;
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.roundRect(node.size[0] - sz.width - 12, -LiteGraph.NODE_TITLE_HEIGHT - 20, sz.width + 12, 20, 5);
|
|
||||||
ctx.fill();
|
|
||||||
|
|
||||||
ctx.fillStyle = fgColor;
|
|
||||||
ctx.fillText(text, node.size[0] - sz.width - 6, -LiteGraph.NODE_TITLE_HEIGHT - 6);
|
|
||||||
ctx.restore();
|
|
||||||
|
|
||||||
if (node.has_errors) {
|
|
||||||
ctx.save();
|
|
||||||
ctx.font = "bold 14px sans-serif";
|
|
||||||
const sz2 = ctx.measureText(node.type);
|
|
||||||
ctx.fillStyle = 'white';
|
|
||||||
ctx.fillText(node.type, node.size[0] / 2 - sz2.width / 2, node.size[1] / 2);
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function updateComfyUI() {
|
async function updateComfyUI() {
|
||||||
let prev_text = update_comfyui_button.innerText;
|
let prev_text = update_comfyui_button.innerText;
|
||||||
update_comfyui_button.innerText = "Updating ComfyUI...";
|
update_comfyui_button.innerText = "Updating ComfyUI...";
|
||||||
@ -1069,32 +982,9 @@ class ManagerMenuDialog extends ComfyDialog {
|
|||||||
api.fetchApi(`/manager/preview_method?value=${event.target.value}`);
|
api.fetchApi(`/manager/preview_method?value=${event.target.value}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// nickname
|
|
||||||
let badge_combo = "";
|
|
||||||
if(is_legacy_front()) {
|
|
||||||
badge_combo = document.createElement("select");
|
|
||||||
badge_combo.setAttribute("title", "Configure the content to be displayed on the badge at the top right corner of the node. The ID is the identifier of the node. If 'hide built-in' is selected, both unknown nodes and built-in nodes will be omitted, making them indistinguishable");
|
|
||||||
badge_combo.className = "cm-menu-combo";
|
|
||||||
badge_combo.appendChild($el('option', { value: 'none', text: 'Badge: None' }, []));
|
|
||||||
badge_combo.appendChild($el('option', { value: 'nick', text: 'Badge: Nickname' }, []));
|
|
||||||
badge_combo.appendChild($el('option', { value: 'nick_hide', text: 'Badge: Nickname (hide built-in)' }, []));
|
|
||||||
badge_combo.appendChild($el('option', { value: 'id_nick', text: 'Badge: #ID Nickname' }, []));
|
|
||||||
badge_combo.appendChild($el('option', { value: 'id_nick_hide', text: 'Badge: #ID Nickname (hide built-in)' }, []));
|
|
||||||
|
|
||||||
api.fetchApi('/manager/badge_mode')
|
|
||||||
.then(response => response.text())
|
|
||||||
.then(data => { badge_combo.value = data; badge_mode = data; });
|
|
||||||
|
|
||||||
badge_combo.addEventListener('change', function (event) {
|
|
||||||
api.fetchApi(`/manager/badge_mode?value=${event.target.value}`);
|
|
||||||
badge_mode = event.target.value;
|
|
||||||
app.graph.setDirtyCanvas(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// channel
|
// channel
|
||||||
let channel_combo = document.createElement("select");
|
let channel_combo = document.createElement("select");
|
||||||
channel_combo.setAttribute("title", "Configure the channel for retrieving data from the Custom Node list (including missing nodes) or the Model list. Note that the badge utilizes local information.");
|
channel_combo.setAttribute("title", "Configure the channel for retrieving data from the Custom Node list (including missing nodes) or the Model list.");
|
||||||
channel_combo.className = "cm-menu-combo";
|
channel_combo.className = "cm-menu-combo";
|
||||||
api.fetchApi('/manager/channel_url_list')
|
api.fetchApi('/manager/channel_url_list')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
@ -1218,7 +1108,6 @@ class ManagerMenuDialog extends ComfyDialog {
|
|||||||
this.datasrc_combo,
|
this.datasrc_combo,
|
||||||
channel_combo,
|
channel_combo,
|
||||||
preview_combo,
|
preview_combo,
|
||||||
badge_combo,
|
|
||||||
default_ui_combo,
|
default_ui_combo,
|
||||||
share_combo,
|
share_combo,
|
||||||
component_policy_combo,
|
component_policy_combo,
|
||||||
@ -1663,32 +1552,6 @@ app.registerExtension({
|
|||||||
this._addExtraNodeContextMenu(nodeType, app);
|
this._addExtraNodeContextMenu(nodeType, app);
|
||||||
},
|
},
|
||||||
|
|
||||||
async nodeCreated(node, app) {
|
|
||||||
if(is_legacy_front()) {
|
|
||||||
if(!node.badge_enabled) {
|
|
||||||
node.getNickname = function () { return getNickname(node, node.comfyClass.trim()) };
|
|
||||||
let orig = node.onDrawForeground;
|
|
||||||
if(!orig)
|
|
||||||
orig = node.__proto__.onDrawForeground;
|
|
||||||
|
|
||||||
node.onDrawForeground = function (ctx) {
|
|
||||||
drawBadge(node, orig, arguments)
|
|
||||||
};
|
|
||||||
node.badge_enabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async loadedGraphNode(node, app) {
|
|
||||||
if(is_legacy_front()) {
|
|
||||||
if(!node.badge_enabled) {
|
|
||||||
const orig = node.onDrawForeground;
|
|
||||||
node.getNickname = function () { return getNickname(node, node.type.trim()) };
|
|
||||||
node.onDrawForeground = function (ctx) { drawBadge(node, orig, arguments) };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_addExtraNodeContextMenu(node, app) {
|
_addExtraNodeContextMenu(node, app) {
|
||||||
const origGetExtraMenuOptions = node.prototype.getExtraMenuOptions;
|
const origGetExtraMenuOptions = node.prototype.getExtraMenuOptions;
|
||||||
node.prototype.cm_menu_added = true;
|
node.prototype.cm_menu_added = true;
|
||||||
|
|||||||
@ -437,6 +437,14 @@ def is_installed(name):
|
|||||||
elif manager_util.StrictVersion(pkg) > manager_util.StrictVersion(match.group(3)):
|
elif manager_util.StrictVersion(pkg) > manager_util.StrictVersion(match.group(3)):
|
||||||
print(f"[SKIP] Downgrading pip package isn't allowed: {name.lower()} (cur={pkg})")
|
print(f"[SKIP] Downgrading pip package isn't allowed: {name.lower()} (cur={pkg})")
|
||||||
|
|
||||||
|
if match.group(2) == '==':
|
||||||
|
if manager_util.StrictVersion(pkg) < manager_util.StrictVersion(match.group(3)):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if match.group(2) == '~=':
|
||||||
|
if manager_util.StrictVersion(pkg) == manager_util.StrictVersion(match.group(3)):
|
||||||
|
return False
|
||||||
|
|
||||||
return True # prevent downgrade
|
return True # prevent downgrade
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "comfyui-manager"
|
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."
|
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
||||||
version = "3.3.6"
|
version = "3.3.7"
|
||||||
license = { file = "LICENSE.txt" }
|
license = { file = "LICENSE.txt" }
|
||||||
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]
|
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user