mirror of https://github.com/vladmandic/automatic
improve extensions options compatibility
Signed-off-by: Vladimir Mandic <mandic00@live.com>pull/3779/head
parent
88cfb758df
commit
68e42649c4
|
|
@ -29,6 +29,7 @@ Primarily a hotfix/service release plus few UI improvements and one exciting new
|
|||
- fix torch import on compile
|
||||
- infotext parser force delimiter before params
|
||||
- handle pipeline class switch errors
|
||||
- improve extensions options compatibility
|
||||
|
||||
## Update for 2025-02-18
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,23 @@ from installer import log
|
|||
|
||||
|
||||
class OptionInfo:
|
||||
def __init__(self, default=None, label="", component=None, component_args=None, onchange=None, section=None, refresh=None, folder=None, submit=None, comment_before='', comment_after=''):
|
||||
def __init__(
|
||||
self,
|
||||
default=None,
|
||||
label="",
|
||||
component=None,
|
||||
component_args=None,
|
||||
onchange=None,
|
||||
section=None,
|
||||
refresh=None,
|
||||
folder=None,
|
||||
submit=None,
|
||||
comment_before='',
|
||||
comment_after='',
|
||||
category_id=None, # pylint: disable=unused-argument
|
||||
*args, # pylint: disable=unused-argument
|
||||
**kwargs, # pylint: disable=unused-argument
|
||||
): # pylint: disable=keyword-arg-before-vararg
|
||||
self.default = default
|
||||
self.label = label
|
||||
self.component = component
|
||||
|
|
|
|||
|
|
@ -73,7 +73,9 @@ def check_access():
|
|||
|
||||
|
||||
def apply_changes(disable_list, update_list, disable_all):
|
||||
check_access()
|
||||
if shared.cmd_opts.disable_extension_access:
|
||||
shared.log.error('Extension: apply changes disallowed because public access is enabled and insecure is not specified')
|
||||
return
|
||||
shared.log.debug(f'Extensions apply: disable={disable_list} update={update_list}')
|
||||
disabled = json.loads(disable_list)
|
||||
assert type(disabled) == list, f"wrong disable_list data for apply_changes: {disable_list}"
|
||||
|
|
@ -94,7 +96,9 @@ def apply_changes(disable_list, update_list, disable_all):
|
|||
|
||||
|
||||
def check_updates(_id_task, disable_list, search_text, sort_column):
|
||||
check_access()
|
||||
if shared.cmd_opts.disable_extension_access:
|
||||
shared.log.error('Extension: apply changes disallowed because public access is enabled and insecure is not specified')
|
||||
return
|
||||
disabled = json.loads(disable_list)
|
||||
assert type(disabled) == list, f"wrong disable_list data for apply_and_restart: {disable_list}"
|
||||
exts = [ext for ext in extensions.extensions if ext.remote is not None and ext.name not in disabled]
|
||||
|
|
@ -141,15 +145,21 @@ def normalize_git_url(url):
|
|||
|
||||
|
||||
def install_extension_from_url(dirname, url, branch_name, search_text, sort_column):
|
||||
check_access()
|
||||
assert url, 'No URL specified'
|
||||
if shared.cmd_opts.disable_extension_access:
|
||||
shared.log.error('Extension: apply changes disallowed because public access is enabled and insecure is not specified')
|
||||
return ['', '']
|
||||
if url is None or len(url) == 0:
|
||||
shared.log.error('Extension: url is not specified')
|
||||
return ['', '']
|
||||
if dirname is None or dirname == "":
|
||||
*parts, last_part = url.split('/') # pylint: disable=unused-variable
|
||||
last_part = normalize_git_url(last_part)
|
||||
dirname = last_part
|
||||
target_dir = os.path.join(extensions.extensions_dir, dirname)
|
||||
shared.log.info(f'Installing extension: {url} into {target_dir}')
|
||||
assert not os.path.exists(target_dir), f'Extension directory already exists: {target_dir}'
|
||||
if os.path.exists(target_dir):
|
||||
shared.log.error(f'Extension: path="{target_dir}" directory already exists')
|
||||
return ['', '']
|
||||
normalized_url = normalize_git_url(url)
|
||||
assert len([x for x in extensions.extensions if normalize_git_url(x.remote) == normalized_url]) == 0, 'Extension with this URL is already installed'
|
||||
tmpdir = os.path.join(paths.data_path, "tmp", dirname)
|
||||
|
|
|
|||
4
webui.py
4
webui.py
|
|
@ -319,7 +319,9 @@ def start_ui():
|
|||
shared.log.info(f'Local URL: {local_url}')
|
||||
if shared.cmd_opts.listen:
|
||||
if not gradio_auth_creds:
|
||||
shared.log.warning('Public interface enabled without authentication')
|
||||
shared.log.warning('Public URL: enabled without authentication')
|
||||
if shared.cmd_opts.insecure:
|
||||
shared.log.warning('Public URL: enabled with insecure flag')
|
||||
proto = 'https' if shared.cmd_opts.tls_keyfile is not None else 'http'
|
||||
external_ip = get_external_ip()
|
||||
if external_ip is not None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue