mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2026-02-13 22:52:31 +08:00
1.fix channel_url not effecte for default_cache_update
2.support http channel url for airgap env
This commit is contained in:
parent
0f7b9d02a0
commit
ab424d8f18
@ -324,6 +324,8 @@ def normalize_channel(channel):
|
|||||||
return None
|
return None
|
||||||
elif channel.startswith('https://'):
|
elif channel.startswith('https://'):
|
||||||
return channel
|
return channel
|
||||||
|
elif channel.startswith('http://') and get_config()['http_channel_enabled'] == True:
|
||||||
|
return channel
|
||||||
|
|
||||||
tmp_dict = get_channel_dict()
|
tmp_dict = get_channel_dict()
|
||||||
channel_url = tmp_dict.get(channel)
|
channel_url = tmp_dict.get(channel)
|
||||||
@ -1582,6 +1584,7 @@ def read_config():
|
|||||||
security_level = default_conf['security_level'] if 'security_level' in default_conf else 'normal'
|
security_level = default_conf['security_level'] if 'security_level' in default_conf else 'normal'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'http_channel_enabled': default_conf['http_channel_enabled'].lower() == 'true' if 'http_channel_enabled' in default_conf else False,
|
||||||
'preview_method': default_conf['preview_method'] if 'preview_method' in default_conf else manager_funcs.get_current_preview_method(),
|
'preview_method': default_conf['preview_method'] if 'preview_method' in default_conf else manager_funcs.get_current_preview_method(),
|
||||||
'git_exe': default_conf['git_exe'] if 'git_exe' in default_conf else '',
|
'git_exe': default_conf['git_exe'] if 'git_exe' in default_conf else '',
|
||||||
'channel_url': default_conf['channel_url'] if 'channel_url' in default_conf else DEFAULT_CHANNEL,
|
'channel_url': default_conf['channel_url'] if 'channel_url' in default_conf else DEFAULT_CHANNEL,
|
||||||
@ -1599,6 +1602,7 @@ def read_config():
|
|||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
return {
|
return {
|
||||||
|
'http_channel_enabled': False,
|
||||||
'preview_method': manager_funcs.get_current_preview_method(),
|
'preview_method': manager_funcs.get_current_preview_method(),
|
||||||
'git_exe': '',
|
'git_exe': '',
|
||||||
'channel_url': DEFAULT_CHANNEL,
|
'channel_url': DEFAULT_CHANNEL,
|
||||||
@ -1620,6 +1624,8 @@ def get_config():
|
|||||||
|
|
||||||
if cached_config is None:
|
if cached_config is None:
|
||||||
cached_config = read_config()
|
cached_config = read_config()
|
||||||
|
if cached_config['http_channel_enabled']:
|
||||||
|
print(f"[ComfyUI-Manager] Warning: http channel enabled, make sure server in secure env")
|
||||||
|
|
||||||
return cached_config
|
return cached_config
|
||||||
|
|
||||||
@ -2073,14 +2079,8 @@ async def get_data_by_mode(mode, filename, channel_url=None):
|
|||||||
cache_uri = str(manager_util.simple_hash(uri))+'_'+filename
|
cache_uri = str(manager_util.simple_hash(uri))+'_'+filename
|
||||||
cache_uri = os.path.join(manager_util.cache_dir, cache_uri)
|
cache_uri = os.path.join(manager_util.cache_dir, cache_uri)
|
||||||
|
|
||||||
if mode == "cache":
|
if mode == "cache" and manager_util.is_file_created_within_one_day(cache_uri):
|
||||||
if manager_util.is_file_created_within_one_day(cache_uri):
|
|
||||||
json_obj = await manager_util.get_data(cache_uri)
|
json_obj = await manager_util.get_data(cache_uri)
|
||||||
else:
|
|
||||||
json_obj = await manager_util.get_data(uri)
|
|
||||||
with manager_util.cache_lock:
|
|
||||||
with open(cache_uri, "w", encoding='utf-8') as file:
|
|
||||||
json.dump(json_obj, file, indent=4, sort_keys=True)
|
|
||||||
else:
|
else:
|
||||||
json_obj = await manager_util.get_data(uri)
|
json_obj = await manager_util.get_data(uri)
|
||||||
with manager_util.cache_lock:
|
with manager_util.cache_lock:
|
||||||
|
|||||||
@ -1412,8 +1412,9 @@ import asyncio
|
|||||||
|
|
||||||
|
|
||||||
async def default_cache_update():
|
async def default_cache_update():
|
||||||
|
channel_url = core.get_config()['channel_url']
|
||||||
async def get_cache(filename):
|
async def get_cache(filename):
|
||||||
uri = f"{core.DEFAULT_CHANNEL}/{filename}"
|
uri = f"{channel_url}/{filename}"
|
||||||
cache_uri = str(manager_util.simple_hash(uri)) + '_' + filename
|
cache_uri = str(manager_util.simple_hash(uri)) + '_' + filename
|
||||||
cache_uri = os.path.join(manager_util.cache_dir, cache_uri)
|
cache_uri = os.path.join(manager_util.cache_dir, cache_uri)
|
||||||
|
|
||||||
@ -1434,7 +1435,7 @@ async def default_cache_update():
|
|||||||
|
|
||||||
# load at least once
|
# load at least once
|
||||||
await core.unified_manager.reload('remote', dont_wait=False)
|
await core.unified_manager.reload('remote', dont_wait=False)
|
||||||
await core.unified_manager.get_custom_nodes('default', 'remote')
|
await core.unified_manager.get_custom_nodes(channel_url, 'remote')
|
||||||
|
|
||||||
logging.info("[ComfyUI-Manager] All startup tasks have been completed.")
|
logging.info("[ComfyUI-Manager] All startup tasks have been completed.")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user