From d3db6388e199df067eea8bfc3d0189593564cbfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=9E=E5=87=A1=E4=B8=BB=E5=84=BF?= <15541157+extraordinary-lord@user.noreply.gitee.com> Date: Mon, 20 Oct 2025 19:59:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=88=87=E6=8D=A2=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/common/ShareModal.tsx | 4 ++-- components/common/TwitterCallbackModal.tsx | 4 ++-- components/pages/create-to-video2.tsx | 2 +- lib/env.ts | 10 +++------- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/components/common/ShareModal.tsx b/components/common/ShareModal.tsx index 0f4289f..d7536db 100644 --- a/components/common/ShareModal.tsx +++ b/components/common/ShareModal.tsx @@ -10,7 +10,7 @@ import { ExternalLink, Loader2 } from 'lucide-react'; -import { shareApiUrl } from '@/lib/env'; +import { baseUrl } from '@/lib/env'; import TwitterCallbackModal from './TwitterCallbackModal'; interface ShareModalProps { @@ -140,7 +140,7 @@ export default function ShareModal({ visible, onClose, project }: ShareModalProp localStorage.setItem('currentShareProject', JSON.stringify(project)); } - const response = await fetch(`${shareApiUrl}${apiPath}?user_id=${userId}`, { + const response = await fetch(`${baseUrl}${apiPath}?user_id=${userId}`, { method: 'GET', headers: { 'Content-Type': 'application/json', diff --git a/components/common/TwitterCallbackModal.tsx b/components/common/TwitterCallbackModal.tsx index c8c4697..ddb5157 100644 --- a/components/common/TwitterCallbackModal.tsx +++ b/components/common/TwitterCallbackModal.tsx @@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react'; import { Modal, Button, Spin, message } from 'antd'; import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons'; import { Loader2 } from 'lucide-react'; -import { shareApiUrl } from '@/lib/env'; +import { baseUrl } from '@/lib/env'; interface TwitterCallbackModalProps { /** 是否显示弹框 */ @@ -56,7 +56,7 @@ export default function TwitterCallbackModal({ } // 调用 Twitter 授权回调接口 - const response = await fetch(`${shareApiUrl}/api/video-share/x/auth/callback`, { + const response = await fetch(`${baseUrl}/api/video-share/x/auth/callback`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/components/pages/create-to-video2.tsx b/components/pages/create-to-video2.tsx index cb36648..d2dc400 100644 --- a/components/pages/create-to-video2.tsx +++ b/components/pages/create-to-video2.tsx @@ -15,7 +15,7 @@ import { Tooltip, Button } from 'antd'; import { downloadVideo, downloadAllVideos, getFirstFrame } from '@/utils/tools'; import { showDownloadOptionsModal } from '@/components/pages/work-flow/download-options-modal'; import { post, get } from '@/api/request'; -import { shareApiUrl } from '@/lib/env'; +import { baseUrl } from '@/lib/env'; import ShareModal from '@/components/common/ShareModal'; import Masonry from 'react-masonry-css'; import debounce from 'lodash/debounce'; diff --git a/lib/env.ts b/lib/env.ts index a57b7ab..d0f3170 100644 --- a/lib/env.ts +++ b/lib/env.ts @@ -17,8 +17,7 @@ export interface EnvConfig { javaUrl: string; cutUrl: string; cutUrlTo: string; - shareApiUrl: string; - + // Google OAuth 配置 googleClientId: string; googleRedirectUri: string; @@ -53,7 +52,6 @@ export const getEnvConfig = (): EnvConfig => { javaUrl: process.env.NEXT_PUBLIC_JAVA_URL || 'https://77.app.java.auth.qikongjian.com', cutUrl: process.env.NEXT_PUBLIC_CUT_URL || 'https://smartcut.api.movieflow.ai', cutUrlTo: process.env.NEXT_PUBLIC_CUT_URL_TO || 'https://smartcut.api.movieflow.ai', - shareApiUrl: process.env.NEXT_PUBLIC_SHARE_API_URL || 'http://39.97.48.225:8000', // Google OAuth 配置 googleClientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || '847079918888-o1nne8d3ij80dn20qurivo987pv07225.apps.googleusercontent.com', @@ -92,7 +90,6 @@ export const { javaUrl, cutUrl, cutUrlTo, - shareApiUrl, // Google OAuth 配置 googleClientId, @@ -158,7 +155,7 @@ export const validateEnvConfig = (): { isValid: boolean; errors: string[] } => { errors.push('NEXT_PUBLIC_JAVA_URL is required'); } - if (!shareApiUrl) { + if (!baseUrl) { errors.push('NEXT_PUBLIC_SHARE_API_URL is required'); } @@ -180,7 +177,7 @@ export const validateEnvConfig = (): { isValid: boolean; errors: string[] } => { } try { - new URL(shareApiUrl); + new URL(baseUrl); } catch { errors.push('NEXT_PUBLIC_SHARE_API_URL must be a valid URL'); } @@ -202,7 +199,6 @@ export const logEnvConfig = (): void => { javaUrl, cutUrl, cutUrlTo, - shareApiUrl, googleClientId, googleRedirectUri: getGoogleRedirectUri(), gaEnabled,