diff --git a/app/page.tsx b/app/page.tsx index 3a203d0..be1cdd8 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2,6 +2,7 @@ import { useState, useRef } from 'react'; import { useRouter } from 'next/navigation'; +import Link from 'next/link'; import { ThemeSwitcher } from '@/components/ThemeSwitcher'; import { Button } from '@/components/ui/Button'; import { Input } from '@/components/ui/Input'; @@ -48,9 +49,9 @@ export default function Home() { try { // Get all enabled source IDs - const sourceIds = ['custom_0', 'custom_1', 'custom_2', 'custom_3', 'custom_4', - 'custom_5', 'custom_6', 'custom_7', 'custom_8', 'custom_9', - 'custom_10', 'custom_11', 'custom_12', 'custom_13', 'custom_14', 'custom_15']; + const sourceIds = ['dytt', 'ruyi', 'baofeng', 'tianya', 'feifan', + 'sanliuling', 'wolong', 'jisu', 'mozhua', 'modu', + 'zuida', 'yinghua', 'baiduyun', 'wujin', 'wangwang', 'ikun']; // Use streaming API const response = await fetch('/api/search-stream', { @@ -180,41 +181,26 @@ export default function Home() { const getSourceName = (sourceId: string): string => { const sourceNames: Record = { - 'custom_0': '电影天堂', - 'custom_1': '如意', - 'custom_2': '暴风', - 'custom_3': '天涯', - 'custom_4': '非凡影视', - 'custom_5': '360', - 'custom_6': '卧龙', - 'custom_7': '极速', - 'custom_8': '魔爪', - 'custom_9': '魔都', - 'custom_10': '海外看', - 'custom_11': '新浪', - 'custom_12': '光速', - 'custom_13': '红牛', - 'custom_14': '樱花', - 'custom_15': '飞速', + 'dytt': '电影天堂', + 'ruyi': '如意', + 'baofeng': '暴风', + 'tianya': '天涯', + 'feifan': '非凡影视', + 'sanliuling': '360', + 'wolong': '卧龙', + 'jisu': '极速', + 'mozhua': '魔爪', + 'modu': '魔都', + 'zuida': '最大', + 'yinghua': '樱花', + 'baiduyun': '百度云', + 'wujin': '无尽', + 'wangwang': '旺旺', + 'ikun': 'iKun', }; return sourceNames[sourceId] || sourceId; }; - const handleVideoClick = (video: any) => { - // Abort ongoing search when user clicks a video - if (abortControllerRef.current && loading) { - abortControllerRef.current.abort(); - setLoading(false); - } - - const params = new URLSearchParams({ - id: video.vod_id, - source: video.source, - title: video.vod_name, - }); - router.push(`/player?${params.toString()}`); - }; - return (
{/* Glass Navbar */} @@ -295,7 +281,7 @@ export default function Home() {
{/* Results Section */} - {(results.length >= 10 || (!loading && results.length > 0)) && ( + {(results.length >= 1 || (!loading && results.length > 0)) && (
@@ -348,67 +334,78 @@ export default function Home() {
- {results.map((video, index) => ( - handleVideoClick(video)} - className={`p-0 overflow-hidden group cursor-pointer ${video.isNew ? 'animate-scale-in' : ''}`} - > - {/* Poster */} -
- {video.vod_pic ? ( - {video.vod_name} - ) : ( -
- -
- )} - - {/* Source Badge - Top Left */} - {video.sourceName && ( -
- - {video.sourceName} - -
- )} - - {/* Overlay */} -
-
- {video.type_name && ( - - {video.type_name} - - )} - {video.vod_year && ( -
- - {video.vod_year} + {results.map((video, index) => { + const videoUrl = `/player?${new URLSearchParams({ + id: video.vod_id, + source: video.source, + title: video.vod_name, + }).toString()}`; + + return ( + + + {/* Poster */} +
+ {video.vod_pic ? ( + {video.vod_name} + ) : ( +
+
)} + + {/* Source Badge - Top Left */} + {video.sourceName && ( +
+ + {video.sourceName} + +
+ )} + + {/* Overlay */} +
+
+ {video.type_name && ( + + {video.type_name} + + )} + {video.vod_year && ( +
+ + {video.vod_year} +
+ )} +
+
-
-
- {/* Info */} -
-

- {video.vod_name} -

- {video.vod_remarks && ( -

- {video.vod_remarks} -

- )} -
- - ))} + {/* Info */} +
+

+ {video.vod_name} +

+ {video.vod_remarks && ( +

+ {video.vod_remarks} +

+ )} +
+ + + ); + })}
)} diff --git a/app/player/page.tsx b/app/player/page.tsx index df8010c..c3f8cd0 100644 --- a/app/player/page.tsx +++ b/app/player/page.tsx @@ -7,6 +7,7 @@ import { Button } from '@/components/ui/Button'; import { Badge } from '@/components/ui/Badge'; import { ThemeSwitcher } from '@/components/ThemeSwitcher'; import { Icons } from '@/components/ui/Icon'; +import Image from 'next/image'; function PlayerContent() { const searchParams = useSearchParams(); @@ -27,22 +28,22 @@ function PlayerContent() { const getSourceName = (sourceId: string | null): string => { if (!sourceId) return ''; const sourceNames: Record = { - 'custom_0': '电影天堂', - 'custom_1': '如意', - 'custom_2': '暴风', - 'custom_3': '天涯', - 'custom_4': '非凡影视', - 'custom_5': '360', - 'custom_6': '卧龙', - 'custom_7': '极速', - 'custom_8': '魔爪', - 'custom_9': '魔都', - 'custom_10': '海外看', - 'custom_11': '新浪', - 'custom_12': '光速', - 'custom_13': '红牛', - 'custom_14': '樱花', - 'custom_15': '飞速', + 'dytt': '电影天堂', + 'ruyi': '如意', + 'baofeng': '暴风', + 'tianya': '天涯', + 'feifan': '非凡影视', + 'sanliuling': '360', + 'wolong': '卧龙', + 'jisu': '极速', + 'mozhua': '魔爪', + 'modu': '魔都', + 'zuida': '最大', + 'yinghua': '樱花', + 'baiduyun': '百度云', + 'wujin': '无尽', + 'wangwang': '旺旺', + 'ikun': 'iKun', }; return sourceNames[sourceId] || sourceId; }; @@ -154,14 +155,30 @@ function PlayerContent() {