From 8a679aa772d76475ecf10f4e01be9da9cb32dadc Mon Sep 17 00:00:00 2001 From: LobeHub Bot Date: Mon, 9 Mar 2026 20:03:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20chore:=20translate=20non-English?= =?UTF-8?q?=20comments=20to=20English=20in=20src/app/(backend)=20(#12836)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🌐 chore: translate non-English comments to English in src/app/(backend) and src/app/[variants]/(auth) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 --- src/app/(backend)/api/agent/run/route.ts | 2 +- .../(backend)/market/oidc/[[...segments]]/route.ts | 4 ++-- src/app/(backend)/oidc/[...oidc]/route.ts | 10 +++++----- src/app/(backend)/oidc/callback/desktop/route.ts | 8 ++++---- .../webapi/user/avatar/[id]/[image]/route.ts | 4 ++-- src/app/[variants]/(auth)/_layout/style.ts | 6 +++--- .../[variants]/(auth)/market-auth-callback/page.tsx | 10 +++++----- .../[variants]/(auth)/oauth/consent/[uid]/page.tsx | 12 ++++++------ src/config/featureFlags/utils/parser.ts | 10 +++++----- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/app/(backend)/api/agent/run/route.ts b/src/app/(backend)/api/agent/run/route.ts index 756b2887a6..5bbb79e00a 100644 --- a/src/app/(backend)/api/agent/run/route.ts +++ b/src/app/(backend)/api/agent/run/route.ts @@ -70,7 +70,7 @@ export async function POST(request: NextRequest) { { status: 429, headers: { - 'Retry-After': '37', // 单位:秒 + 'Retry-After': '37', // unit: seconds }, }, ); diff --git a/src/app/(backend)/market/oidc/[[...segments]]/route.ts b/src/app/(backend)/market/oidc/[[...segments]]/route.ts index ca5622bf5b..8a8b92a537 100644 --- a/src/app/(backend)/market/oidc/[[...segments]]/route.ts +++ b/src/app/(backend)/market/oidc/[[...segments]]/route.ts @@ -165,7 +165,7 @@ const handleProxy = async (req: NextRequest, context: RouteContext) => { try { const { token } = (await req.json()) as { token?: string }; - // 如果没有 token,尝试使用 trustedClientToken + // If no token is provided, attempt to use trustedClientToken if (!token) { const trustedClientToken = await getTrustedClientTokenForSession(); @@ -180,7 +180,7 @@ const handleProxy = async (req: NextRequest, context: RouteContext) => { ); } - // 使用 trustedClientToken 直接调用 Market userinfo 端点 + // Use trustedClientToken to directly call the Market userinfo endpoint const userInfoUrl = `${MARKET_BASE_URL}/lobehub-oidc/userinfo`; const response = await fetch(userInfoUrl, { headers: { diff --git a/src/app/(backend)/oidc/[...oidc]/route.ts b/src/app/(backend)/oidc/[...oidc]/route.ts index 4d5998161d..ee9fbe876f 100644 --- a/src/app/(backend)/oidc/[...oidc]/route.ts +++ b/src/app/(backend)/oidc/[...oidc]/route.ts @@ -15,7 +15,7 @@ const handler = async (req: NextRequest) => { log(`Received ${req.method.toUpperCase()} request: %s %s`, req.method, req.url); log('Path: %s, Pathname: %s', requestUrl.pathname, requestUrl.pathname); - // 声明响应收集器 + // Declare the response collector let responseCollector; try { @@ -24,7 +24,7 @@ const handler = async (req: NextRequest) => { return new NextResponse('OIDC is not enabled', { status: 404 }); } - // 获取 OIDC Provider 实例 + // Get the OIDC Provider instance const provider = await getOIDCProvider(); log(`Calling provider.callback() for ${req.method}`); // Log the method @@ -41,11 +41,11 @@ const handler = async (req: NextRequest) => { return; } - // 使用辅助方法创建响应收集器 + // Use helper method to create the response collector responseCollector = createNodeResponse(resolve); const nodeResponse = responseCollector.nodeResponse; - // 使用辅助方法创建 Node.js 请求对象,现在需要 await + // Use helper method to create the Node.js request object, now requires await createNodeRequest(req).then((nodeRequest) => { log('Calling the obtained middleware...'); middleware(nodeRequest, nodeResponse, (error?: Error) => { @@ -66,7 +66,7 @@ const handler = async (req: NextRequest) => { log('Promise surrounding middleware call resolved.'); - // 访问最终的响应状态 + // Access the final response status if (!responseCollector) { throw new Error('ResponseCollector was not initialized.'); } diff --git a/src/app/(backend)/oidc/callback/desktop/route.ts b/src/app/(backend)/oidc/callback/desktop/route.ts index 2e4d4ee3b3..f4328c2e19 100644 --- a/src/app/(backend)/oidc/callback/desktop/route.ts +++ b/src/app/(backend)/oidc/callback/desktop/route.ts @@ -11,10 +11,10 @@ const log = debug('lobe-oidc:callback:desktop'); const errorPathname = '/oauth/callback/error'; /** - * 安全地构建重定向URL - 直接使用 APP_URL 作为目标 + * Safely build redirect URL - directly use APP_URL as target */ const buildRedirectUrl = (req: NextRequest, pathname: string): URL => { - // 使用统一的环境变量管理 + // Use unified environment variable management if (appEnv.APP_URL) { try { const baseUrl = new URL(appEnv.APP_URL); @@ -26,7 +26,7 @@ const buildRedirectUrl = (req: NextRequest, pathname: string): URL => { } } - // 后备方案:使用 req.nextUrl + // Fallback: use req.nextUrl log('Warning: APP_URL not configured, using req.nextUrl as fallback'); const fallbackUrl = req.nextUrl.clone(); fallbackUrl.pathname = pathname; @@ -62,7 +62,7 @@ export const GET = async (req: NextRequest) => { const successUrl = buildRedirectUrl(req, '/oauth/callback/success'); - // 添加调试日志 + // Add debug logging log('Request host header: %s', req.headers.get('host')); log('Request x-forwarded-host: %s', req.headers.get('x-forwarded-host')); log('Request x-forwarded-proto: %s', req.headers.get('x-forwarded-proto')); diff --git a/src/app/(backend)/webapi/user/avatar/[id]/[image]/route.ts b/src/app/(backend)/webapi/user/avatar/[id]/[image]/route.ts index 46a8779ff5..cda2619d28 100644 --- a/src/app/(backend)/webapi/user/avatar/[id]/[image]/route.ts +++ b/src/app/(backend)/webapi/user/avatar/[id]/[image]/route.ts @@ -3,7 +3,7 @@ import { UserService } from '@/server/services/user'; type Params = Promise<{ id: string; image: string }>; -// 扩展名到内容类型的映射 +// Mapping of file extensions to content types const CONTENT_TYPE_MAP: Record = { avif: 'image/avif', bmp: 'image/bmp', @@ -20,7 +20,7 @@ const CONTENT_TYPE_MAP: Record = { webp: 'image/webp', }; -// 根据文件扩展名确定内容类型 +// Determine content type based on file extension function getContentType(filename: string): string { const extension = filename.split('.').pop()?.toLowerCase() || ''; return CONTENT_TYPE_MAP[extension] || 'application/octet-stream'; diff --git a/src/app/[variants]/(auth)/_layout/style.ts b/src/app/[variants]/(auth)/_layout/style.ts index 9c6aa8508d..bbef965586 100644 --- a/src/app/[variants]/(auth)/_layout/style.ts +++ b/src/app/[variants]/(auth)/_layout/style.ts @@ -5,7 +5,7 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({ height: 24px; `, - // 内层容器 - 深色模式 + // Inner container - dark mode innerContainerDark: css` position: relative; @@ -17,7 +17,7 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({ background: ${cssVar.colorBgContainer}; `, - // 内层容器 - 浅色模式 + // Inner container - light mode innerContainerLight: css` position: relative; @@ -29,7 +29,7 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({ background: ${cssVar.colorBgContainer}; `, - // 外层容器 + // Outer container outerContainer: css` position: relative; `, diff --git a/src/app/[variants]/(auth)/market-auth-callback/page.tsx b/src/app/[variants]/(auth)/market-auth-callback/page.tsx index 41a9126993..0887435a17 100644 --- a/src/app/[variants]/(auth)/market-auth-callback/page.tsx +++ b/src/app/[variants]/(auth)/market-auth-callback/page.tsx @@ -8,8 +8,8 @@ import { useTranslation } from 'react-i18next'; type CallbackStatus = 'loading' | 'success' | 'error'; /** - * Market OIDC 授权回调页面 - * 处理从 OIDC 服务器返回的授权码 + * Market OIDC authorization callback page + * Handles the authorization code returned from the OIDC server */ const MarketAuthCallbackPage = () => { const { t } = useTranslation('marketAuth'); @@ -31,7 +31,7 @@ const MarketAuthCallbackPage = () => { setStatus('error'); setMessage(t('callback.messages.authFailed', { error: errorDescription || error })); - // 向父窗口发送错误消息 + // Send error message to parent window if (window.opener) { window.opener.postMessage( { @@ -49,7 +49,7 @@ const MarketAuthCallbackPage = () => { setStatus('success'); setMessage(t('callback.messages.successWithRedirect')); - // 向父窗口发送成功消息 + // Send success message to parent window if (window.opener) { window.opener.postMessage( { @@ -61,7 +61,7 @@ const MarketAuthCallbackPage = () => { ); } - // 开始倒计时并在3秒后关闭窗口 + // Start countdown and close window after 3 seconds let timeLeft = 3; setCountdown(timeLeft); diff --git a/src/app/[variants]/(auth)/oauth/consent/[uid]/page.tsx b/src/app/[variants]/(auth)/oauth/consent/[uid]/page.tsx index ef68a4f858..ed6b38b7fd 100644 --- a/src/app/[variants]/(auth)/oauth/consent/[uid]/page.tsx +++ b/src/app/[variants]/(auth)/oauth/consent/[uid]/page.tsx @@ -17,10 +17,10 @@ const InteractionPage = async (props: { params: Promise<{ uid: string }> }) => { try { const oidcService = await OIDCService.initialize(); - // 获取交互详情,传入请求和响应对象 + // Get interaction details, passing request and response objects const details = await oidcService.getInteractionDetails(uid); - // 支持 login 和 consent 类型的交互 + // Support login and consent type interactions if (details.prompt.name !== 'consent' && details.prompt.name !== 'login') { return ( }) => { ); } - // 获取客户端 ID 和授权范围 + // Get client ID and authorization scopes const clientId = (details.params.client_id as string) || 'unknown'; const scopes = (details.params.scope as string)?.split(' ') || []; @@ -44,7 +44,7 @@ const InteractionPage = async (props: { params: Promise<{ uid: string }> }) => { isFirstParty: defaultClients.map((c) => c.client_id).includes(clientId), logo: clientDetail?.logo_uri, }; - // 渲染客户端组件,无论是 login 还是 consent 类型 + // Render client component regardless of login or consent type if (details.prompt.name === 'login') return ; @@ -59,9 +59,9 @@ const InteractionPage = async (props: { params: Promise<{ uid: string }> }) => { ); } catch (error) { console.error('Error handling OIDC interaction:', error); - // 确保错误处理能正确显示 + // Ensure error handling can display correctly const errorMessage = error instanceof Error ? error.message : undefined; - // 检查是否是 'interaction session not found' 错误,可以给用户更友好的提示 + // Check if it is an 'interaction session not found' error for a more user-friendly message if (errorMessage?.includes('interaction session not found')) { return ( { const flags: Partial = {}; if (!flagString) return flags; - // 将中文逗号替换为英文逗号,并按逗号分割字符串 + // Replace Chinese commas with English commas and split string by comma const flagArray = flagString.trim().replaceAll(',', ',').split(','); for (let flag of flagArray) { @@ -22,7 +22,7 @@ export function parseFeatureFlag(flagString?: string): Partial { const featureKey = key as keyof IFeatureFlags; - // 检查 key 是否存在于 FeatureFlagsSchema 中 + // Check if the key exists in FeatureFlagsSchema if (FeatureFlagsSchema.shape[featureKey]) { flags[featureKey] = operation === '+'; }