This commit is contained in:
Timothy Jaeryang Baek 2026-08-25 13:51:58 -04:00
parent d241df8d79
commit 2e6d61e6d0

View file

@ -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`}