From 37cc53b166f3c84ab9f33eef387e8c90b166a91b Mon Sep 17 00:00:00 2001 From: mtvpls Date: Tue, 6 Jan 2026 16:09:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=9D=A5=E6=BA=90=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E4=BC=98=E5=85=88=E7=A7=81=E4=BA=BA=E5=BD=B1=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/search/page.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app/search/page.tsx b/src/app/search/page.tsx index 3a0a091..1e98ab7 100644 --- a/src/app/search/page.tsx +++ b/src/app/search/page.tsx @@ -291,7 +291,22 @@ function SearchPageClient() { const sourceOptions: { label: string; value: string }[] = [ { label: '全部来源', value: 'all' }, ...Array.from(sourcesSet.entries()) - .sort((a, b) => a[1].localeCompare(b[1])) + .sort((a, b) => { + // 优先排序:emby 和 openlist 置于最前 + const prioritySources = ['emby', 'openlist']; + const aIsPriority = prioritySources.includes(a[0]); + const bIsPriority = prioritySources.includes(b[0]); + + if (aIsPriority && !bIsPriority) return -1; + if (!aIsPriority && bIsPriority) return 1; + if (aIsPriority && bIsPriority) { + // 两者都是优先源,按照 prioritySources 数组顺序排列 + return prioritySources.indexOf(a[0]) - prioritySources.indexOf(b[0]); + } + + // 其他来源按字母顺序排列 + return a[1].localeCompare(b[1]); + }) .map(([value, label]) => ({ label, value })), ];