From 78a57487278ff11681be8391d42c71f8eaf71a92 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 8 Jul 2024 23:21:17 -0700 Subject: [PATCH] refac --- backend/config.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/backend/config.py b/backend/config.py index 040a811ab..fe68eee34 100644 --- a/backend/config.py +++ b/backend/config.py @@ -450,16 +450,27 @@ load_oauth_providers() STATIC_DIR = Path(os.getenv("STATIC_DIR", BACKEND_DIR / "static")).resolve() -frontend_favicon = FRONTEND_BUILD_DIR / "favicon.png" +frontend_favicon = FRONTEND_BUILD_DIR / "static" / "favicon.png" + if frontend_favicon.exists(): try: shutil.copyfile(frontend_favicon, STATIC_DIR / "favicon.png") except Exception as e: logging.error(f"An error occurred: {e}") - else: logging.warning(f"Frontend favicon not found at {frontend_favicon}") +frontend_splash = FRONTEND_BUILD_DIR / "static" / "splash.png" + +if frontend_splash.exists(): + try: + shutil.copyfile(frontend_splash, STATIC_DIR / "splash.png") + except Exception as e: + logging.error(f"An error occurred: {e}") +else: + logging.warning(f"Frontend splash not found at {frontend_splash}") + + #################################### # CUSTOM_NAME #################################### @@ -495,7 +506,7 @@ if CUSTOM_NAME: if r.status_code == 200: with open(f"{STATIC_DIR}/splash.png", "wb") as f: r.raw.decode_content = True - shutil.copyfileobj(r.raw, f) + shutil.copyfileobj(r.raw, f) WEBUI_NAME = data["name"] except Exception as e: