Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
78a57487
Commit
78a57487
authored
Jul 08, 2024
by
Timothy J. Baek
Browse files
refac
parent
666a8ea5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
backend/config.py
backend/config.py
+14
-3
No files found.
backend/config.py
View file @
78a57487
...
@@ -450,16 +450,27 @@ load_oauth_providers()
...
@@ -450,16 +450,27 @@ load_oauth_providers()
STATIC_DIR
=
Path
(
os
.
getenv
(
"STATIC_DIR"
,
BACKEND_DIR
/
"static"
)).
resolve
()
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
():
if
frontend_favicon
.
exists
():
try
:
try
:
shutil
.
copyfile
(
frontend_favicon
,
STATIC_DIR
/
"favicon.png"
)
shutil
.
copyfile
(
frontend_favicon
,
STATIC_DIR
/
"favicon.png"
)
except
Exception
as
e
:
except
Exception
as
e
:
logging
.
error
(
f
"An error occurred:
{
e
}
"
)
logging
.
error
(
f
"An error occurred:
{
e
}
"
)
else
:
else
:
logging
.
warning
(
f
"Frontend favicon not found at
{
frontend_favicon
}
"
)
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
# CUSTOM_NAME
####################################
####################################
...
@@ -495,7 +506,7 @@ if CUSTOM_NAME:
...
@@ -495,7 +506,7 @@ if CUSTOM_NAME:
if
r
.
status_code
==
200
:
if
r
.
status_code
==
200
:
with
open
(
f
"
{
STATIC_DIR
}
/splash.png"
,
"wb"
)
as
f
:
with
open
(
f
"
{
STATIC_DIR
}
/splash.png"
,
"wb"
)
as
f
:
r
.
raw
.
decode_content
=
True
r
.
raw
.
decode_content
=
True
shutil
.
copyfileobj
(
r
.
raw
,
f
)
shutil
.
copyfileobj
(
r
.
raw
,
f
)
WEBUI_NAME
=
data
[
"name"
]
WEBUI_NAME
=
data
[
"name"
]
except
Exception
as
e
:
except
Exception
as
e
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment