diff --git a/app/secret/page.tsx b/app/secret/page.tsx index 92ab1e8..dbadeff 100644 --- a/app/secret/page.tsx +++ b/app/secret/page.tsx @@ -49,7 +49,6 @@ function SecretHomePage() { results={results} availableSources={availableSources} loading={loading} - openDirectLinks={true} /> )} diff --git a/components/home/SearchResults.tsx b/components/home/SearchResults.tsx index 311e093..f8efeac 100644 --- a/components/home/SearchResults.tsx +++ b/components/home/SearchResults.tsx @@ -11,10 +11,9 @@ interface SearchResultsProps { results: Video[]; availableSources: SourceBadge[]; loading: boolean; - openDirectLinks?: boolean; } -export function SearchResults({ results, availableSources, loading, openDirectLinks = false }: SearchResultsProps) { +export function SearchResults({ results, availableSources, loading }: SearchResultsProps) { // Source badges hook - filters by video source const { selectedSources, @@ -62,7 +61,7 @@ export function SearchResults({ results, availableSources, loading, openDirectLi )} {/* Display filtered videos (both source and type filters applied) */} - + ); } diff --git a/components/search/VideoCard.tsx b/components/search/VideoCard.tsx index 705a6b0..dba1cab 100644 --- a/components/search/VideoCard.tsx +++ b/components/search/VideoCard.tsx @@ -15,7 +15,7 @@ interface VideoCardProps { videoUrl: string; cardId: string; isActive: boolean; - onCardClick: (e: React.MouseEvent, cardId: string, videoUrl: string, video: Video) => void; + onCardClick: (e: React.MouseEvent, cardId: string, videoUrl: string) => void; } export const VideoCard = memo(({ @@ -35,7 +35,7 @@ export const VideoCard = memo(({ onCardClick(e, cardId, videoUrl, video)} + onClick={(e) => onCardClick(e, cardId, videoUrl)} role="listitem" aria-label={`${video.vod_name}${video.vod_remarks ? ` - ${video.vod_remarks}` : ''}`} prefetch={false} diff --git a/components/search/VideoGrid.tsx b/components/search/VideoGrid.tsx index 794cb90..3df511e 100644 --- a/components/search/VideoGrid.tsx +++ b/components/search/VideoGrid.tsx @@ -8,10 +8,9 @@ import { Video } from '@/lib/types'; interface VideoGridProps { videos: Video[]; className?: string; - openDirectLinks?: boolean; } -export const VideoGrid = memo(function VideoGrid({ videos, className = '', openDirectLinks = false }: VideoGridProps) { +export const VideoGrid = memo(function VideoGrid({ videos, className = '' }: VideoGridProps) { const [activeCardId, setActiveCardId] = useState(null); const [visibleCount, setVisibleCount] = useState(24); const gridRef = useRef(null); @@ -37,25 +36,7 @@ export const VideoGrid = memo(function VideoGrid({ videos, className = '', openD }, []); // Memoize the click handler to prevent re-renders - const handleCardClick = useCallback((e: React.MouseEvent, videoId: string, videoUrl: string, video?: Video) => { - if (openDirectLinks && video?.vod_play_url) { - // For secret page: extract first video URL and open directly - e.preventDefault(); - const playUrls = video.vod_play_url.split('$$$'); - if (playUrls.length > 0) { - const firstPlaylist = playUrls[0]; - const segments = firstPlaylist.split('#'); - if (segments.length > 0) { - const urls = segments[0].split('$'); - if (urls.length > 1) { - window.open(urls[1], '_blank'); - return; - } - } - } - return; - } - + const handleCardClick = useCallback((e: React.MouseEvent, videoId: string, videoUrl: string) => { // Check if it's a mobile device const isMobile = window.innerWidth < 1024; // lg breakpoint @@ -71,7 +52,7 @@ export const VideoGrid = memo(function VideoGrid({ videos, className = '', openD } } // On desktop, let the Link work normally - }, [activeCardId, openDirectLinks]); + }, [activeCardId]); // Memoize video items to prevent unnecessary re-computations const videoItems = useMemo(() => { diff --git a/lib/api/video-sources.ts b/lib/api/video-sources.ts index 81fcf4f..4d2e117 100644 --- a/lib/api/video-sources.ts +++ b/lib/api/video-sources.ts @@ -5,12 +5,20 @@ import type { VideoSource } from '@/lib/types'; import { DEFAULT_SOURCES } from './default-sources'; +import { ADULT_SOURCES } from './adult-sources'; /** - * Get source by ID + * Get source by ID from both default and adult sources */ export function getSourceById(id: string): VideoSource | undefined { - return DEFAULT_SOURCES.find(source => source.id === id); + // Search in default sources first + const defaultSource = DEFAULT_SOURCES.find(source => source.id === id); + if (defaultSource) { + return defaultSource; + } + + // Search in adult sources + return ADULT_SOURCES.find(source => source.id === id); } diff --git a/lib/types/index.ts b/lib/types/index.ts index 9778ff6..af40e43 100644 --- a/lib/types/index.ts +++ b/lib/types/index.ts @@ -26,7 +26,6 @@ export interface VideoItem { vod_actor?: string; vod_director?: string; vod_content?: string; - vod_play_url?: string; source: string; latency?: number; // Response time in milliseconds }