Browse Source

feat: ssl bypass

pull/175/head
dr.lt.data 1 year ago
parent
commit
11b2e8ac45
  1. 25
      __init__.py

25
__init__.py

@ -10,8 +10,9 @@ import locale
import subprocess # don't remove this import subprocess # don't remove this
from tqdm.auto import tqdm from tqdm.auto import tqdm
import concurrent import concurrent
import ssl
version = "V0.40.1" version = "V0.41"
print(f"### Loading: ComfyUI-Manager ({version})") print(f"### Loading: ComfyUI-Manager ({version})")
@ -111,7 +112,8 @@ def write_config():
'badge_mode': get_config()['badge_mode'], 'badge_mode': get_config()['badge_mode'],
'git_exe': get_config()['git_exe'], 'git_exe': get_config()['git_exe'],
'channel_url': get_config()['channel_url'], 'channel_url': get_config()['channel_url'],
'channel_url_list': get_config()['channel_url_list'] 'channel_url_list': get_config()['channel_url_list'],
'bypass_ssl': get_config()['bypass_ssl']
} }
with open(config_path, 'w') as configfile: with open(config_path, 'w') as configfile:
config.write(configfile) config.write(configfile)
@ -141,7 +143,8 @@ def read_config():
'badge_mode': default_conf['badge_mode'] if 'badge_mode' in default_conf else 'none', 'badge_mode': default_conf['badge_mode'] if 'badge_mode' in default_conf else 'none',
'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 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main', '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 'channel_url_list': ch_url_list,
'bypass_ssl': default_conf['bypass_ssl'] if 'bypass_ssl' in default_conf else False,
} }
except Exception: except Exception:
@ -150,7 +153,8 @@ def read_config():
'badge_mode': 'none', 'badge_mode': 'none',
'git_exe': '', 'git_exe': '',
'channel_url': 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main', 'channel_url': 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main',
'channel_url_list': '' 'channel_url_list': '',
'bypass_ssl': False
} }
@ -1312,13 +1316,8 @@ async def install_model(request):
if json_data['url'].startswith('https://github.com') or json_data['url'].startswith('https://huggingface.co'): if json_data['url'].startswith('https://github.com') or json_data['url'].startswith('https://huggingface.co'):
model_dir = get_model_dir(json_data) model_dir = get_model_dir(json_data)
download_url(json_data['url'], model_dir)
try:
download_url(json_data['url'], model_dir)
except:
fallback_url = json_data['url'].replace('https', 'http')
download_url(fallback_url, model_dir)
return web.json_response({}, content_type='application/json') return web.json_response({}, content_type='application/json')
else: else:
res = download_url_with_agent(json_data['url'], model_path) res = download_url_with_agent(json_data['url'], model_path)
@ -1383,6 +1382,10 @@ async def channel_url_list(request):
return web.Response(status=200) return web.Response(status=200)
if get_config()['bypass_ssl']:
ssl._create_default_https_context = ssl._create_unverified_context # SSL certificate error fix.
WEB_DIRECTORY = "js" WEB_DIRECTORY = "js"
NODE_CLASS_MAPPINGS = {} NODE_CLASS_MAPPINGS = {}
__all__ = ['NODE_CLASS_MAPPINGS'] __all__ = ['NODE_CLASS_MAPPINGS']

Loading…
Cancel
Save