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 r.raw.decode_content = True
shutil.copyfileobj(r.raw, f) 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"] WEBUI_NAME = data["name"]
except Exception as e: except Exception as e:
log.exception(e) log.exception(e)

BIN
backend/static/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -82,13 +82,13 @@
id="logo" id="logo"
style=" style="
position: absolute; position: absolute;
width: 6rem; width: auto;
height: 6rem; height: 6rem;
top: 41%; top: 41%;
left: 50%; left: 50%;
margin-left: -3rem; margin-left: -3rem;
" "
src="/logo.svg" src="/static/splash.png"
/> />
<div <div
@ -107,8 +107,8 @@
> >
<img <img
id="logo-her" id="logo-her"
style="width: 13rem; height: 13rem" style="width: auto; height: 13rem"
src="/logo.svg" src="/static/splash.png"
class="animate-pulse-fast" class="animate-pulse-fast"
/> />

View File

@ -1,4 +0,0 @@
<svg width="500" height="500" viewBox="0 0 500 500" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="347.666" y="139" width="44.3349" height="221.675" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M202.643 360.287C263.75 360.287 313.287 310.75 313.287 249.643C313.287 188.537 263.75 139 202.643 139C141.537 139 92 188.537 92 249.643C92 310.75 141.537 360.287 202.643 360.287ZM202.645 316.029C239.309 316.029 269.031 286.307 269.031 249.643C269.031 212.979 239.309 183.257 202.645 183.257C165.981 183.257 136.259 212.979 136.259 249.643C136.259 286.307 165.981 316.029 202.645 316.029Z" fill="black"/>
</svg>

Before

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
static/static/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB