mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-28 08:25:01 -06:00
refac
This commit is contained in:
@@ -77,11 +77,15 @@
|
||||
'bg-transparent outline-hidden placeholder:text-gray-300 dark:placeholder:text-gray-700';
|
||||
const selectClass =
|
||||
'bg-transparent pr-5 outline-hidden placeholder:text-gray-300 dark:placeholder:text-gray-700';
|
||||
const isMcpOAuth = () => type === 'mcp' && ['oauth_2.1', 'oauth_2.1_static'].includes(auth_type);
|
||||
const oauthAuthTypes = ['oauth_2.1', 'oauth_2.1_static'];
|
||||
const verifyLabel = () =>
|
||||
isMcpOAuth() ? $i18n.t('Check OAuth Discovery') : $i18n.t('Verify Connection');
|
||||
oauthAuthTypes.includes(auth_type)
|
||||
? $i18n.t('Check OAuth Discovery')
|
||||
: $i18n.t('Verify Connection');
|
||||
const verifySuccessMessage = () =>
|
||||
isMcpOAuth() ? $i18n.t('OAuth discovery successful') : $i18n.t('Connection successful');
|
||||
oauthAuthTypes.includes(auth_type)
|
||||
? $i18n.t('OAuth discovery successful')
|
||||
: $i18n.t('Connection successful');
|
||||
|
||||
const authorizeOAuthHandler = () => {
|
||||
if (!id) {
|
||||
@@ -213,7 +217,7 @@
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
...(isMcpOAuth()
|
||||
...(oauthAuthTypes.includes(auth_type)
|
||||
? {
|
||||
...(oauthServerUrl ? { oauth_server_url: oauthServerUrl } : {}),
|
||||
...(oauthScope ? { oauth_scope: oauthScope } : {}),
|
||||
@@ -335,11 +339,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
type === 'mcp' &&
|
||||
['oauth_2.1', 'oauth_2.1_static'].includes(auth_type) &&
|
||||
!oauthClientInfo
|
||||
) {
|
||||
if (type === 'mcp' && oauthAuthTypes.includes(auth_type) && !oauthClientInfo) {
|
||||
toast.error($i18n.t('Please register the OAuth client'));
|
||||
loading = false;
|
||||
return;
|
||||
@@ -392,7 +392,7 @@
|
||||
id: id,
|
||||
name: name,
|
||||
description: description,
|
||||
...(type === 'mcp' && ['oauth_2.1', 'oauth_2.1_static'].includes(auth_type)
|
||||
...(type === 'mcp' && oauthAuthTypes.includes(auth_type)
|
||||
? {
|
||||
...(oauthScope ? { oauth_scope: oauthScope } : {}),
|
||||
oauth_resource_parameter: oauthResourceParameter
|
||||
@@ -684,7 +684,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if isMcpOAuth()}
|
||||
{#if oauthAuthTypes.includes(auth_type)}
|
||||
<div class="flex items-center gap-2">
|
||||
{#if oauthClientInfo}
|
||||
<div class="flex flex-col justify-end items-center shrink-0">
|
||||
@@ -916,7 +916,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if type === 'mcp' && ['oauth_2.1', 'oauth_2.1_static'].includes(auth_type)}
|
||||
{#if type === 'mcp' && oauthAuthTypes.includes(auth_type)}
|
||||
<div class="flex gap-2 mt-2">
|
||||
<div class="flex flex-col w-full">
|
||||
<label for="oauth-scope" class={`mb-0.5 text-xs text-gray-500`}
|
||||
|
||||
Reference in New Issue
Block a user