服务器代理豆瓣反防盗链

This commit is contained in:
mtvpls
2026-01-09 21:53:23 +08:00
parent fc28992123
commit a41e69c387
2 changed files with 4 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ import { useEffect, useState, useCallback, useRef } from 'react';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
import { getTMDBImageUrl, getGenreNames, type TMDBItem } from '@/lib/tmdb.client';
import { processImageUrl } from '@/lib/utils';
import { ChevronLeft, ChevronRight, Play } from 'lucide-react';
interface BannerCarouselProps {
@@ -48,14 +49,9 @@ export default function BannerCarousel({ autoPlayInterval = 5000 }: BannerCarous
// 获取图片URL处理TX完整URL和TMDB路径
const getImageUrl = (path: string | null) => {
if (!path) return '';
// 如果是完整URLTX数据源或豆瓣需要判断是否需要代
// 如果是完整URLTX数据源或豆瓣使用processImageUrl统一处
if (path.startsWith('http://') || path.startsWith('https://')) {
// 豆瓣图片直接使用服务器代理
if (path.includes('doubanio.com')) {
return `/api/image-proxy?url=${encodeURIComponent(path)}`;
}
// TX等其他完整URL直接返回
return path;
return processImageUrl(path);
}
// 否则使用TMDB的URL拼接
return getTMDBImageUrl(path, 'original');