feature: skip_update_check

update DB
This commit is contained in:
dr.lt.data 2023-08-04 13:14:49 +09:00
parent cd6677d82c
commit 1285aaafde
4 changed files with 43 additions and 19 deletions

View File

@ -33,7 +33,7 @@ sys.path.append('../..')
from torchvision.datasets.utils import download_url
# ensure .js
print("### Loading: ComfyUI-Manager (V0.17.3)")
print("### Loading: ComfyUI-Manager (V0.18)")
comfy_ui_required_revision = 1240
comfy_ui_revision = "Unknown"
@ -335,7 +335,7 @@ def get_model_path(data):
return os.path.join(base_model, data['filename'])
def check_a_custom_node_installed(item, do_fetch=False):
def check_a_custom_node_installed(item, do_fetch=False, do_update_check=True):
item['installed'] = 'None'
if item['install_type'] == 'git-clone' and len(item['files']) == 1:
@ -343,7 +343,7 @@ def check_a_custom_node_installed(item, do_fetch=False):
dir_path = os.path.join(custom_nodes_path, dir_name)
if os.path.exists(dir_path):
try:
if git_repo_has_updates(dir_path, do_fetch):
if do_update_check and git_repo_has_updates(dir_path, do_fetch):
item['installed'] = 'Update'
else:
item['installed'] = 'True'
@ -375,9 +375,9 @@ def check_a_custom_node_installed(item, do_fetch=False):
item['installed'] = 'False'
def check_custom_nodes_installed(json_obj, do_fetch=False):
def check_custom_nodes_installed(json_obj, do_fetch=False, do_update_check=True):
for item in json_obj['custom_nodes']:
check_a_custom_node_installed(item, do_fetch)
check_a_custom_node_installed(item, do_fetch, do_update_check)
@server.PromptServer.instance.routes.get("/customnode/getmappings")
@ -416,19 +416,29 @@ async def fetch_updates(request):
@server.PromptServer.instance.routes.get("/customnode/getlist")
async def fetch_customnode_list(request):
if "skip_update" in request.rel_url.query and request.rel_url.query["skip_update"] == "true":
skip_update = True
else:
skip_update = False
if request.rel_url.query["mode"] == "local":
uri = local_db_custom_node_list
else:
uri = 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json'
json_obj = await get_data(uri)
check_custom_nodes_installed(json_obj, False)
check_custom_nodes_installed(json_obj, False, not skip_update)
return web.json_response(json_obj, content_type='application/json')
@server.PromptServer.instance.routes.get("/alternatives/getlist")
async def fetch_alternatives_list(request):
if "skip_update" in request.rel_url.query and request.rel_url.query["skip_update"] == "true":
skip_update = True
else:
skip_update = False
if request.rel_url.query["mode"] == "local":
uri1 = local_db_alter
uri2 = local_db_custom_node_list
@ -448,7 +458,7 @@ async def fetch_alternatives_list(request):
fileurl = item['id']
if fileurl in fileurl_to_custom_node:
custom_node = fileurl_to_custom_node[fileurl]
check_a_custom_node_installed(custom_node)
check_a_custom_node_installed(custom_node, not skip_update)
item['custom_node'] = custom_node
return web.json_response(alter_json, content_type='application/json')

View File

@ -740,6 +740,7 @@
"FilterSchedule",
"JinjaRender",
"LoRAScheduler",
"PromptControlSimple",
"PromptToSchedule",
"ScheduleToCond",
"ScheduleToModel",

View File

@ -38,7 +38,11 @@ async function getCustomNodes() {
if(ManagerMenuDialog.instance.local_mode_checkbox.checked)
mode = "local";
const response = await api.fetchApi(`/customnode/getlist?mode=${mode}`);
var skip_update = "";
if(ManagerMenuDialog.instance.local_mode_checkbox.checked)
skip_update = "&skip_update=true";
const response = await api.fetchApi(`/customnode/getlist?mode=${mode}${skip_update}`);
const data = await response.json();
return data;
@ -49,7 +53,11 @@ async function getAlterList() {
if(ManagerMenuDialog.instance.local_mode_checkbox.checked)
mode = "local";
const response = await api.fetchApi(`/alternatives/getlist?mode=${mode}`);
var skip_update = "";
if(ManagerMenuDialog.instance.local_mode_checkbox.checked)
skip_update = "&skip_update=true";
const response = await api.fetchApi(`/alternatives/getlist?mode=${mode}${skip_update}`);
const data = await response.json();
return data;
@ -1321,7 +1329,12 @@ class ManagerMenuDialog extends ComfyDialog {
createButtons() {
this.local_mode_checkbox = $el("input",{type:'checkbox', id:"use_local_db"},[])
const checkbox_text = $el("label",{},[" Use local DB"])
checkbox_text.style.color = "var(--fg-color)"
checkbox_text.style.color = "var(--fg-color)";
checkbox_text.style.marginRight = "10px";
this.update_check_checkbox = $el("input",{type:'checkbox', id:"skip_update_check"},[])
const uc_checkbox_text = $el("label",{},[" Skip update check"])
uc_checkbox_text.style.color = "var(--fg-color)";
update_comfyui_button =
$el("button", {
@ -1357,7 +1370,7 @@ class ManagerMenuDialog extends ComfyDialog {
[
$el("tr.td", {width:"100%"}, [$el("font", {size:6, color:"white"}, [`ComfyUI Manager Menu`])]),
$el("br", {}, []),
$el("div", {}, [this.local_mode_checkbox, checkbox_text]),
$el("div", {}, [this.local_mode_checkbox, checkbox_text, this.update_check_checkbox, uc_checkbox_text]),
$el("br", {}, []),
$el("button", {
type: "button",

View File

@ -22,12 +22,12 @@ def scan_in_file(filename):
pattern2 = r'NODE_CLASS_MAPPINGS\["(.*?)"\]'
keys = re.findall(pattern2, code)
for key in keys:
nodes.add(key)
nodes.add(key.strip())
pattern3 = r'NODE_CLASS_MAPPINGS\[\'(.*?)\'\]'
keys = re.findall(pattern3, code)
for key in keys:
nodes.add(key)
nodes.add(key.strip())
matches = regex.findall(code)
for match in matches:
@ -35,14 +35,14 @@ def scan_in_file(filename):
key_value_pairs = re.findall(r"\"([^\"]*)\"\s*:\s*([^,\n]*)", dict_text)
for key, value in key_value_pairs:
class_dict[key] = value.strip()
class_dict[key.strip()] = value.strip()
key_value_pairs = re.findall(r"'([^']*)'\s*:\s*([^,\n]*)", dict_text)
for key, value in key_value_pairs:
class_dict[key] = value.strip()
class_dict[key.strip()] = value.strip()
for key, value in class_dict.items():
nodes.add(key)
nodes.add(key.strip())
update_pattern = r"NODE_CLASS_MAPPINGS.update\s*\({([^}]*)}\)"
update_match = re.search(update_pattern, code)
@ -50,8 +50,8 @@ def scan_in_file(filename):
update_dict_text = update_match.group(1)
update_key_value_pairs = re.findall(r"\"([^\"]*)\"\s*:\s*([^,\n]*)", update_dict_text)
for key, value in update_key_value_pairs:
class_dict[key] = value.strip()
nodes.add(key)
class_dict[key.strip()] = value.strip()
nodes.add(key.strip())
return nodes
@ -227,7 +227,7 @@ def gen_json(node_info):
nodes = set(data[git_url])
for x, desc in node_list_json.items():
nodes.add(x)
nodes.add(x.strip())
nodes = list(nodes)
nodes.sort()