|
|
|
@ -55,7 +55,7 @@ sys.path.append('../..')
|
|
|
|
|
from torchvision.datasets.utils import download_url |
|
|
|
|
|
|
|
|
|
# ensure .js |
|
|
|
|
print("### Loading: ComfyUI-Manager (V0.25.3)") |
|
|
|
|
print("### Loading: ComfyUI-Manager (V0.25.4)") |
|
|
|
|
|
|
|
|
|
comfy_ui_required_revision = 1240 |
|
|
|
|
comfy_ui_revision = "Unknown" |
|
|
|
@ -76,6 +76,12 @@ config_path = os.path.join(os.path.dirname(__file__), "config.ini")
|
|
|
|
|
cached_config = None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default_channels = 'default::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main,new::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/new,' |
|
|
|
|
with open(os.path.join(comfyui_manager_path, 'channels.list'), 'r') as file: |
|
|
|
|
channels = file.read() |
|
|
|
|
default_channels = channels.replace('\n', ',') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from comfy.cli_args import args |
|
|
|
|
import latent_preview |
|
|
|
|
|
|
|
|
@ -85,8 +91,8 @@ def write_config():
|
|
|
|
|
config['default'] = { |
|
|
|
|
'preview_method': get_current_preview_method(), |
|
|
|
|
'badge_mode': get_config()['badge_mode'], |
|
|
|
|
'subscription_url': get_config()['subscription_url'], |
|
|
|
|
'subscription_url_list': get_config()['subscription_url_list'] |
|
|
|
|
'channel_url': get_config()['channel_url'], |
|
|
|
|
'channel_url_list': get_config()['channel_url_list'] |
|
|
|
|
} |
|
|
|
|
with open(config_path, 'w') as configfile: |
|
|
|
|
config.write(configfile) |
|
|
|
@ -98,32 +104,32 @@ def read_config():
|
|
|
|
|
config.read(config_path) |
|
|
|
|
default_conf = config['default'] |
|
|
|
|
|
|
|
|
|
subscription_url_list_is_valid = True |
|
|
|
|
if 'subscription_url_list' in default_conf: |
|
|
|
|
for item in default_conf['subscription_url_list'].split(","): |
|
|
|
|
channel_url_list_is_valid = True |
|
|
|
|
if 'channel_url_list' in default_conf: |
|
|
|
|
for item in default_conf['channel_url_list'].split(","): |
|
|
|
|
if len(item.split("::")) != 2: |
|
|
|
|
subscription_url_list_is_valid = False |
|
|
|
|
channel_url_list_is_valid = False |
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
if subscription_url_list_is_valid: |
|
|
|
|
sub_url_list = default_conf['subscription_url_list'] |
|
|
|
|
if channel_url_list_is_valid: |
|
|
|
|
ch_url_list = default_conf['channel_url_list'] |
|
|
|
|
else: |
|
|
|
|
print(f"[WARN] ComfyUI-Manager: subscription_url_list is invalid format") |
|
|
|
|
sub_url_list = 'default::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main,new::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/new,' |
|
|
|
|
print(f"[WARN] ComfyUI-Manager: channel_url_list is invalid format") |
|
|
|
|
ch_url_list = '' |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
'preview_method': default_conf['preview_method'] if 'preview_method' in default_conf else get_current_preview_method(), |
|
|
|
|
'badge_mode': default_conf['badge_mode'] if 'badge_mode' in default_conf else 'none', |
|
|
|
|
'subscription_url': default_conf['subscription_url'] if 'subscription_url' in default_conf else 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main', |
|
|
|
|
'subscription_url_list': sub_url_list |
|
|
|
|
'channel_url': default_conf['channel_url'] if 'channel_url' in default_conf else 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main', |
|
|
|
|
'channel_url_list': ch_url_list |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
except Exception: |
|
|
|
|
return { |
|
|
|
|
'preview_method': get_current_preview_method(), |
|
|
|
|
'badge_mode': 'none', |
|
|
|
|
'subscription_url': 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main', |
|
|
|
|
'subscription_url_list': 'default::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main,new::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/new,' |
|
|
|
|
'channel_url': 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main', |
|
|
|
|
'channel_url_list': '' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -450,7 +456,7 @@ async def fetch_customnode_mappings(request):
|
|
|
|
|
if request.rel_url.query["mode"] == "local": |
|
|
|
|
uri = local_db_extension_node_mappings |
|
|
|
|
else: |
|
|
|
|
uri = get_config()['subscription_url'] + '/extension-node-map.json' |
|
|
|
|
uri = get_config()['channel_url'] + '/extension-node-map.json' |
|
|
|
|
|
|
|
|
|
json_obj = await get_data(uri) |
|
|
|
|
|
|
|
|
@ -463,7 +469,7 @@ async def fetch_updates(request):
|
|
|
|
|
if request.rel_url.query["mode"] == "local": |
|
|
|
|
uri = local_db_custom_node_list |
|
|
|
|
else: |
|
|
|
|
uri = get_config()['subscription_url'] + '/custom-node-list.json' |
|
|
|
|
uri = get_config()['channel_url'] + '/custom-node-list.json' |
|
|
|
|
|
|
|
|
|
json_obj = await get_data(uri) |
|
|
|
|
check_custom_nodes_installed(json_obj, True) |
|
|
|
@ -489,7 +495,7 @@ async def fetch_customnode_list(request):
|
|
|
|
|
if request.rel_url.query["mode"] == "local": |
|
|
|
|
uri = local_db_custom_node_list |
|
|
|
|
else: |
|
|
|
|
uri = get_config()['subscription_url'] + '/custom-node-list.json' |
|
|
|
|
uri = get_config()['channel_url'] + '/custom-node-list.json' |
|
|
|
|
|
|
|
|
|
json_obj = await get_data(uri) |
|
|
|
|
check_custom_nodes_installed(json_obj, False, not skip_update) |
|
|
|
@ -508,8 +514,8 @@ async def fetch_alternatives_list(request):
|
|
|
|
|
uri1 = local_db_alter |
|
|
|
|
uri2 = local_db_custom_node_list |
|
|
|
|
else: |
|
|
|
|
uri1 = get_config()['subscription_url'] + '/alter-list.json' |
|
|
|
|
uri2 = get_config()['subscription_url'] + '/custom-node-list.json' |
|
|
|
|
uri1 = get_config()['channel_url'] + '/alter-list.json' |
|
|
|
|
uri2 = get_config()['channel_url'] + '/custom-node-list.json' |
|
|
|
|
|
|
|
|
|
alter_json = await get_data(uri1) |
|
|
|
|
custom_node_json = await get_data(uri2) |
|
|
|
@ -547,7 +553,7 @@ async def fetch_externalmodel_list(request):
|
|
|
|
|
if request.rel_url.query["mode"] == "local": |
|
|
|
|
uri = local_db_model |
|
|
|
|
else: |
|
|
|
|
uri = get_config()['subscription_url'] + '/model-list.json' |
|
|
|
|
uri = get_config()['channel_url'] + '/model-list.json' |
|
|
|
|
|
|
|
|
|
json_obj = await get_data(uri) |
|
|
|
|
check_model_installed(json_obj) |
|
|
|
@ -1046,17 +1052,19 @@ async def badge_mode(request):
|
|
|
|
|
return web.Response(status=200) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@server.PromptServer.instance.routes.get("/manager/subscription_url_list") |
|
|
|
|
async def subscription_url_list(request): |
|
|
|
|
@server.PromptServer.instance.routes.get("/manager/channel_url_list") |
|
|
|
|
async def channel_url_list(request): |
|
|
|
|
channels = default_channels+","+get_config()['channel_url_list'] |
|
|
|
|
|
|
|
|
|
if "value" in request.rel_url.query: |
|
|
|
|
for item in get_config()['subscription_url_list'].split(','): |
|
|
|
|
for item in channels.split(','): |
|
|
|
|
name_url = item.split("::") |
|
|
|
|
if len(name_url) == 2 and name_url[0] == request.rel_url.query['value']: |
|
|
|
|
get_config()['subscription_url'] = name_url[1] |
|
|
|
|
get_config()['channel_url'] = name_url[1] |
|
|
|
|
write_config() |
|
|
|
|
break |
|
|
|
|
else: |
|
|
|
|
return web.Response(text=get_config()['subscription_url_list'], status=200) |
|
|
|
|
return web.Response(text=channels, status=200) |
|
|
|
|
|
|
|
|
|
return web.Response(status=200) |
|
|
|
|
|
|
|
|
|