mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
use extension name for determining an extension is installed in the index
This commit is contained in:
parent
5f36f6ab21
commit
ac2a981c4f
@ -335,6 +335,11 @@ def normalize_git_url(url):
|
|||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
||||||
|
def get_extension_dirname_from_url(url):
|
||||||
|
*parts, last_part = url.split('/')
|
||||||
|
return normalize_git_url(last_part)
|
||||||
|
|
||||||
|
|
||||||
def install_extension_from_url(dirname, url, branch_name=None):
|
def install_extension_from_url(dirname, url, branch_name=None):
|
||||||
check_access()
|
check_access()
|
||||||
|
|
||||||
@ -346,10 +351,7 @@ def install_extension_from_url(dirname, url, branch_name=None):
|
|||||||
assert url, 'No URL specified'
|
assert url, 'No URL specified'
|
||||||
|
|
||||||
if dirname is None or dirname == "":
|
if dirname is None or dirname == "":
|
||||||
*parts, last_part = url.split('/')
|
dirname = get_extension_dirname_from_url(url)
|
||||||
last_part = normalize_git_url(last_part)
|
|
||||||
|
|
||||||
dirname = last_part
|
|
||||||
|
|
||||||
target_dir = os.path.join(extensions.extensions_dir, dirname)
|
target_dir = os.path.join(extensions.extensions_dir, dirname)
|
||||||
assert not os.path.exists(target_dir), f'Extension directory already exists: {target_dir}'
|
assert not os.path.exists(target_dir), f'Extension directory already exists: {target_dir}'
|
||||||
@ -449,7 +451,7 @@ def get_date(info: dict, key):
|
|||||||
|
|
||||||
def refresh_available_extensions_from_data(hide_tags, sort_column, filter_text=""):
|
def refresh_available_extensions_from_data(hide_tags, sort_column, filter_text=""):
|
||||||
extlist = available_extensions["extensions"]
|
extlist = available_extensions["extensions"]
|
||||||
installed_extension_urls = {normalize_git_url(extension.remote): extension.name for extension in extensions.extensions}
|
installed_extensions = {extension.name for extension in extensions.extensions}
|
||||||
|
|
||||||
tags = available_extensions.get("tags", {})
|
tags = available_extensions.get("tags", {})
|
||||||
tags_to_hide = set(hide_tags)
|
tags_to_hide = set(hide_tags)
|
||||||
@ -482,7 +484,7 @@ def refresh_available_extensions_from_data(hide_tags, sort_column, filter_text="
|
|||||||
if url is None:
|
if url is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
existing = installed_extension_urls.get(normalize_git_url(url), None)
|
existing = get_extension_dirname_from_url(url) in installed_extensions
|
||||||
extension_tags = extension_tags + ["installed"] if existing else extension_tags
|
extension_tags = extension_tags + ["installed"] if existing else extension_tags
|
||||||
|
|
||||||
if any(x for x in extension_tags if x in tags_to_hide):
|
if any(x for x in extension_tags if x in tags_to_hide):
|
||||||
|
Loading…
Reference in New Issue
Block a user