directory hiding for extra networks: dirs starting with . will hide their cards on extra network tabs unless specifically searched for

create HTML for extra network pages only on demand
allow directories starting with . to still list their models for lora, checkpoints, etc
keep "search" filter for extra networks when user refreshes the page
This commit is contained in:
AUTOMATIC
2023-05-08 11:33:45 +03:00
parent 855f83f92c
commit 083dc3c76a
6 changed files with 97 additions and 49 deletions

View File

@@ -726,3 +726,20 @@ def html(filename):
return file.read()
return ""
def walk_files(path, allowed_extensions=None):
if not os.path.exists(path):
return
if allowed_extensions is not None:
allowed_extensions = set(allowed_extensions)
for root, dirs, files in os.walk(path):
for filename in files:
if allowed_extensions is not None:
_, ext = os.path.splitext(filename)
if ext not in allowed_extensions:
continue
yield os.path.join(root, filename)