mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-09 22:24:23 +08:00
fix channel_url config (#1501)
* 1.fix channel_url not effecte for default_cache_update 2.support http channel url for airgap env * fix pylint
This commit is contained in:
parent
b5cdcb75b4
commit
6ea0aebb0b
@ -325,6 +325,8 @@ def normalize_channel(channel):
|
||||
return None
|
||||
elif channel.startswith('https://'):
|
||||
return channel
|
||||
elif channel.startswith('http://') and get_config()['http_channel_enabled'] == True:
|
||||
return channel
|
||||
|
||||
tmp_dict = get_channel_dict()
|
||||
channel_url = tmp_dict.get(channel)
|
||||
@ -1586,6 +1588,7 @@ def read_config():
|
||||
manager_util.use_uv = default_conf['use_uv'].lower() == 'true' if 'use_uv' in default_conf else False
|
||||
|
||||
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(),
|
||||
'git_exe': default_conf['git_exe'] if 'git_exe' in default_conf else '',
|
||||
'use_uv': default_conf['use_uv'].lower() == 'true' if 'use_uv' in default_conf else False,
|
||||
@ -1605,6 +1608,7 @@ def read_config():
|
||||
except Exception:
|
||||
manager_util.use_uv = False
|
||||
return {
|
||||
'http_channel_enabled': False,
|
||||
'preview_method': manager_funcs.get_current_preview_method(),
|
||||
'git_exe': '',
|
||||
'use_uv': False,
|
||||
@ -1627,6 +1631,8 @@ def get_config():
|
||||
|
||||
if cached_config is None:
|
||||
cached_config = read_config()
|
||||
if cached_config['http_channel_enabled']:
|
||||
print("[ComfyUI-Manager] Warning: http channel enabled, make sure server in secure env")
|
||||
|
||||
return cached_config
|
||||
|
||||
@ -2086,19 +2092,13 @@ async def get_data_by_mode(mode, filename, channel_url=None):
|
||||
cache_uri = str(manager_util.simple_hash(uri))+'_'+filename
|
||||
cache_uri = os.path.join(manager_util.cache_dir, cache_uri)
|
||||
|
||||
if mode == "cache":
|
||||
if manager_util.is_file_created_within_one_day(cache_uri):
|
||||
if mode == "cache" and manager_util.is_file_created_within_one_day(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:
|
||||
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)
|
||||
except Exception as e:
|
||||
print(f"[ComfyUI-Manager] Due to a network error, switching to local mode.\n=> {filename}\n=> {e}")
|
||||
uri = os.path.join(manager_util.comfyui_manager_path, filename)
|
||||
|
||||
@ -1576,8 +1576,9 @@ cm_global.register_api('cm.try-install-custom-node', confirm_try_install)
|
||||
|
||||
|
||||
async def default_cache_update():
|
||||
channel_url = core.get_config()['channel_url']
|
||||
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 = os.path.join(manager_util.cache_dir, cache_uri)
|
||||
|
||||
@ -1598,7 +1599,7 @@ async def default_cache_update():
|
||||
|
||||
# load at least once
|
||||
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.")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user