mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-21 04:10:48 +08:00
fix: channel bug fix
This commit is contained in:
parent
c298ca4e68
commit
ccd991c6cc
16
__init__.py
16
__init__.py
@ -55,7 +55,7 @@ sys.path.append('../..')
|
|||||||
from torchvision.datasets.utils import download_url
|
from torchvision.datasets.utils import download_url
|
||||||
|
|
||||||
# ensure .js
|
# ensure .js
|
||||||
print("### Loading: ComfyUI-Manager (V0.26)")
|
print("### Loading: ComfyUI-Manager (V0.26.1)")
|
||||||
|
|
||||||
comfy_ui_required_revision = 1240
|
comfy_ui_required_revision = 1240
|
||||||
comfy_ui_revision = "Unknown"
|
comfy_ui_revision = "Unknown"
|
||||||
@ -1057,16 +1057,26 @@ async def badge_mode(request):
|
|||||||
@server.PromptServer.instance.routes.get("/manager/channel_url_list")
|
@server.PromptServer.instance.routes.get("/manager/channel_url_list")
|
||||||
async def channel_url_list(request):
|
async def channel_url_list(request):
|
||||||
channels = default_channels+","+get_config()['channel_url_list']
|
channels = default_channels+","+get_config()['channel_url_list']
|
||||||
|
channels = channels.split(',')
|
||||||
|
|
||||||
if "value" in request.rel_url.query:
|
if "value" in request.rel_url.query:
|
||||||
for item in channels.split(','):
|
for item in channels:
|
||||||
name_url = item.split("::")
|
name_url = item.split("::")
|
||||||
if len(name_url) == 2 and name_url[0] == request.rel_url.query['value']:
|
if len(name_url) == 2 and name_url[0] == request.rel_url.query['value']:
|
||||||
get_config()['channel_url'] = name_url[1]
|
get_config()['channel_url'] = name_url[1]
|
||||||
write_config()
|
write_config()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
return web.Response(text=channels, status=200)
|
selected = 'custom'
|
||||||
|
selected_url = get_config()['channel_url']
|
||||||
|
for item in channels:
|
||||||
|
item_info = item.split('::')
|
||||||
|
if len(item_info) == 2 and item_info[1] == selected_url:
|
||||||
|
selected = item_info[0]
|
||||||
|
|
||||||
|
res = {'selected': selected,
|
||||||
|
'list': channels}
|
||||||
|
return web.json_response(res, status=200)
|
||||||
|
|
||||||
return web.Response(status=200)
|
return web.Response(status=200)
|
||||||
|
|
||||||
|
|||||||
@ -1776,7 +1776,7 @@ class ManagerMenuDialog extends ComfyDialog {
|
|||||||
|
|
||||||
api.fetchApi('/manager/badge_mode')
|
api.fetchApi('/manager/badge_mode')
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(data => { badge_combo.value = data; badge_mode = data; })
|
.then(data => { badge_combo.value = data; badge_mode = data; });
|
||||||
|
|
||||||
badge_combo.addEventListener('change', function(event) {
|
badge_combo.addEventListener('change', function(event) {
|
||||||
api.fetchApi(`/manager/badge_mode?value=${event.target.value}`);
|
api.fetchApi(`/manager/badge_mode?value=${event.target.value}`);
|
||||||
@ -1787,10 +1787,10 @@ class ManagerMenuDialog extends ComfyDialog {
|
|||||||
// channel
|
// channel
|
||||||
let channel_combo = document.createElement("select");
|
let channel_combo = document.createElement("select");
|
||||||
api.fetchApi('/manager/channel_url_list')
|
api.fetchApi('/manager/channel_url_list')
|
||||||
.then(response => response.text())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(async data => {
|
||||||
try {
|
try {
|
||||||
let urls = data.split(',');
|
let urls = data.list;
|
||||||
for(let i in urls) {
|
for(let i in urls) {
|
||||||
if(urls[i] != '') {
|
if(urls[i] != '') {
|
||||||
let name_url = urls[i].split('::');
|
let name_url = urls[i].split('::');
|
||||||
@ -1801,6 +1801,8 @@ class ManagerMenuDialog extends ComfyDialog {
|
|||||||
channel_combo.addEventListener('change', function(event) {
|
channel_combo.addEventListener('change', function(event) {
|
||||||
api.fetchApi(`/manager/channel_url_list?value=${event.target.value}`);
|
api.fetchApi(`/manager/channel_url_list?value=${event.target.value}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
channel_combo.value = data.selected;
|
||||||
}
|
}
|
||||||
catch(exception) {
|
catch(exception) {
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user