tmdb支持设置baseurl
This commit is contained in:
@@ -7384,7 +7384,7 @@ const SiteConfigComponent = ({
|
||||
{/* TMDB Proxy */}
|
||||
<div>
|
||||
<label className='block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2'>
|
||||
TMDB 代理
|
||||
TMDB 系统代理
|
||||
</label>
|
||||
<input
|
||||
type='text'
|
||||
@@ -7402,6 +7402,28 @@ const SiteConfigComponent = ({
|
||||
配置代理服务器地址,用于访问 TMDB API(可选)
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* TMDB Reverse Proxy */}
|
||||
<div>
|
||||
<label className='block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2'>
|
||||
TMDB 反代代理
|
||||
</label>
|
||||
<input
|
||||
type='text'
|
||||
placeholder='请输入反代 Base URL(可选)'
|
||||
value={siteSettings.TMDBReverseProxy}
|
||||
onChange={(e) =>
|
||||
setSiteSettings((prev) => ({
|
||||
...prev,
|
||||
TMDBReverseProxy: e.target.value,
|
||||
}))
|
||||
}
|
||||
className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-green-500 focus:border-transparent'
|
||||
/>
|
||||
<p className='mt-1 text-xs text-gray-500 dark:text-gray-400'>
|
||||
配置 TMDB 反向代理 Base URL(可选)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Pansou 配置 */}
|
||||
|
||||
@@ -43,6 +43,7 @@ export async function POST(request: NextRequest) {
|
||||
DanmakuApiToken,
|
||||
TMDBApiKey,
|
||||
TMDBProxy,
|
||||
TMDBReverseProxy,
|
||||
BannerDataSource,
|
||||
RecommendationDataSource,
|
||||
PansouApiUrl,
|
||||
@@ -124,6 +125,7 @@ export async function POST(request: NextRequest) {
|
||||
typeof DanmakuApiToken !== 'string' ||
|
||||
(TMDBApiKey !== undefined && typeof TMDBApiKey !== 'string') ||
|
||||
(TMDBProxy !== undefined && typeof TMDBProxy !== 'string') ||
|
||||
(TMDBReverseProxy !== undefined && typeof TMDBReverseProxy !== 'string') ||
|
||||
(BannerDataSource !== undefined && typeof BannerDataSource !== 'string') ||
|
||||
(RecommendationDataSource !== undefined && typeof RecommendationDataSource !== 'string') ||
|
||||
typeof EnableComments !== 'boolean' ||
|
||||
@@ -175,6 +177,7 @@ export async function POST(request: NextRequest) {
|
||||
DanmakuApiToken,
|
||||
TMDBApiKey,
|
||||
TMDBProxy,
|
||||
TMDBReverseProxy,
|
||||
BannerDataSource,
|
||||
RecommendationDataSource,
|
||||
PansouApiUrl,
|
||||
|
||||
@@ -61,6 +61,7 @@ export async function GET(request: NextRequest) {
|
||||
const config = await getConfig();
|
||||
const tmdbApiKey = config.SiteConfig.TMDBApiKey;
|
||||
const tmdbProxy = config.SiteConfig.TMDBProxy;
|
||||
const tmdbReverseProxy = config.SiteConfig.TMDBReverseProxy;
|
||||
|
||||
if (!tmdbApiKey) {
|
||||
return NextResponse.json(
|
||||
@@ -94,7 +95,8 @@ export async function GET(request: NextRequest) {
|
||||
const searchResult = await searchTMDBMulti(
|
||||
tmdbApiKey,
|
||||
cleanedTitle,
|
||||
tmdbProxy
|
||||
tmdbProxy,
|
||||
tmdbReverseProxy
|
||||
);
|
||||
|
||||
if (searchResult.code !== 200 || !searchResult.results.length) {
|
||||
@@ -134,9 +136,9 @@ export async function GET(request: NextRequest) {
|
||||
// 获取详情
|
||||
let detailsResult;
|
||||
if (mediaType === 'movie') {
|
||||
detailsResult = await getTMDBMovieDetails(tmdbApiKey, tmdbId, tmdbProxy);
|
||||
detailsResult = await getTMDBMovieDetails(tmdbApiKey, tmdbId, tmdbProxy, tmdbReverseProxy);
|
||||
} else {
|
||||
detailsResult = await getTMDBTVDetails(tmdbApiKey, tmdbId, tmdbProxy);
|
||||
detailsResult = await getTMDBTVDetails(tmdbApiKey, tmdbId, tmdbProxy, tmdbReverseProxy);
|
||||
}
|
||||
|
||||
if (detailsResult.code !== 200 || !detailsResult.details) {
|
||||
|
||||
@@ -62,6 +62,7 @@ export async function GET(request: NextRequest) {
|
||||
const config = await getConfig();
|
||||
const tmdbApiKey = config.SiteConfig.TMDBApiKey;
|
||||
const tmdbProxy = config.SiteConfig.TMDBProxy;
|
||||
const tmdbReverseProxy = config.SiteConfig.TMDBReverseProxy;
|
||||
|
||||
if (!tmdbApiKey) {
|
||||
return NextResponse.json(
|
||||
@@ -90,7 +91,7 @@ export async function GET(request: NextRequest) {
|
||||
mediaType = cached.data.mediaType;
|
||||
} else {
|
||||
// 搜索TMDB
|
||||
const searchResult = await searchTMDBMulti(tmdbApiKey, cleanedTitle, tmdbProxy);
|
||||
const searchResult = await searchTMDBMulti(tmdbApiKey, cleanedTitle, tmdbProxy, tmdbReverseProxy);
|
||||
|
||||
if (searchResult.code !== 200 || !searchResult.results.length) {
|
||||
return NextResponse.json(
|
||||
@@ -145,8 +146,8 @@ export async function GET(request: NextRequest) {
|
||||
// 获取推荐
|
||||
const recommendationsResult =
|
||||
mediaType === 'movie'
|
||||
? await getTMDBMovieRecommendations(tmdbApiKey, tmdbId, tmdbProxy)
|
||||
: await getTMDBTVRecommendations(tmdbApiKey, tmdbId, tmdbProxy);
|
||||
? await getTMDBMovieRecommendations(tmdbApiKey, tmdbId, tmdbProxy, tmdbReverseProxy)
|
||||
: await getTMDBTVRecommendations(tmdbApiKey, tmdbId, tmdbProxy, tmdbReverseProxy);
|
||||
|
||||
if (recommendationsResult.code !== 200) {
|
||||
return NextResponse.json(
|
||||
|
||||
@@ -56,6 +56,7 @@ export async function GET() {
|
||||
// 使用TMDB数据源(默认)
|
||||
const apiKey = config.SiteConfig?.TMDBApiKey;
|
||||
const proxy = config.SiteConfig?.TMDBProxy;
|
||||
const reverseProxy = config.SiteConfig?.TMDBReverseProxy;
|
||||
|
||||
if (!apiKey) {
|
||||
return NextResponse.json(
|
||||
@@ -65,13 +66,13 @@ export async function GET() {
|
||||
}
|
||||
|
||||
// 获取热门内容
|
||||
result = await getTMDBTrendingContent(apiKey, proxy);
|
||||
result = await getTMDBTrendingContent(apiKey, proxy, reverseProxy);
|
||||
|
||||
// 为每个项目获取视频数据
|
||||
if (result.code === 200 && result.list) {
|
||||
const itemsWithVideos = await Promise.all(
|
||||
result.list.map(async (item: any) => {
|
||||
const videoKey = await getTMDBVideos(apiKey, item.media_type, item.id, proxy);
|
||||
const videoKey = await getTMDBVideos(apiKey, item.media_type, item.id, proxy, reverseProxy);
|
||||
return { ...item, video_key: videoKey };
|
||||
})
|
||||
);
|
||||
|
||||
@@ -28,6 +28,7 @@ export async function GET(request: NextRequest) {
|
||||
const config = await getConfig();
|
||||
const tmdbApiKey = config.SiteConfig?.TMDBApiKey;
|
||||
const tmdbProxy = config.SiteConfig?.TMDBProxy;
|
||||
const tmdbReverseProxy = config.SiteConfig?.TMDBReverseProxy;
|
||||
|
||||
if (!tmdbApiKey) {
|
||||
return NextResponse.json(
|
||||
@@ -37,7 +38,7 @@ export async function GET(request: NextRequest) {
|
||||
}
|
||||
|
||||
// 调用TMDB API获取数据
|
||||
const result = await getTMDBUpcomingContent(tmdbApiKey, tmdbProxy);
|
||||
const result = await getTMDBUpcomingContent(tmdbApiKey, tmdbProxy, tmdbReverseProxy);
|
||||
|
||||
if (result.code !== 200) {
|
||||
return NextResponse.json(
|
||||
|
||||
Reference in New Issue
Block a user