This commit is contained in:
Timothy Jaeryang Baek 2026-10-10 20:41:13 +04:00
parent 212bfc13e9
commit 0c3f74c9c1

View file

@ -18,6 +18,7 @@ from pydantic import BaseModel
from open_webui.env import (
USE_SLIM,
BASE_DIR,
DATA_DIR,
DATABASE_URL,
ENABLE_ADMIN_CHAT_ACCESS,
@ -96,6 +97,11 @@ async def import_legacy_config_json():
####################################
STATIC_DIR = Path(os.getenv('STATIC_DIR', OPEN_WEBUI_DIR / 'static')).resolve()
STATIC_SOURCE_DIR = FRONTEND_BUILD_DIR / 'static'
if not STATIC_SOURCE_DIR.is_dir():
STATIC_SOURCE_DIR = BASE_DIR / 'static' / 'static'
if not STATIC_SOURCE_DIR.is_dir():
raise RuntimeError(f'Static asset source directory not found: {STATIC_SOURCE_DIR}')
try:
if STATIC_DIR.exists():
@ -108,9 +114,9 @@ try:
except Exception as e:
pass
for file_path in (FRONTEND_BUILD_DIR / 'static').glob('**/*'):
for file_path in STATIC_SOURCE_DIR.glob('**/*'):
if file_path.is_file():
target_path = STATIC_DIR / file_path.relative_to((FRONTEND_BUILD_DIR / 'static'))
target_path = STATIC_DIR / file_path.relative_to(STATIC_SOURCE_DIR)
target_path.parent.mkdir(parents=True, exist_ok=True)
try:
shutil.copyfile(file_path, target_path)
@ -120,7 +126,7 @@ for file_path in (FRONTEND_BUILD_DIR / 'static').glob('**/*'):
# LICENSE covers copied Open WebUI logo/favicon assets.
# Do not alter, remove, obscure, or replace them except as LICENSE permits:
# https://docs.openwebui.com/license.
frontend_favicon = FRONTEND_BUILD_DIR / 'static' / 'favicon.png'
frontend_favicon = STATIC_SOURCE_DIR / 'favicon.png'
if frontend_favicon.exists():
try:
@ -128,7 +134,7 @@ if frontend_favicon.exists():
except Exception as e:
logging.error(f'An error occurred: {e}')
frontend_splash = FRONTEND_BUILD_DIR / 'static' / 'splash.png'
frontend_splash = STATIC_SOURCE_DIR / 'splash.png'
if frontend_splash.exists():
try:
@ -136,7 +142,7 @@ if frontend_splash.exists():
except Exception as e:
logging.error(f'An error occurred: {e}')
frontend_loader = FRONTEND_BUILD_DIR / 'static' / 'loader.js'
frontend_loader = STATIC_SOURCE_DIR / 'loader.js'
if frontend_loader.exists():
try: