diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 5a9844c067e..a36b1bae738 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -1128,6 +1128,32 @@ def feishu_oauth_register(oauth: OAuth): ), ) + +# PATCH EXTRA LOGIN INFO +SYSTEM_REGISTER_URL = PersistentConfig( + "SYSTEM_REGISTER_URL", + "ui.SYSTEM_REGISTER_URL", + os.environ.get("SYSTEM_REGISTER_URL", ""), +) + + +SYSTEM_REGISTER_GUIDE_URL = PersistentConfig( + "SYSTEM_REGISTER_GUIDE_URL", + "ui.SYSTEM_REGISTER_GUIDE_URL", + os.environ.get("SYSTEM_REGISTER_GUIDE_URL", ""), +) +# /PATCH EXTRA LOGIN INFO + + +# PATCH ADD LOGO TO SIDEBAR +LOGO_URL = PersistentConfig( + "LOGO_URL", + "ui.LOGO_URL", + os.environ.get("LOGO_URL", ""), +) +# /PATCH ADD LOGO TO SIDEBAR + + ENABLE_LOGIN_FORM = PersistentConfig( "ENABLE_LOGIN_FORM", "ui.ENABLE_LOGIN_FORM", diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index af8e670a538..af72e2355d9 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -367,6 +367,13 @@ DEFAULT_PROMPT_SUGGESTIONS, DEFAULT_MODELS, DEFAULT_PINNED_MODELS, + # PATCH EXTRA LOGIN INFO + SYSTEM_REGISTER_URL, + SYSTEM_REGISTER_GUIDE_URL, + # /PATCH EXTRA LOGIN INFO + # PATCH ADD LOGO TO SIDEBAR + LOGO_URL, + # /PATCH ADD LOGO TO SIDEBAR DEFAULT_ARENA_MODEL, MODEL_ORDER_LIST, EVALUATION_ARENA_MODELS, @@ -757,6 +764,18 @@ async def lifespan(app: FastAPI): app.state.config.DEFAULT_USER_ROLE = DEFAULT_USER_ROLE app.state.config.DEFAULT_GROUP_ID = DEFAULT_GROUP_ID + +# PATCH EXTRA LOGIN INFO +app.state.config.SYSTEM_REGISTER_URL = SYSTEM_REGISTER_URL +app.state.config.SYSTEM_REGISTER_GUIDE_URL = SYSTEM_REGISTER_GUIDE_URL +# /PATCH EXTRA LOGIN INFO + + +# PATCH ADD LOGO TO SIDEBAR +app.state.config.LOGO_URL = LOGO_URL +# /PATCH ADD LOGO TO SIDEBAR + + app.state.config.PENDING_USER_OVERLAY_CONTENT = PENDING_USER_OVERLAY_CONTENT app.state.config.PENDING_USER_OVERLAY_TITLE = PENDING_USER_OVERLAY_TITLE @@ -1829,6 +1848,16 @@ async def get_app_config(request: Request): for name, config in OAUTH_PROVIDERS.items() } }, + # Environment variables for patches + "extended_features": { + # PATCH EXTRA LOGIN INFO + "system_register_url": app.state.config.SYSTEM_REGISTER_URL, + "system_register_guide_url": app.state.config.SYSTEM_REGISTER_GUIDE_URL, + # /PATCH EXTRA LOGIN INFO + # PATCH ADD LOGO TO SIDEBAR + "logo_url": app.state.config.LOGO_URL, + # /PATCH ADD LOGO TO SIDEBAR + }, "features": { "auth": WEBUI_AUTH, "auth_trusted_header": bool(app.state.AUTH_TRUSTED_EMAIL_HEADER), diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index ad534dab0d0..51667aee010 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -467,6 +467,25 @@ }; const isWindows = /Windows/i.test(navigator.userAgent); + + // PATCH ADD LOGO TO SIDEBAR + function IsJson(str) { + try { + JSON.parse(str); + } catch (e) { + return false; + } + return true; + } + + function getUrl(str) { + if (IsJson(str)) { + return JSON.parse(str); + } else { + return str; + } + } + // /PATCH ADD LOGO TO SIDEBAR - + +
+
+
+ +
+
+
+ {/if} diff --git a/src/lib/stores/index.ts b/src/lib/stores/index.ts index c4c2dc10c91..e1546ec89b6 100644 --- a/src/lib/stores/index.ts +++ b/src/lib/stores/index.ts @@ -273,6 +273,18 @@ type Config = { enable_direct_connections: boolean; enable_version_update_check: boolean; }; + + // Environment variables for patches + extended_features: { + // PATCH EXTRA LOGIN INFO + system_register_url: string; + system_register_guide_url: string; + // /PATCH EXTRA LOGIN INFO + // PATCH ADD LOGO TO SIDEBAR + logo_url: string; + // /PATCH ADD LOGO TO SIDEBAR + }; + oauth: { providers: { [key: string]: string; diff --git a/src/routes/auth/+page.svelte b/src/routes/auth/+page.svelte index 727c104100a..b07e688a964 100644 --- a/src/routes/auth/+page.svelte +++ b/src/routes/auth/+page.svelte @@ -401,7 +401,45 @@ {/if} - + + {#if $config?.extended_features?.system_register_url && $config?.extended_features?.system_register_guide_url} +
+
+
+ {$i18n.t('Info')} +
+
+
+ Du skal anmode om adgang til AarhusAI (AI-platform) i Aarhus Kommunes + systemregister, før du logger på første gang. +
+ + +
+
+
+ {/if} + {#if Object.keys($config?.oauth?.providers ?? {}).length > 0}