add exception handler in case preload breaks?

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
pull/37/head
Victor Seiji Hariki 2023-01-24 19:44:30 -03:00
parent 4ebdc9acc0
commit 20a3397e97
2 changed files with 17 additions and 6 deletions

View File

@ -2,4 +2,5 @@ import argparse
def preload(parser: argparse.ArgumentParser):
parser.add_argument("--lock-oo-submodule", action='store_true',
help="(openOutpaint-webUI-extension) Prevent checking for main openOutpaint submodule updates.")
help="(openOutpaint-webUI-extension) Prevent checking for main openOutpaint submodule updates.")

View File

@ -38,7 +38,7 @@ def started(demo, app: FastAPI):
# Add to allowed files list
app.blocks.temp_file_sets.append(force_allow)
# Force allow paths for fixing symlinked extension directory references (base javascript files now)
force_allow = get_files(extension_dir / "javascript")
@ -49,11 +49,21 @@ def started(demo, app: FastAPI):
pass
def update_app():
git = os.environ.get('GIT', "git")
run(f'"{git}" -C "' + scripts.basedir() +
'" submodule update --init --recursive --remote')
def add_tab():
if (not shared.cmd_opts.lock_oo_submodule):
git = os.environ.get('GIT', "git")
run(f'"{git}" -C "' + scripts.basedir() +
'" submodule update --init --recursive --remote')
try:
if shared.cmd_opts.lock_oo_submodule:
print(f"[openOutpaint] Submodule locked. Will skip submodule update.")
else:
update_app()
except Exception:
update_app()
with gr.Blocks(analytics_enabled=False) as ui:
#refresh = gr.Button(value="refresh", variant="primary")
canvas = gr.HTML(