Browse Source

feat: channels.list

rename subscription -> channel
pull/79/head
dr.lt.data 1 year ago
parent
commit
2727b6d1ac
  1. 5
      README.md
  2. 60
      __init__.py
  3. 2
      channels.list
  4. 14
      js/comfyui-manager.js

5
README.md

@ -45,8 +45,9 @@ This repository provides Colab notebooks that allow you to install and use Comfy
* Support for automatically installing dependencies of custom nodes upon restarting Colab notebooks.
## Changes
* **0.25** support db subscription
* You can edit subscription db in config.ini
* **0.25** support db channel
* You can directly modify the db channel settings in the `config.ini` file.
* If you want to maintain a new DB channel, please modify the `channels.list` and submit a PR.
* **0.23** support multiple selection
* **0.18.1** `skip update check` feature added.
* A feature that allows quickly opening windows in environments where update checks take a long time.

60
__init__.py

@ -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)

2
channels.list

@ -0,0 +1,2 @@
default::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main
new::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/new

14
js/comfyui-manager.js vendored

@ -1784,9 +1784,9 @@ class ManagerMenuDialog extends ComfyDialog {
app.graph.setDirtyCanvas(true);
});
// subscription
let subscription_combo = document.createElement("select");
api.fetchApi('/manager/subscription_url_list')
// channel
let channel_combo = document.createElement("select");
api.fetchApi('/manager/channel_url_list')
.then(response => response.text())
.then(data => {
try {
@ -1794,12 +1794,12 @@ class ManagerMenuDialog extends ComfyDialog {
for(let i in urls) {
if(urls[i] != '') {
let name_url = urls[i].split('::');
subscription_combo.appendChild($el('option', {value:name_url[0], text:`subscribe: ${name_url[0]}`}, []));
channel_combo.appendChild($el('option', {value:name_url[0], text:`Channel: ${name_url[0]}`}, []));
}
}
subscription_combo.addEventListener('change', function(event) {
api.fetchApi(`/manager/subscription_url_list?value=${event.target.value}`);
channel_combo.addEventListener('change', function(event) {
api.fetchApi(`/manager/channel_url_list?value=${event.target.value}`);
});
}
catch(exception) {
@ -1873,7 +1873,7 @@ class ManagerMenuDialog extends ComfyDialog {
$el("hr", {width: "100%"}, []),
preview_combo,
badge_combo,
subscription_combo,
channel_combo,
$el("hr", {width: "100%"}, []),
$el("br", {}, []),

Loading…
Cancel
Save