一分钟搭建影视站,支持Docker等部署方式
fix(watch): 换源候选改为同名/同前缀匹配并跟随内容过滤设置,修复误推其他影片,版本 2.12.6
bestZweic303dd0b7366
diff --git a/package.json b/package.jsonindex fe2e998..b479c88 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "libretv",- "version": "2.12.5",+ "version": "2.12.6","private": true,"description": "免费在线视频搜索与观看平台(Next.js 重构版)","license": "AGPL-3.0-or-later",diff --git a/src/components/switch-source.tsx b/src/components/switch-source.tsxindex 8ad0c13..f2d8a52 100644--- a/src/components/switch-source.tsx+++ b/src/components/switch-source.tsx@@ -12,7 +12,7 @@ import { EmptyState, LoadingState } from './states';import { useFocusTrap } from './use-focus-trap';/**- * 换源面板:跨源按标题搜索 → 匹配同名资源 → 并发测速(详情接口耗时)→ 按速度排序展示。+ * 换源面板:跨源按标题搜索 → 匹配同名/同前缀资源 → 并发测速(详情接口耗时)→ 按速度排序展示。* 切换时保留当前集数索引(旧版 switchToResource 逻辑的去 DOM 化重写)。*/@@ -87,14 +87,19 @@ export function SwitchSourceModal({// 1) 并行搜索所有选中源setPhase('searching');try {- const { list } = await api.search(currentTitle, sources, false, { signal: controller.signal });+ const { list } = await api.search(currentTitle, sources, store.yellowFilter, { signal: controller.signal });if (cancelled) return;- // 每个源取完全同名结果,否则取第一个+ // 匹配口径:优先完全同名,其次名称以标题开头(兼容「小偷 HD」「小偷[电影解说]」这类修饰名)。+ // 都没有则不展示该源——不再兜底取搜索第一条,避免把搜到的其他影片(如搜「小偷」+ // 命中的《宝贝 小偷与大盗》)误当成换源目标。+ const title = currentTitle.trim();const matched: Candidate[] = [];for (const s of sources) {const hits = list.filter((r) => r.sourceKey === s.key);- const exact = hits.find((r) => r.name === currentTitle) || hits[0];+ const exact =+ hits.find((r) => (r.name || '').trim() === title) ??+ hits.find((r) => (r.name || '').trim().startsWith(title));if (exact) matched.push({ source: s, result: exact });}@@ -127,7 +132,7 @@ export function SwitchSourceModal({controller.abort();};// eslint-disable-next-line react-hooks/exhaustive-deps- }, [currentTitle]);+ }, [currentTitle, store.yellowFilter]);const sorted = [...candidates].sort((a, b) => {const aCurrent = a.source.key === currentSourceKey && String(a.result.vodId) === String(currentVodId);