From 4da312e8c70a155e3ede76ebf48559405766ce38 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Tue, 3 Mar 2026 12:08:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E8=A7=86=E7=9B=B4=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E8=A1=8Cmp4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/emby/cms-proxy/[token]/route.ts | 10 +++++----- src/app/live/page.tsx | 6 +++--- src/lib/emby-token.ts | 9 +++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/app/api/emby/cms-proxy/[token]/route.ts b/src/app/api/emby/cms-proxy/[token]/route.ts index 12e07f0..24a5400 100644 --- a/src/app/api/emby/cms-proxy/[token]/route.ts +++ b/src/app/api/emby/cms-proxy/[token]/route.ts @@ -92,7 +92,7 @@ export async function GET( if (ac === 'detail') { return await handleDetailBySearch(client, wd, requestToken, embyKey, request); } - return await handleSearch(client, wd); + return await handleSearch(client, wd, requestToken); } else if (ids || ac === 'detail') { // 详情模式 if (!ids) { @@ -109,7 +109,7 @@ export async function GET( return await handleDetail(client, ids, requestToken, embyKey, request); } else { // 列表模式 - return await handleSearch(client, ''); + return await handleSearch(client, '', requestToken); } } catch (error) { console.error('[Emby CMS Proxy] 错误:', error); @@ -128,7 +128,7 @@ export async function GET( /** * 处理搜索请求 */ -async function handleSearch(client: EmbyClient, query: string) { +async function handleSearch(client: EmbyClient, query: string, token: string) { const result = await client.getItems({ searchTerm: query || undefined, IncludeItemTypes: 'Movie,Series', @@ -140,7 +140,7 @@ async function handleSearch(client: EmbyClient, query: string) { const list = result.Items.map((item) => ({ vod_id: item.Id, vod_name: item.Name, - vod_pic: client.getImageUrl(item.Id, 'Primary', undefined, requestToken), + vod_pic: client.getImageUrl(item.Id, 'Primary', undefined, token), vod_remarks: item.Type === 'Movie' ? '电影' : '剧集', vod_year: item.ProductionYear?.toString() || '', vod_content: item.Overview || '', @@ -247,7 +247,7 @@ async function handleDetail( { vod_id: item.Id, vod_name: item.Name, - vod_pic: client.getImageUrl(item.Id, 'Primary', undefined, requestToken), + vod_pic: client.getImageUrl(item.Id, 'Primary', undefined, token), vod_remarks: item.Type === 'Movie' ? '电影' : '剧集', vod_year: item.ProductionYear?.toString() || '', vod_content: item.Overview || '', diff --git a/src/app/live/page.tsx b/src/app/live/page.tsx index 288a97f..45ecd45 100644 --- a/src/app/live/page.tsx +++ b/src/app/live/page.tsx @@ -1485,8 +1485,8 @@ function LivePageClient() { return; } - // 如果不是 m3u8 或 flv 类型,设置不支持的类型并返回 - if (type !== 'm3u8' && type !== 'flv') { + // 如果不是 m3u8、flv 或 mp4 类型,设置不支持的类型并返回 + if (type !== 'm3u8' && type !== 'flv' && type !== 'mp4') { setUnsupportedType(type); setIsVideoLoading(false); return; @@ -1496,7 +1496,7 @@ function LivePageClient() { setUnsupportedType(null); const customType = { m3u8: m3u8Loader, flv: flvLoader }; - const targetUrl = type === 'flv' + const targetUrl = (type === 'flv' || type === 'mp4') ? videoUrl : `/api/proxy/m3u8?url=${encodeURIComponent(videoUrl)}&moontv-source=${currentSourceRef.current?.key || ''}`; try { diff --git a/src/lib/emby-token.ts b/src/lib/emby-token.ts index 376e89b..6f26bdb 100644 --- a/src/lib/emby-token.ts +++ b/src/lib/emby-token.ts @@ -3,7 +3,7 @@ import { getAuthInfoFromCookie } from './auth'; /** * 获取用于代理的 token - * 优先级:全局 token > 用户 token > null + * 优先级:全局 token > 用户 token(从 cookie 获取)> null */ export async function getProxyToken(request?: NextRequest): Promise { // 1. 尝试获取全局 token @@ -18,9 +18,10 @@ export async function getProxyToken(request?: NextRequest): Promise