refac
This commit is contained in:
@@ -114,6 +114,9 @@ for file_path in (FRONTEND_BUILD_DIR / 'static').glob('**/*'):
|
||||
except Exception as e:
|
||||
logging.error(f'An error occurred: {e}')
|
||||
|
||||
# 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'
|
||||
|
||||
if frontend_favicon.exists():
|
||||
@@ -181,6 +184,9 @@ CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||
# CUSTOM_NAME (Legacy)
|
||||
####################################
|
||||
|
||||
# LICENSE covers this legacy Open WebUI branding path.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
CUSTOM_NAME = os.getenv('CUSTOM_NAME', '')
|
||||
|
||||
if CUSTOM_NAME:
|
||||
|
||||
@@ -888,10 +888,16 @@ if LICENSE_PUBLIC_KEY:
|
||||
# WEBUI Identity
|
||||
####################################
|
||||
|
||||
# LICENSE covers this Open WebUI name/logo/identifier.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
WEBUI_NAME = os.getenv('WEBUI_NAME', 'Open WebUI')
|
||||
if WEBUI_NAME != 'Open WebUI':
|
||||
WEBUI_NAME += ' (Open WebUI)'
|
||||
|
||||
# LICENSE covers this Open WebUI favicon identifier.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
WEBUI_FAVICON_URL = 'https://openwebui.com/favicon.png'
|
||||
WEBUI_BUILD_HASH = os.getenv('WEBUI_BUILD_HASH', 'dev-build')
|
||||
TRUSTED_SIGNATURE_KEY = os.getenv('TRUSTED_SIGNATURE_KEY', '')
|
||||
@@ -948,6 +954,9 @@ except ValueError:
|
||||
# Progressive Web App
|
||||
####################################
|
||||
|
||||
# LICENSE covers install-time Open WebUI branding.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
EXTERNAL_PWA_MANIFEST_URL = os.getenv('EXTERNAL_PWA_MANIFEST_URL', None)
|
||||
|
||||
####################################
|
||||
|
||||
@@ -483,6 +483,9 @@ app.state.oauth_client_manager = oauth_client_manager
|
||||
app.state.instance_id = None
|
||||
app.state.redis = None
|
||||
|
||||
# LICENSE covers this Open WebUI name/logo/identifier.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
app.state.WEBUI_NAME = WEBUI_NAME
|
||||
app.state.LICENSE_METADATA = None
|
||||
app.state.USER_COUNT = None
|
||||
@@ -2688,6 +2691,9 @@ async def oauth_backchannel_logout(
|
||||
async def get_manifest_json():
|
||||
external_pwa_manifest_url = getattr(app.state, 'EXTERNAL_PWA_MANIFEST_URL', None)
|
||||
if external_pwa_manifest_url:
|
||||
# LICENSE covers install-time Open WebUI branding.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
session = await get_session()
|
||||
async with session.get(
|
||||
external_pwa_manifest_url,
|
||||
@@ -2696,6 +2702,9 @@ async def get_manifest_json():
|
||||
r.raise_for_status()
|
||||
return await r.json()
|
||||
else:
|
||||
# LICENSE covers generated Open WebUI install branding.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
return {
|
||||
'name': app.state.WEBUI_NAME,
|
||||
'short_name': app.state.WEBUI_NAME,
|
||||
@@ -2704,6 +2713,9 @@ async def get_manifest_json():
|
||||
'display': 'standalone',
|
||||
'background_color': '#343541',
|
||||
'icons': [
|
||||
# LICENSE covers this Open WebUI install icon.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
{
|
||||
'src': '/static/logo.png',
|
||||
'type': 'image/png',
|
||||
@@ -2728,6 +2740,9 @@ async def get_manifest_json():
|
||||
@app.get('/opensearch.xml')
|
||||
async def get_opensearch_xml():
|
||||
webui_url = await Config.get('webui.url')
|
||||
# LICENSE covers this Open WebUI search identifier.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
xml_content = rf"""
|
||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
|
||||
<ShortName>{app.state.WEBUI_NAME}</ShortName>
|
||||
|
||||
@@ -86,11 +86,17 @@ def get_license_data(app, key):
|
||||
def data_handler(data):
|
||||
for k, v in data.items():
|
||||
if k == 'resources':
|
||||
# LICENSE covers these Open WebUI branding assets.
|
||||
# Do not alter, remove, obscure, or replace them except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
for p, c in v.items():
|
||||
globals().get('override_static', lambda a, b: None)(p, c)
|
||||
elif k == 'count':
|
||||
setattr(app.state, 'USER_COUNT', v)
|
||||
elif k == 'name':
|
||||
# LICENSE covers this Open WebUI product name.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
setattr(app.state, 'WEBUI_NAME', v)
|
||||
elif k == 'metadata':
|
||||
setattr(app.state, 'LICENSE_METADATA', v)
|
||||
|
||||
Reference in New Issue
Block a user