refac: splash screen

This commit is contained in:
Timothy J. Baek
2024-07-08 22:20:00 -07:00
parent 47c76ab5fe
commit c2f4eab8ed
6 changed files with 17 additions and 8 deletions

View File

@@ -484,6 +484,19 @@ if CUSTOM_NAME:
r.raw.decode_content = True
shutil.copyfileobj(r.raw, f)
if "splash" in data:
url = (
f"https://api.openwebui.com{data['splash']}"
if data["splash"][0] == "/"
else data["splash"]
)
r = requests.get(url, stream=True)
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)
WEBUI_NAME = data["name"]
except Exception as e:
log.exception(e)