Timothy Jaeryang Baek 4 月之前
父節點
當前提交
74ccec2812

+ 9 - 8
backend/open_webui/config.py

@@ -989,18 +989,19 @@ DEFAULT_USER_ROLE = PersistentConfig(
     os.getenv("DEFAULT_USER_ROLE", "pending"),
     os.getenv("DEFAULT_USER_ROLE", "pending"),
 )
 )
 
 
-ACCOUNT_PENDING_TEXT = PersistentConfig(
-    "ACCOUNT_PENDING_TEXT",
-    "ui.account_pending_text",
-    os.environ.get("ACCOUNT_PENDING_TEXT", "")
+PENDING_USER_OVERLAY_TITLE = PersistentConfig(
+    "PENDING_USER_OVERLAY_TITLE",
+    "ui.pending_user_overlay_title",
+    os.environ.get("PENDING_USER_OVERLAY_TITLE", ""),
 )
 )
 
 
-ACCOUNT_PENDING_TITLE = PersistentConfig(
-    "ACCOUNT_PENDING_TITLE",
-    "ui.account_pending_title",
-    os.environ.get("ACCOUNT_PENDING_TITLE", "")
+PENDING_USER_OVERLAY_CONTENT = PersistentConfig(
+    "PENDING_USER_OVERLAY_CONTENT",
+    "ui.pending_user_overlay_content",
+    os.environ.get("PENDING_USER_OVERLAY_CONTENT", ""),
 )
 )
 
 
+
 USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS = (
 USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS = (
     os.environ.get("USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS", "False").lower()
     os.environ.get("USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS", "False").lower()
     == "true"
     == "true"

+ 6 - 6
backend/open_webui/main.py

@@ -292,8 +292,8 @@ from open_webui.config import (
     ENABLE_EVALUATION_ARENA_MODELS,
     ENABLE_EVALUATION_ARENA_MODELS,
     USER_PERMISSIONS,
     USER_PERMISSIONS,
     DEFAULT_USER_ROLE,
     DEFAULT_USER_ROLE,
-    ACCOUNT_PENDING_TEXT,
-    ACCOUNT_PENDING_TITLE,
+    PENDING_USER_OVERLAY_CONTENT,
+    PENDING_USER_OVERLAY_TITLE,
     DEFAULT_PROMPT_SUGGESTIONS,
     DEFAULT_PROMPT_SUGGESTIONS,
     DEFAULT_MODELS,
     DEFAULT_MODELS,
     DEFAULT_ARENA_MODEL,
     DEFAULT_ARENA_MODEL,
@@ -575,8 +575,8 @@ app.state.config.ADMIN_EMAIL = ADMIN_EMAIL
 app.state.config.DEFAULT_MODELS = DEFAULT_MODELS
 app.state.config.DEFAULT_MODELS = DEFAULT_MODELS
 app.state.config.DEFAULT_PROMPT_SUGGESTIONS = DEFAULT_PROMPT_SUGGESTIONS
 app.state.config.DEFAULT_PROMPT_SUGGESTIONS = DEFAULT_PROMPT_SUGGESTIONS
 app.state.config.DEFAULT_USER_ROLE = DEFAULT_USER_ROLE
 app.state.config.DEFAULT_USER_ROLE = DEFAULT_USER_ROLE
-app.state.config.ACCOUNT_PENDING_TEXT = ACCOUNT_PENDING_TEXT
-app.state.config.ACCOUNT_PENDING_TITLE = ACCOUNT_PENDING_TITLE
+app.state.config.PENDING_USER_OVERLAY_CONTENT = PENDING_USER_OVERLAY_CONTENT
+app.state.config.PENDING_USER_OVERLAY_TITLE = PENDING_USER_OVERLAY_TITLE
 
 
 app.state.config.USER_PERMISSIONS = USER_PERMISSIONS
 app.state.config.USER_PERMISSIONS = USER_PERMISSIONS
 app.state.config.WEBHOOK_URL = WEBHOOK_URL
 app.state.config.WEBHOOK_URL = WEBHOOK_URL
@@ -1402,8 +1402,8 @@ async def get_app_config(request: Request):
                     "sharepoint_tenant_id": ONEDRIVE_SHAREPOINT_TENANT_ID.value,
                     "sharepoint_tenant_id": ONEDRIVE_SHAREPOINT_TENANT_ID.value,
                 },
                 },
                 "ui": {
                 "ui": {
-                    "account_pending_title": app.state.config.ACCOUNT_PENDING_TITLE,
-                    "account_pending_text": app.state.config.ACCOUNT_PENDING_TEXT,
+                    "pending_user_overlay_title": app.state.config.PENDING_USER_OVERLAY_TITLE,
+                    "pending_user_overlay_content": app.state.config.PENDING_USER_OVERLAY_CONTENT,
                 },
                 },
                 "license_metadata": app.state.LICENSE_METADATA,
                 "license_metadata": app.state.LICENSE_METADATA,
                 **(
                 **(

+ 12 - 8
backend/open_webui/routers/auths.py

@@ -696,8 +696,8 @@ async def get_admin_config(request: Request, user=Depends(get_admin_user)):
         "ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS,
         "ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS,
         "ENABLE_NOTES": request.app.state.config.ENABLE_NOTES,
         "ENABLE_NOTES": request.app.state.config.ENABLE_NOTES,
         "ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS,
         "ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS,
-        "ACCOUNT_PENDING_TEXT": request.app.state.config.ACCOUNT_PENDING_TEXT,
-        "ACCOUNT_PENDING_TITLE": request.app.state.config.ACCOUNT_PENDING_TITLE,
+        "PENDING_USER_OVERLAY_TITLE": request.app.state.config.PENDING_USER_OVERLAY_TITLE,
+        "PENDING_USER_OVERLAY_CONTENT": request.app.state.config.PENDING_USER_OVERLAY_CONTENT,
     }
     }
 
 
 
 
@@ -715,8 +715,8 @@ class AdminConfig(BaseModel):
     ENABLE_CHANNELS: bool
     ENABLE_CHANNELS: bool
     ENABLE_NOTES: bool
     ENABLE_NOTES: bool
     ENABLE_USER_WEBHOOKS: bool
     ENABLE_USER_WEBHOOKS: bool
-    ACCOUNT_PENDING_TEXT: Optional[str] = None
-    ACCOUNT_PENDING_TITLE: Optional[str] = None
+    PENDING_USER_OVERLAY_TITLE: Optional[str] = None
+    PENDING_USER_OVERLAY_CONTENT: Optional[str] = None
 
 
 
 
 @router.post("/admin/config")
 @router.post("/admin/config")
@@ -754,8 +754,12 @@ async def update_admin_config(
 
 
     request.app.state.config.ENABLE_USER_WEBHOOKS = form_data.ENABLE_USER_WEBHOOKS
     request.app.state.config.ENABLE_USER_WEBHOOKS = form_data.ENABLE_USER_WEBHOOKS
 
 
-    request.app.state.config.ACCOUNT_PENDING_TEXT = form_data.ACCOUNT_PENDING_TEXT
-    request.app.state.config.ACCOUNT_PENDING_TITLE = form_data.ACCOUNT_PENDING_TITLE
+    request.app.state.config.PENDING_USER_OVERLAY_TITLETLE = (
+        form_data.PENDING_USER_OVERLAY_TITLE
+    )
+    request.app.state.config.PENDING_USER_OVERLAY_CONTENT = (
+        form_data.PENDING_USER_OVERLAY_CONTENT
+    )
 
 
     return {
     return {
         "SHOW_ADMIN_DETAILS": request.app.state.config.SHOW_ADMIN_DETAILS,
         "SHOW_ADMIN_DETAILS": request.app.state.config.SHOW_ADMIN_DETAILS,
@@ -771,8 +775,8 @@ async def update_admin_config(
         "ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS,
         "ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS,
         "ENABLE_NOTES": request.app.state.config.ENABLE_NOTES,
         "ENABLE_NOTES": request.app.state.config.ENABLE_NOTES,
         "ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS,
         "ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS,
-        "ACCOUNT_PENDING_TEXT": request.app.state.config.ACCOUNT_PENDING_TEXT,
-        "ACCOUNT_PENDING_TITLE": request.app.state.config.ACCOUNT_PENDING_TITLE,
+        "PENDING_USER_OVERLAY_TITLE": request.app.state.config.PENDING_USER_OVERLAY_TITLE,
+        "PENDING_USER_OVERLAY_CONTENT": request.app.state.config.PENDING_USER_OVERLAY_CONTENT,
     }
     }
 
 
 
 

+ 20 - 14
src/lib/components/admin/Settings/General.svelte

@@ -18,6 +18,7 @@
 	import { compareVersion } from '$lib/utils';
 	import { compareVersion } from '$lib/utils';
 	import { onMount, getContext } from 'svelte';
 	import { onMount, getContext } from 'svelte';
 	import { toast } from 'svelte-sonner';
 	import { toast } from 'svelte-sonner';
+	import Textarea from '$lib/components/common/Textarea.svelte';
 
 
 	const i18n = getContext('i18n');
 	const i18n = getContext('i18n');
 
 
@@ -306,23 +307,28 @@
 					</div>
 					</div>
 
 
 					<div class="mb-3.5">
 					<div class="mb-3.5">
-						<div class=" self-center text-xs font-medium mb-1">{$i18n.t('Custom Account Pending Title')}</div>
-						<textarea
-							class="w-full mt-1 rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
-							rows="2"
-							placeholder={$i18n.t('Enter a custom title to be displayed on the account pending screen. Leave empty for default.')}
-							bind:value={adminConfig.ACCOUNT_PENDING_TITLE}
-						></textarea>
+						<div class=" self-center text-xs font-medium mb-1">
+							{$i18n.t('Pending User Overlay Title')}
+						</div>
+						<Textarea
+							rows={2}
+							placeholder={$i18n.t(
+								'Enter a title for the pending user info overlay. Leave empty for default.'
+							)}
+							bind:value={adminConfig.PENDING_USER_OVERLAY_TITLE}
+						/>
 					</div>
 					</div>
 
 
 					<div class="mb-3.5">
 					<div class="mb-3.5">
-						<div class=" self-center text-xs font-medium mb-1">{$i18n.t('Custom Account Pending Text')}</div>
-						<textarea
-							class="w-full mt-1 rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
-							rows="3"
-							placeholder={$i18n.t('Enter a custom text to be displayed on the account pending screen. Leave empty for default.')}
-							bind:value={adminConfig.ACCOUNT_PENDING_TEXT}
-						></textarea>
+						<div class=" self-center text-xs font-medium mb-1">
+							{$i18n.t('Pending User Overlay Content')}
+						</div>
+						<Textarea
+							placeholder={$i18n.t(
+								'Enter content for the pending user info overlay. Leave empty for default.'
+							)}
+							bind:value={adminConfig.PENDING_USER_OVERLAY_CONTENT}
+						/>
 					</div>
 					</div>
 
 
 					<div class="mb-2.5 flex w-full justify-between pr-2">
 					<div class="mb-2.5 flex w-full justify-between pr-2">

+ 13 - 7
src/lib/components/layout/Overlay/AccountPending.svelte

@@ -21,17 +21,23 @@
 	>
 	>
 		<div class="m-auto pb-10 flex flex-col justify-center">
 		<div class="m-auto pb-10 flex flex-col justify-center">
 			<div class="max-w-md">
 			<div class="max-w-md">
-				<div class="text-center dark:text-white text-2xl font-medium z-50" style="white-space: pre-wrap;">
-					{#if $config?.ui?.account_pending_title && $config?.ui?.account_pending_title.trim() !== ""}
-						{$config.ui.account_pending_title}
+				<div
+					class="text-center dark:text-white text-2xl font-medium z-50"
+					style="white-space: pre-wrap;"
+				>
+					{#if $config?.ui?.pending_user_overlay_title && $config?.ui?.pending_user_overlay_title.trim() !== ''}
+						{$config.ui.pending_user_overlay_title}
 					{:else}
 					{:else}
-						{$i18n.t('Account Activation Pending')}{#if !$config?.ui?.account_pending_title || $config?.ui?.account_pending_title.trim() === ""}<br />{/if}{$i18n.t('Contact Admin for WebUI Access')}
+						{$i18n.t('Account Activation Pending')}<br />{$i18n.t('Contact Admin for WebUI Access')}
 					{/if}
 					{/if}
 				</div>
 				</div>
 
 
-				<div class=" mt-4 text-center text-sm dark:text-gray-200 w-full" style="white-space: pre-wrap;">
-					{#if $config?.ui?.account_pending_text && $config?.ui?.account_pending_text.trim() !== ""}
-						{$config.ui.account_pending_text}
+				<div
+					class=" mt-4 text-center text-sm dark:text-gray-200 w-full"
+					style="white-space: pre-wrap;"
+				>
+					{#if $config?.ui?.pending_user_overlay_content && $config?.ui?.pending_user_overlay_content.trim() !== ''}
+						{$config.ui.pending_user_overlay_content}
 					{:else}
 					{:else}
 						{$i18n.t('Your account status is currently pending activation.')}{'\n'}{$i18n.t(
 						{$i18n.t('Your account status is currently pending activation.')}{'\n'}{$i18n.t(
 							'To access the WebUI, please reach out to the administrator. Admins can manage user statuses from the Admin Panel.'
 							'To access the WebUI, please reach out to the administrator. Admins can manage user statuses from the Admin Panel.'

+ 4 - 2
src/lib/stores/index.ts

@@ -220,8 +220,10 @@ type Config = {
 			[key: string]: string;
 			[key: string]: string;
 		};
 		};
 	};
 	};
-	account_pending_title?: string;
-    account_pending_text?: string;
+	ui?: {
+		pending_user_overlay_title?: string;
+		pending_user_overlay_description?: string;
+	};
 };
 };
 
 
 type PromptSuggestion = {
 type PromptSuggestion = {