🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style: improve built-in client OIDC user flow (#10020)
Arvin Xu80202ed4ff43
diff --git a/locales/ar/oauth.json b/locales/ar/oauth.jsonindex 379a4eb7104..ca8cb0c0502 100644--- a/locales/ar/oauth.json+++ b/locales/ar/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "طلب الأذونات التالية:","redirectUri": "سيتم إعادة التوجيه إلى بعد نجاح التفويض",+ "redirecting": "تم التفويض بنجاح، جارٍ إعادة التوجيه...","scope": {"email": "الوصول إلى عنوان بريدك الإلكتروني","offline_access": "السماح للتطبيق بالوصول إلى بياناتك",diff --git a/locales/bg-BG/oauth.json b/locales/bg-BG/oauth.jsonindex 76b099a64b1..4dceb29f243 100644--- a/locales/bg-BG/oauth.json+++ b/locales/bg-BG/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Искаме следните разрешения:","redirectUri": "Ще бъдете пренасочени след успешното разрешение",+ "redirecting": "Успешно упълномощено, пренасочване...","scope": {"email": "Достъп до вашия имейл адрес","offline_access": "Позволете на клиента да получи достъп до вашите данни",diff --git a/locales/de-DE/oauth.json b/locales/de-DE/oauth.jsonindex 751f82dd3bf..14ff46d5cfa 100644--- a/locales/de-DE/oauth.json+++ b/locales/de-DE/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Anforderung der folgenden Berechtigungen:","redirectUri": "Nach erfolgreicher Autorisierung werden Sie umgeleitet zu",+ "redirecting": "Autorisierung erfolgreich, Weiterleitung...","scope": {"email": "Zugriff auf Ihre E-Mail-Adresse","offline_access": "Erlauben Sie dem Client, auf Ihre Daten zuzugreifen",diff --git a/locales/en-US/oauth.json b/locales/en-US/oauth.jsonindex 424a2ac2eea..8c5e887d5a4 100644--- a/locales/en-US/oauth.json+++ b/locales/en-US/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Requesting the following permissions:","redirectUri": "You will be redirected to after successful authorization",+ "redirecting": "Authorization successful, redirecting...","scope": {"email": "Access your email address","offline_access": "Allow the client to access your data",diff --git a/locales/es-ES/oauth.json b/locales/es-ES/oauth.jsonindex 0afe8fcc33c..3ed656f01e2 100644--- a/locales/es-ES/oauth.json+++ b/locales/es-ES/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Solicitar los siguientes permisos:","redirectUri": "Se redirigirá a después de la autorización exitosa",+ "redirecting": "Autorización exitosa, redirigiendo...","scope": {"email": "Acceder a su dirección de correo electrónico","offline_access": "Permitir que el cliente acceda a sus datos",diff --git a/locales/fa-IR/oauth.json b/locales/fa-IR/oauth.jsonindex dfb78fdaa37..b158bfa9d15 100644--- a/locales/fa-IR/oauth.json+++ b/locales/fa-IR/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "درخواست مجوزهای زیر:","redirectUri": "پس از موفقیت در مجوز، به آدرس زیر هدایت میشوید",+ "redirecting": "دسترسی با موفقیت انجام شد، در حال انتقال...","scope": {"email": "دسترسی به آدرس ایمیل شما","offline_access": "اجازه دسترسی به دادههای شما توسط کلاینت",diff --git a/locales/fr-FR/oauth.json b/locales/fr-FR/oauth.jsonindex e0437ec0f03..94b2175b4d2 100644--- a/locales/fr-FR/oauth.json+++ b/locales/fr-FR/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Demander les autorisations suivantes :","redirectUri": "Vous serez redirigé vers après une autorisation réussie",+ "redirecting": "Autorisation réussie, redirection en cours...","scope": {"email": "Accéder à votre adresse e-mail","offline_access": "Autoriser le client à accéder à vos données",diff --git a/locales/it-IT/oauth.json b/locales/it-IT/oauth.jsonindex 6e5492b5711..447b93a0885 100644--- a/locales/it-IT/oauth.json+++ b/locales/it-IT/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Richiesta delle seguenti autorizzazioni:","redirectUri": "Verrai reindirizzato a dopo un'autorizzazione riuscita",+ "redirecting": "Autorizzazione completata, reindirizzamento in corso...","scope": {"email": "Accesso al tuo indirizzo email","offline_access": "Consenti all'accesso del client ai tuoi dati",diff --git a/locales/ja-JP/oauth.json b/locales/ja-JP/oauth.jsonindex 6b09cb21cf1..18c421f26b9 100644--- a/locales/ja-JP/oauth.json+++ b/locales/ja-JP/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "以下の権限をリクエストします:","redirectUri": "承認が成功した後、次の場所にリダイレクトされます",+ "redirecting": "認証に成功しました。リダイレクト中です...","scope": {"email": "あなたのメールアドレスにアクセス","offline_access": "クライアントがあなたのデータにアクセスすることを許可",diff --git a/locales/ko-KR/oauth.json b/locales/ko-KR/oauth.jsonindex 00c8967f9b1..d067a1b46ad 100644--- a/locales/ko-KR/oauth.json+++ b/locales/ko-KR/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "다음 권한을 요청합니다:","redirectUri": "인증이 완료되면 다음으로 리디렉션됩니다:",+ "redirecting": "인증이 완료되었습니다. 이동 중...","scope": {"email": "귀하의 이메일 주소에 접근","offline_access": "클라이언트가 귀하의 데이터에 접근할 수 있도록 허용",diff --git a/locales/nl-NL/oauth.json b/locales/nl-NL/oauth.jsonindex 77a000cfe7d..e04e8e8ba4d 100644--- a/locales/nl-NL/oauth.json+++ b/locales/nl-NL/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Vraag om de volgende toestemmingen:","redirectUri": "U wordt omgeleid naar na succesvolle autorisatie",+ "redirecting": "Autorisatie geslaagd, doorverwijzen...","scope": {"email": "Toegang tot uw e-mailadres","offline_access": "Toestaan dat de client toegang heeft tot uw gegevens",diff --git a/locales/pl-PL/oauth.json b/locales/pl-PL/oauth.jsonindex 9abd355255b..91fa7fa38db 100644--- a/locales/pl-PL/oauth.json+++ b/locales/pl-PL/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Proszę o następujące uprawnienia:","redirectUri": "Zostaniesz przekierowany po pomyślnym autoryzowaniu",+ "redirecting": "Autoryzacja zakończona pomyślnie, przekierowywanie...","scope": {"email": "Dostęp do Twojego adresu e-mail","offline_access": "Zezwól klientowi na dostęp do Twoich danych",diff --git a/locales/pt-BR/oauth.json b/locales/pt-BR/oauth.jsonindex 0d882ca91a4..2ef083219c1 100644--- a/locales/pt-BR/oauth.json+++ b/locales/pt-BR/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Solicitar as seguintes permissões:","redirectUri": "Você será redirecionado após a autorização bem-sucedida",+ "redirecting": "Autorização bem-sucedida, redirecionando...","scope": {"email": "Acessar seu endereço de e-mail","offline_access": "Permitir que o cliente acesse seus dados",diff --git a/locales/ru-RU/oauth.json b/locales/ru-RU/oauth.jsonindex 665493579e4..ed709e1046c 100644--- a/locales/ru-RU/oauth.json+++ b/locales/ru-RU/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Запросить следующие разрешения:","redirectUri": "После успешного авторизации будет выполнен редирект на",+ "redirecting": "Авторизация прошла успешно, перенаправление...","scope": {"email": "Доступ к вашему адресу электронной почты","offline_access": "Разрешить клиенту доступ к вашим данным",diff --git a/locales/tr-TR/oauth.json b/locales/tr-TR/oauth.jsonindex 34b429c4152..6e93dad9345 100644--- a/locales/tr-TR/oauth.json+++ b/locales/tr-TR/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Aşağıdaki izinleri talep et:","redirectUri": "İzin verildikten sonra şu adrese yönlendirileceksiniz",+ "redirecting": "Yetkilendirme başarılı, yönlendiriliyor...","scope": {"email": "E-posta adresinize erişim","offline_access": "Müşterinin verilerinize erişmesine izin ver",diff --git a/locales/vi-VN/oauth.json b/locales/vi-VN/oauth.jsonindex c789cfd21ac..6518b316924 100644--- a/locales/vi-VN/oauth.json+++ b/locales/vi-VN/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "Yêu cầu các quyền sau:","redirectUri": "Sẽ được chuyển hướng đến sau khi ủy quyền thành công",+ "redirecting": "Ủy quyền thành công, đang chuyển hướng...","scope": {"email": "Truy cập địa chỉ email của bạn","offline_access": "Cho phép ứng dụng truy cập dữ liệu của bạn",diff --git a/locales/zh-CN/oauth.json b/locales/zh-CN/oauth.jsonindex 87bd4f168ae..7882d862645 100644--- a/locales/zh-CN/oauth.json+++ b/locales/zh-CN/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "请求以下权限:","redirectUri": "授权成功后将重定向到",+ "redirecting": "授权成功,跳转中...","scope": {"email": "访问您的电子邮件地址","offline_access": "允许客户端访问您的数据",diff --git a/locales/zh-TW/oauth.json b/locales/zh-TW/oauth.jsonindex ed7f6fd6df5..a7e3e82b765 100644--- a/locales/zh-TW/oauth.json+++ b/locales/zh-TW/oauth.json@@ -18,6 +18,7 @@},"permissionsTitle": "請求以下權限:","redirectUri": "授權成功後將重定向到",+ "redirecting": "授權成功,正在跳轉...","scope": {"email": "訪問您的電子郵件地址","offline_access": "允許客戶端訪問您的資料",diff --git a/src/app/[variants]/oauth/consent/[uid]/Consent/BuiltinConsent.tsx b/src/app/[variants]/oauth/consent/[uid]/Consent/BuiltinConsent.tsxnew file mode 100644index 00000000000..55ec6b4c934--- /dev/null+++ b/src/app/[variants]/oauth/consent/[uid]/Consent/BuiltinConsent.tsx@@ -0,0 +1,57 @@+'use client';++import { Icon } from '@lobehub/ui';+import { Card, Result } from 'antd';+import { useTheme } from 'antd-style';+import { LoaderCircle } from 'lucide-react';+import { memo, useEffect, useRef } from 'react';+import { useTranslation } from 'react-i18next';+import { Center } from 'react-layout-kit';++interface BuiltinConsentProps {+ uid: string;+}++const BuiltinConsent = memo<BuiltinConsentProps>(({ uid }) => {+ const { t } = useTranslation('oauth');+ const formRef = useRef<HTMLFormElement>(null);++ useEffect(() => {+ // Auto-submit on mount+ formRef.current?.submit();+ }, []);++ const theme = useTheme();+ return (+ <>+ <Center height="100vh">+ <Card+ style={{+ alignItems: 'center',+ display: 'flex',+ justifyContent: 'center',+ minHeight: 280,+ minWidth: 500,+ width: '100%',+ }}+ >+ <Result+ icon={<Icon icon={LoaderCircle} spin style={{ color: theme.colorText }} />}+ status="success"+ style={{ padding: 0 }}+ subTitle={t('consent.redirecting')}+ title=""+ />+ </Card>+ </Center>+ <form action="/oidc/consent" method="post" ref={formRef} style={{ display: 'none' }}>+ <input name="uid" type="hidden" value={uid} />+ <input name="consent" type="hidden" value="accept" />+ </form>+ </>+ );+});++BuiltinConsent.displayName = 'BuiltinConsent';++export default BuiltinConsent;diff --git a/src/app/[variants]/oauth/consent/[uid]/Consent.tsx b/src/app/[variants]/oauth/consent/[uid]/Consent/index.tsxsimilarity index 94%rename from src/app/[variants]/oauth/consent/[uid]/Consent.tsxrename to src/app/[variants]/oauth/consent/[uid]/Consent/index.tsxindex 7fbbc0c0901..624fa1b0435 100644--- a/src/app/[variants]/oauth/consent/[uid]/Consent.tsx+++ b/src/app/[variants]/oauth/consent/[uid]/Consent/index.tsx@@ -7,7 +7,8 @@ import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';import { Center, Flexbox } from 'react-layout-kit';-import OAuthApplicationLogo from './components/OAuthApplicationLogo';+import OAuthApplicationLogo from '../components/OAuthApplicationLogo';+import BuiltinConsent from './BuiltinConsent';interface ClientProps {clientId: string;@@ -117,6 +118,8 @@ function getScopeDescription(scope: string, t: any): string {return t(`consent.scope.${scope.replace(':', '-')}`, scope);}+const BUILTIN_CLIENTS = new Set(['lobehub-desktop', 'lobehub-mobile', 'lobehub-market']);+const ConsentClient = memo<ClientProps>(({ uid, clientId, scopes, clientMetadata }) => {const { styles } = useStyles();const { t } = useTranslation('oauth');@@ -124,6 +127,11 @@ const ConsentClient = memo<ClientProps>(({ uid, clientId, scopes, clientMetadataconst [isLoading, setIsLoading] = useState(false);const clientDisplayName = clientMetadata?.clientName || clientId;++ if (BUILTIN_CLIENTS.has(clientId)) {+ return <BuiltinConsent uid={clientId} />;+ }+return (<Center className={styles.container} gap={16}><Flexbox gap={40}>diff --git a/src/app/[variants]/oauth/consent/[uid]/Login.tsx b/src/app/[variants]/oauth/consent/[uid]/Login.tsxindex c7459ae6e8f..3e2f65f553f 100644--- a/src/app/[variants]/oauth/consent/[uid]/Login.tsx+++ b/src/app/[variants]/oauth/consent/[uid]/Login.tsx@@ -59,6 +59,8 @@ const LoginConfirmClient = memo<LoginConfirmProps>(({ uid, clientMetadata }) =>const avatar = useUserStore(userProfileSelectors.userAvatar);const nickName = useUserStore(userProfileSelectors.nickName);+ const [isLoading, setIsLoading] = React.useState(false);+const titleText = t('login.title', { clientName: clientDisplayName });const descriptionText = t('login.description', { clientName: clientDisplayName });const buttonText = t('login.button'); // Or "Continue"@@ -99,7 +101,12 @@ const LoginConfirmClient = memo<LoginConfirmProps>(({ uid, clientMetadata }) =><Flexbox gap={16}>{/* Form points to the endpoint handling login confirmation */}- <form action="/oidc/consent" method="post" style={{ width: '100%' }}>+ <form+ action="/oidc/consent"+ method="post"+ onSubmit={() => setIsLoading(true)}+ style={{ width: '100%' }}+ >{/* Adjust action URL */}<input name="uid" type="hidden" value={uid} /><input name="choice" type="hidden" value={'accept'} />@@ -108,6 +115,7 @@ const LoginConfirmClient = memo<LoginConfirmProps>(({ uid, clientMetadata }) =>className={styles.authButton}disabled={!isUserStateInit}htmlType="submit"+ loading={isLoading}name="consent"size="large"type="primary"diff --git a/src/locales/default/oauth.ts b/src/locales/default/oauth.tsindex 3f485c61e70..47fa6f02b8f 100644--- a/src/locales/default/oauth.ts+++ b/src/locales/default/oauth.ts@@ -19,6 +19,7 @@ const oauth = {},permissionsTitle: '请求以下权限:',redirectUri: '授权成功后将重定向到',+ redirecting: '授权成功,跳转中...',scope: {'email': '访问您的电子邮件地址','offline_access': '允许客户端访问您的数据',