Browse Source

refac: splash screen

Timothy J. Baek 9 months ago
parent
commit
c2f4eab8ed
6 changed files with 17 additions and 8 deletions
  1. 13 0
      backend/config.py
  2. BIN
      backend/static/splash.png
  3. 4 4
      src/app.html
  4. 0 4
      static/logo.svg
  5. BIN
      static/static/splash-dark.png
  6. BIN
      static/static/splash.png

+ 13 - 0
backend/config.py

@@ -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)

BIN
backend/static/splash.png


+ 4 - 4
src/app.html

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

+ 0 - 4
static/logo.svg

@@ -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>

BIN
static/static/splash-dark.png


BIN
static/static/splash.png